Created
October 16, 2024 05:21
-
-
Save iguanajuice/a4a795eb7362bb00035552d9e57c988e to your computer and use it in GitHub Desktop.
Use fuzzel to focus windows in sway's scratchpad
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
pkill fuzzel && exit | |
TREE=`swaymsg -t get_tree | jq -r '.nodes[].nodes[]'` | |
SCRATCHPAD=`echo $TREE | jq -r 'select(.name=="__i3_scratch") | .focus[]'` | |
if [ `echo $SCRATCHPAD | wc -w` -lt 2 ] | |
then | |
swaymsg "scratchpad show" | |
exit | |
fi | |
for i in $SCRATCHPAD | |
do | |
LIST=$LIST"[$i] "`echo $TREE | jq -r '.floating_nodes[] | select(.id=='$i') | .name'`"\n" | |
done | |
CONID=`printf "$LIST" | fuzzel -dw150 | awk '{print $1}' | tr [] \ ` | |
swaymsg "[con_id=$CONID] scratchpad show" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment