Files
nixos/scripts/WMScripts/murder.sh
2026-10-06 22:34:05 +02:00

29 lines
652 B
Bash
Executable File

#!/usr/bin/env bash
# This script allows the user to select a window
# then nicely asks it to shut down (SIGTERM).
# if the window does not shut down, it is murdered instead (SIGKILL)
case "$XDG_CURRENT_DESKTOP" in
"Hyprland")
id=$(hyprprop | jq '.pid')
;;
"sway")
id=$(wlprop | jq '.pid')
;;
"i3")
id=$(xprop _NET_WM_PID | awk '{print $3}')
;;
*)
dunstify -u low -t 2000 -i ~/.icons/candy-icons/apps/scalable/clamav.svg "This session type is not supported by murder.sh"
exit
esac
[[ ! "$id" =~ [0-9]+ ]] && exit
kill "$id"
sleep 2
if [[ $(ps -p "$id" 2>&1 > /dev/null) -ne 0 ]]; then
kill -s 9 "$id"
fi