mirror of
https://codeberg.org/scip/swaycycle.git
synced 2025-12-16 20:11:02 +01:00
fixed switching, stay on current workspace
This commit is contained in:
11
main.go
11
main.go
@@ -56,9 +56,11 @@ var Visibles = []Node{}
|
|||||||
var CurrentWorkspace = ""
|
var CurrentWorkspace = ""
|
||||||
var Debug = false
|
var Debug = false
|
||||||
var Version = false
|
var Version = false
|
||||||
|
var Notswitch = false
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
flag.BoolVarP(&Debug, "debug", "d", false, "enable debugging")
|
flag.BoolVarP(&Debug, "debug", "d", false, "enable debugging")
|
||||||
|
flag.BoolVarP(&Notswitch, "no-switch", "n", false, "do not switch windows")
|
||||||
flag.BoolVarP(&Version, "version", "v", false, "show program version")
|
flag.BoolVarP(&Version, "version", "v", false, "show program version")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
@@ -76,7 +78,7 @@ func main() {
|
|||||||
|
|
||||||
id := findNextWindow()
|
id := findNextWindow()
|
||||||
|
|
||||||
if id > 0 {
|
if id > 0 && !Notswitch {
|
||||||
switchFocus(id)
|
switchFocus(id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -199,6 +201,7 @@ func processJSON(jsoncode []byte) error {
|
|||||||
// this is an output node containing the current workspace
|
// this is an output node containing the current workspace
|
||||||
CurrentWorkspace = node.Current_workspace
|
CurrentWorkspace = node.Current_workspace
|
||||||
recurseNodes(node.Nodes)
|
recurseNodes(node.Nodes)
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -220,11 +223,15 @@ func recurseNodes(nodes []Node) {
|
|||||||
recurseNodes(node.Nodes)
|
recurseNodes(node.Nodes)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ignore other workspaces
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
// the first nodes seen are workspaces, so if we see a con
|
// the first nodes seen are workspaces, so if we see a con
|
||||||
// node, we are already inside the current workspace
|
// node, we are already inside the current workspace
|
||||||
if (istype(node, con) || istype(node, floating)) && (node.Window > 0 || node.X11Window != "") {
|
if (istype(node, con) || istype(node, floating)) &&
|
||||||
|
(node.Window > 0 || node.X11Window != "") {
|
||||||
Visibles = append(Visibles, node)
|
Visibles = append(Visibles, node)
|
||||||
} else {
|
} else {
|
||||||
recurseNodes(node.Nodes)
|
recurseNodes(node.Nodes)
|
||||||
|
|||||||
Reference in New Issue
Block a user