Hi, In sway I create workspaces named by my projects. My project names can be filtered using a regex (they all start with 5 numbers followed by a dash). I wrote a bash script which handles this, but as swayr is adding functionalities, this could be a nice addition ;)
You could add this as a --filter
option to switch-workspace
Also, this might be nice to add to switch-window
too.
this is the script (unfinished) that I use... example project names:
- 25126-Sambre
- 40687-Mol
- 39047-Lampen
#!/usr/bin/bash # Get regular workspaces workspaces=$(swaymsg -t get_tree | jq -c '.nodes[].nodes[] | select(.type | . and contains("workspace")) | select(.name | . and contains("__i3") | not) | .name? ' | grep -E '[[:digit:]]{5}-.*' | tr -d '"' ) # Select window with rofi selected=$(echo "$workspaces" | wofi --show dmenu -i --sort-order=alphabetical | awk '{print $1}') # TODO: check if the selected workspace is the current one. then don't switch ! # TODO: if nothing selected -> cancel # Tell sway to focus said workspace # swaymsg [workspace="$selected"] focus swaymsg workspace "$selected"
That should be doable but will need some time to be implemented. I'm currently working on another feature (a new binary
swayrbar
usable asstatus_command
for swaybar) on a separate branch where I've done some major refactoring which would make merging non-trivial changes frommain
a nightmare.But I just want to let you know that I think the feature is sensible and an optional option for the various switch commands wouldn't hurt/be incompatible with what's already there.
Thanks!