mirror of
https://codeberg.org/scip/swayipc.git
synced 2026-10-08 11:14:25 +02:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6f4a4a6995 | |||
| d64f84c887 | |||
| 9e558e1f3c | |||
| f95d156509 | |||
| a718a31249 |
@@ -1,7 +1,7 @@
|
||||
[](https://ci.codeberg.org/repos/15565)
|
||||
[](https://goreportcard.com/report/codeberg.org/scip/swayipc)
|
||||
[](https://codeberg.org/scip/swayipc/raw/branch/main/LICENSE)
|
||||
[](https://godoc.org/codeberg.org/scip/swayipc/v2)
|
||||
[](https://godoc.org/codeberg.org/scip/swayipc)
|
||||
|
||||
# swayipc - go bindings to control sway and swayfx
|
||||
|
||||
@@ -26,7 +26,7 @@ haven't tested it on i3wm.
|
||||
The module uses the i3-IPC proctocol as outlined in sway-ipc(7).
|
||||
|
||||
For details on how to use the library, see the
|
||||
[reference documentation](https://godoc.org/codeberg.org/scip/swayipc/v2).
|
||||
[reference documentation](https://godoc.org/codeberg.org/scip/swayipc).
|
||||
|
||||
## Example usage
|
||||
|
||||
|
||||
2
go.mod
2
go.mod
@@ -1,3 +1,5 @@
|
||||
module codeberg.org/scip/swayipc/v2
|
||||
|
||||
go 1.26
|
||||
|
||||
require github.com/alecthomas/repr v0.5.1 // indirect
|
||||
|
||||
30
node.go
30
node.go
@@ -6,11 +6,11 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
NodeTypeRoot = "root"
|
||||
NodeTypeOutput = "output"
|
||||
NodeTypeWorkspace = "workspace"
|
||||
NodeTypeCon = "con"
|
||||
NodeTypeFloating = "floating_con"
|
||||
NodeTypeRoot = iota + 1 // A root node
|
||||
NodeTypeOutput // An output node
|
||||
NodeTypeWorkspace // A workspace
|
||||
NodeTypeCon // A container node (containing more nodes)
|
||||
NodeTypeFloating // A floating node
|
||||
)
|
||||
|
||||
// Node can be an output, a workspace, a container or a container
|
||||
@@ -86,26 +86,6 @@ func (node *Node) FindCurrentWorkspace() string {
|
||||
return searchCurrentWorkspace(node.Nodes)
|
||||
}
|
||||
|
||||
func (node *Node) IsRoot() bool {
|
||||
return node.Type == NodeTypeRoot
|
||||
}
|
||||
|
||||
func (node *Node) IsOutput() bool {
|
||||
return node.Type == NodeTypeOutput
|
||||
}
|
||||
|
||||
func (node *Node) IsWorkspace() bool {
|
||||
return node.Type == NodeTypeWorkspace
|
||||
}
|
||||
|
||||
func (node *Node) IsContainer() bool {
|
||||
return node.Type == NodeTypeCon
|
||||
}
|
||||
|
||||
func (node *Node) IsFloating() bool {
|
||||
return node.Type == NodeTypeFloating
|
||||
}
|
||||
|
||||
// searchCurrentWorkspace search for current workspace
|
||||
func searchCurrentWorkspace(nodes []*Node) string {
|
||||
for _, node := range nodes {
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
VERSION = "v2.1.2"
|
||||
VERSION = "v2.1.0"
|
||||
|
||||
IpcHeaderSize = 14
|
||||
IpcMagix = "i3-ipc"
|
||||
|
||||
Reference in New Issue
Block a user