Skip to content

Instantly share code, notes, and snippets.

@iguanajuice
iguanajuice / scratchpad.sh
Created October 16, 2024 05:21
Use fuzzel to focus windows in sway's scratchpad
#!/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"
@iguanajuice
iguanajuice / swaywait.sh
Created August 14, 2024 17:34
Run a sway command when a window appears; like `for_window` but temporary.
#!/bin/sh
if [ $# -ne 2 ]
then
echo "Usage: swaywait [target] [command]"
exit 1
fi
TARGET=$1
COMMAND=$2