mirror of
https://codeberg.org/scip/swaycycle.git
synced 2025-12-16 20:11:02 +01:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0cad8cbb62 | |||
| 17fbc4f6a2 | |||
| 852b5c2de9 |
43
README.md
43
README.md
@@ -1,2 +1,45 @@
|
||||
# swaycycle
|
||||
|
||||
Cycle through all visible windows on a sway[fx] workspace
|
||||
|
||||
## Installation
|
||||
|
||||
Checkout the repo and execute `make`. You'll need the go toolkit. Then
|
||||
copy the binary `swaycycle` to some location within your `$PATH`.
|
||||
|
||||
## Configuration
|
||||
|
||||
Add such a line to your sway config file (e.g. in `$HOME/.config/sway/config`):
|
||||
|
||||
```default
|
||||
bindsym $mod+Tab exec ~/bin/swaycycle
|
||||
```
|
||||
|
||||
## Getting help
|
||||
|
||||
Although I'm happy to hear from swaycycle users in private email, that's the
|
||||
best way for me to forget to do something.
|
||||
|
||||
In order to report a bug, unexpected behavior, feature requests or to
|
||||
submit a patch, please open an issue on github:
|
||||
https://github.com/TLINDEN/swaycycle/issues.
|
||||
|
||||
## Copyright and license
|
||||
|
||||
This software is licensed under the GNU GENERAL PUBLIC LICENSE version 3.
|
||||
|
||||
## Authors
|
||||
|
||||
T.v.Dein <tom AT vondein DOT org>
|
||||
|
||||
## Project homepage
|
||||
|
||||
https://github.com/TLINDEN/swaycycle
|
||||
|
||||
## Copyright and License
|
||||
|
||||
Licensed under the GNU GENERAL PUBLIC LICENSE version 3.
|
||||
|
||||
## Author
|
||||
|
||||
T.v.Dein <tom AT vondein DOT org>
|
||||
|
||||
13
main.go
13
main.go
@@ -37,7 +37,7 @@ const (
|
||||
con
|
||||
floating
|
||||
|
||||
VERSION = "v0.1.1"
|
||||
VERSION = "v0.1.2"
|
||||
)
|
||||
|
||||
type Node struct {
|
||||
@@ -56,9 +56,11 @@ var Visibles = []Node{}
|
||||
var CurrentWorkspace = ""
|
||||
var Debug = false
|
||||
var Version = false
|
||||
var Notswitch = false
|
||||
|
||||
func main() {
|
||||
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.Parse()
|
||||
|
||||
@@ -76,7 +78,7 @@ func main() {
|
||||
|
||||
id := findNextWindow()
|
||||
|
||||
if id > 0 {
|
||||
if id > 0 && !Notswitch {
|
||||
switchFocus(id)
|
||||
}
|
||||
}
|
||||
@@ -199,6 +201,7 @@ func processJSON(jsoncode []byte) error {
|
||||
// this is an output node containing the current workspace
|
||||
CurrentWorkspace = node.Current_workspace
|
||||
recurseNodes(node.Nodes)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
@@ -220,11 +223,15 @@ func recurseNodes(nodes []Node) {
|
||||
recurseNodes(node.Nodes)
|
||||
return
|
||||
}
|
||||
|
||||
// ignore other workspaces
|
||||
continue
|
||||
}
|
||||
|
||||
// the first nodes seen are workspaces, so if we see a con
|
||||
// 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)
|
||||
} else {
|
||||
recurseNodes(node.Nodes)
|
||||
|
||||
Reference in New Issue
Block a user