Dotfiles/rofi/scripts/killwindowbyid/killbyid.sh

18 lines
362 B
Bash
Raw Normal View History

2023-02-03 18:12:16 +00:00
#!/bin/bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
yes=''
no=''
confirm_kill() {
$SCRIPT_DIR/../confirm/confirm.sh "Kill Window?" "$yes" "$no"
}
selected="$(confirm_kill)"
if [[ "$selected" == "$yes" ]]; then
wmctrl -lp | grep -i `echo "obase=16; $1" | bc ` | awk '{print $3}' | xargs kill
else
exit 0
fi