nix/pkgs/hyprland-system76-scheduler-hook.sh
2023-04-19 16:41:56 +10:00

13 lines
No EOL
413 B
Bash
Executable file

#!/usr/bin/env bash
socat - UNIX-CONNECT:/tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock |
while read line
do
if [[ "$line" == activewindow* ]]; then
pid="$(hyprctl activewindow | rg pid | cut -d' ' -f2)"
if [[ -n $pid ]]; then
dbus-send --system --dest=com.system76.Scheduler --type=method_call /com/system76/Scheduler com.system76.Scheduler.SetForegroundProcess uint32:$pid
fi
pid=""
fi
done