wm/src/handler/domains/common.go

73 lines
1.2 KiB
Go
Raw Normal View History

2023-06-11 10:24:15 +00:00
package domains
2023-06-11 14:11:36 +00:00
import (
"fmt"
"tuxpa.in/t/wm/src/bsp"
"tuxpa.in/t/wm/src/copies"
"tuxpa.in/t/wm/src/sock"
)
2023-06-11 10:24:15 +00:00
type inject struct {
xwm
}
2023-06-11 14:11:36 +00:00
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")
}
2023-06-11 10:24:15 +00:00
type xwm struct {
XWM *bsp.XWM
}
2023-06-11 14:11:36 +00:00
func (x *xwm) SetXWM(z *bsp.XWM) {
2023-06-11 10:24:15 +00:00
x.XWM = z
}