コード例 #1
0
func isSkipTaskbar(xid xproto.Window) bool {
	state, err := ewmh.WmStateGet(XU, xid)
	if err != nil {
		return false
	}

	return contains(state, "_NET_WM_STATE_SKIP_TASKBAR")
}
コード例 #2
0
func getWindowState(X *xgbutil.XUtil, xid uint32) ([]string, error) {
	list, err := ewmh.WmStateGet(X, xproto.Window(xid))
	if err != nil {
		logger.Warning("Get window state failed:", err)
		return []string{}, err
	}

	return list, nil
}
コード例 #3
0
ファイル: main.go プロジェクト: cshapeshifter/wingo
// Using EWMH, ask the window manager whether the window is mapped or not.
func (w *window) setMapped() {
	states, err := ewmh.WmStateGet(w.X, w.id)
	fatal(err)
	for _, state := range states {
		if state == "_NET_WM_STATE_HIDDEN" {
			w.mapped = false
			return
		}
	}
	w.mapped = true
}
コード例 #4
0
func (self *SessionModule) x11HasWmState(id xproto.Window, state string) bool {
	states, _ := ewmh.WmStateGet(self.X, id)

	for _, s := range states {
		if s == state {
			return true
		}
	}

	return false
}
コード例 #5
0
func (app *RuntimeApp) updateState(xid xproto.Window) {
	logger.Debugf("get state of %s(0x%x)", app.Id, xid)
	//TODO: handle state
	var err error
	app.state, err = ewmh.WmStateGet(XU, xid)
	if err != nil {
		logger.Warningf("get state of %s(0x%x) failed: %s", app.Id, xid, err)
	}
	logger.Debugf("state of %s(0x%x) is %v", app.Id, xid, app.state)
	app.isHidden = contains(app.state, "_NET_WM_STATE_HIDDEN")
	app.isMaximized = contains(app.state, "_NET_WM_STATE_MAXIMIZED_VERT")
}
コード例 #6
0
func (self *SessionModule) removeState(id xproto.Window, state string) error {
	states, _ := ewmh.WmStateGet(self.X, id)

	for i, s := range states {
		if s == state {
			states = append(states[:i], states[i+1:]...)

			if err := ewmh.WmStateSet(self.X, id, states); err != nil {
				return err
			}
		}
	}

	return nil
}
コード例 #7
0
func (wa *fullScreenWorkaround) isFullScreen(xid xproto.Window) bool {
	states, _ := ewmh.WmStateGet(wa.xu, xid)
	found := 0
	for _, s := range states {
		if s == "_NET_WM_STATE_FULLSCREEN" {
			found++
		}
		if s == "_NET_WM_STATE_FOCUSED" {
			found++
		}
	}
	if found == 2 {
		logger.Debug("HAHAH:::::", states)
	}
	return found == 2
}
コード例 #8
0
func isHiddenPre(xid xproto.Window) bool {
	state, _ := ewmh.WmStateGet(XU, xid)
	return contains(state, "_NET_WM_STATE_HIDDEN")
}
コード例 #9
0
func isMaximizeVertClientPre(xid xproto.Window) bool {
	state, _ := ewmh.WmStateGet(XU, xid)
	return contains(state, "_NET_WM_STATE_MAXIMIZED_VERT")
}
コード例 #10
0
ファイル: manage.go プロジェクト: cshapeshifter/wingo
func (c *Client) fetchXProperties() {
	var err error

	c.hints, err = icccm.WmHintsGet(wm.X, c.Id())
	if err != nil {
		logger.Warning.Println(err)
		logger.Message.Printf("Using reasonable defaults for WM_HINTS for %X",
			c.Id())
		c.hints = &icccm.Hints{
			Flags:        icccm.HintInput | icccm.HintState,
			Input:        1,
			InitialState: icccm.StateNormal,
		}
	}

	c.nhints, err = icccm.WmNormalHintsGet(wm.X, c.Id())
	if err != nil {
		logger.Warning.Println(err)
		logger.Message.Printf("Using reasonable defaults for WM_NORMAL_HINTS "+
			"for %X", c.Id())
		c.nhints = &icccm.NormalHints{}
	}

	c.protocols, err = icccm.WmProtocolsGet(wm.X, c.Id())
	if err != nil {
		logger.Warning.Printf(
			"Window %X does not have WM_PROTOCOLS set.", c.Id())
	}

	c.winTypes, err = ewmh.WmWindowTypeGet(wm.X, c.Id())
	if err != nil {
		logger.Warning.Printf("Could not find window type for window %X, "+
			"using 'normal'.", c.Id())
		c.winTypes = []string{"_NET_WM_WINDOW_TYPE_NORMAL"}
	}

	c.winStates, err = ewmh.WmStateGet(wm.X, c.Id())
	if err != nil {
		c.winStates = []string{}
		ewmh.WmStateSet(wm.X, c.Id(), c.winStates)
	}

	c.class, err = icccm.WmClassGet(wm.X, c.Id())
	if err != nil {
		logger.Warning.Printf("Could not find window class for window %X: %s",
			c.Id(), err)
		c.class = &icccm.WmClass{
			Instance: "",
			Class:    "",
		}
	}

	trans, _ := icccm.WmTransientForGet(wm.X, c.Id())
	if trans == 0 {
		for _, c2_ := range wm.Clients {
			c2 := c2_.(*Client)
			if c2.transient(c) {
				c.transientFor = c2
				break
			}
		}
	} else if transCli := wm.FindManagedClient(trans); transCli != nil {
		c.transientFor = transCli.(*Client)
	}

	c.setShaped()
}