Skip to content

Instantly share code, notes, and snippets.

@Vermaak5
Last active September 26, 2019 19:38
Show Gist options
  • Save Vermaak5/dda22cb1250bb4a08d66ed1910f1ae41 to your computer and use it in GitHub Desktop.
Save Vermaak5/dda22cb1250bb4a08d66ed1910f1ae41 to your computer and use it in GitHub Desktop.
kill.sh
#!/bin/bash
# add to sway config:
# bindsym Mod1+q exec ~/kill.sh
# this script kills the window if the name matches
# in case of wayland, the attribute 'app_id' is used while X11 windows use 'class'
current_window=$(swaymsg -t get_tree | grep -A 45 '"focused": true' | egrep 'app_id|class' | cut -d \" -f 4 | grep .)
if [[ "$current_window" =~ ^(termite|XTerm)$ ]]; then
swaymsg kill
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment