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
Last active January 26, 2025 07:11
Run a sway command when a window appears. Like `for_window` but temporary.
#!/bin/sh
if [ $# -ne 2 ]
then
echo "Usage: swaywait [app_id/class] [sway_command]"
exit 1
fi
TARGET=$1
COMMAND=$2