1
0
Fork 1
mirror of https://github.com/Zerodya/hyprfreeze.git synced 2024-11-10 01:18:49 +01:00

feat: sway support for -a

This commit is contained in:
alterNERDtive 2024-02-12 12:19:58 +01:00
parent 6607c0c568
commit 38da7492ba
Signed by: alterNERDtive
GPG key ID: 547787A4FE6533F1

View file

@ -56,7 +56,14 @@ function toggleFreeze() {
function getPidByActive() {
debugPrint "Getting PID by active window..."
if [[ "hyprland" == "$DESKTOP" ]]; then
PID=$(hyprctl activewindow -j | jq '.pid')
elif [[ "sway" == "$DESKTOP" ]]; then
PID=$(swaymsg -t get_tree | jq '.. | select(.type?) | select(.focused==true) | .pid')
else
echo "Detecting the active window is currently not supported on $DESKTOP."
exit 1
fi
debugPrint "PID by active window: $PID"
# Die if PID is not numeric (e.g. "null" if there is no active window)