dotfiles/.config/hypr/scripts/KillActiveProcess.sh
2026-05-13 21:22:17 +02:00

21 lines
647 B
Bash
Executable file

#!/usr/bin/env bash
# ==================================================
# KoolDots (2026)
# Project URL: https://github.com/LinuxBeginnings
# License: GNU GPLv3
# SPDX-License-Identifier: GPL-3.0-or-later
# ==================================================
# Copied from Discord post. Thanks to @Zorg
# Get id of an active window
active_pid=$(hyprctl activewindow | grep -o 'pid: [0-9]*' | cut -d' ' -f2)
if [[ -z "$active_pid" || ! "$active_pid" =~ ^[0-9]+$ ]]; then
notify-send -u low -i "$HOME/.config/swaync/images/error.png" "Kill Active Window" "No active window PID found."
exit 1
fi
# Close active window
kill "$active_pid"