Skip to content

Instantly share code, notes, and snippets.

@Vermaak5
Vermaak5 / kill
Created September 27, 2019 09:19
killwindow
#!/bin/bash
# add to sway config:
# bindsym Mod1+q exec ~/kill.sh
# this script kills the window UNLESS the name matches. If the name matches the SIGTERM signal is send to the target process
# 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 .)
#!/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 .)