73 lines
1.2 KiB
Go
73 lines
1.2 KiB
Go
package domains
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"tuxpa.in/t/wm/src/bsp"
|
|
"tuxpa.in/t/wm/src/copies"
|
|
"tuxpa.in/t/wm/src/sock"
|
|
)
|
|
|
|
type inject struct {
|
|
xwm
|
|
}
|
|
type desktop_sel struct {
|
|
desktopsel string
|
|
}
|
|
|
|
func (n *desktop_sel) readDesktopSel(msg *sock.Msg) error {
|
|
if !msg.HasNext() {
|
|
return &copies.ErrMissingArguments{}
|
|
}
|
|
str := msg.Next()
|
|
switch str {
|
|
case "any", "first_ancestor",
|
|
"last", "newest", "older", "newer",
|
|
"focused", "pointed", "biggest", "smallest":
|
|
n.desktopsel = str
|
|
}
|
|
return nil
|
|
}
|
|
|
|
type node_sel struct {
|
|
nodesel string
|
|
}
|
|
|
|
func (n *node_sel) readNodeSel(msg *sock.Msg) error {
|
|
if !msg.HasNext() {
|
|
return &copies.ErrMissingArguments{}
|
|
}
|
|
str := msg.Next()
|
|
switch str {
|
|
case "any", "first_ancestor",
|
|
"last", "newest", "older", "newer",
|
|
"focused", "pointed", "biggest", "smallest":
|
|
n.nodesel = str
|
|
}
|
|
return nil
|
|
}
|
|
|
|
type cmd struct {
|
|
Command string
|
|
}
|
|
|
|
func (c *cmd) SetCommand(x string) {
|
|
c.Command = x
|
|
}
|
|
|
|
func (n *cmd) readCommand(msg *sock.Msg, c string) (bool, error) {
|
|
if n.Command == "" {
|
|
n.Command = c
|
|
return msg.HasNext(), nil
|
|
}
|
|
return false, fmt.Errorf("multiple commands given")
|
|
}
|
|
|
|
type xwm struct {
|
|
XWM *bsp.XWM
|
|
}
|
|
|
|
func (x *xwm) SetXWM(z *bsp.XWM) {
|
|
x.XWM = z
|
|
}
|