Skip to content

Instantly share code, notes, and snippets.

@mguentner
Created October 25, 2018 12:33
Show Gist options
  • Save mguentner/3142a6eba5e0f6fb4b3479103cfb5a7f to your computer and use it in GitHub Desktop.
Save mguentner/3142a6eba5e0f6fb4b3479103cfb5a7f to your computer and use it in GitHub Desktop.
a script that kills either tmux or the respective focused window. For use with i3 or other window managers
bindsym --release $mod+q exec --no-startup-id /home/anon/bin/kill.sh
#!/usr/bin/env bash
ID=$(xprop -root | awk '/_NET_ACTIVE_WINDOW\(WINDOW\)/{print $NF}')
CLASS=$(xprop -id $ID | grep WM_CLASS | cut -d= -f 2 | cut -d\" -f 2)
PID=$(xprop -id $ID | grep WM_PID | cut -d= -f 2)
if [[ "$CLASS" == "Alacritty"* ]]; then
IDINT=$(printf "%d" "$ID")
xdotool key --window $IDINT --clearmodifiers "ctrl+b" type --clearmodifiers --window $IDINT "&y"
else
kill $PID
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment