2021-11-28 16:19:50 +01:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
swaymsg -t get_tree | jq -r '
|
|
|
|
# descend to workspace or scratchpad
|
2021-11-28 16:27:03 +01:00
|
|
|
.nodes[].nodes[].nodes[]
|
2021-11-28 16:19:50 +01:00
|
|
|
# save workspace name as .w
|
|
|
|
| {"w": .name} + (
|
|
|
|
if .nodes then # workspace
|
|
|
|
[recurse(.nodes[])]
|
|
|
|
else # scratchpad
|
|
|
|
[]
|
|
|
|
end
|
|
|
|
+ .floating_nodes
|
|
|
|
| .[]
|
|
|
|
# select nodes with no children (windows)
|
|
|
|
| select(.nodes==[])
|
|
|
|
)
|
|
|
|
| ((.id | tostring) + "\t "
|
|
|
|
# remove markup and index from workspace name, replace scratch with "[S]"
|
|
|
|
+ (.w | gsub("^[^:]*:|<[^>]*>"; "") | sub("__i3_scratch"; "[S]"))
|
|
|
|
+ "\t " + .name)
|
2021-11-28 16:27:03 +01:00
|
|
|
' | wofi --show dmenu| {
|
2021-11-28 16:19:50 +01:00
|
|
|
read -r id name
|
|
|
|
swaymsg "[con_id=$id]" focus
|
|
|
|
}
|