hypridle: don't lock/dpms/suspend while MPRIS media is playing
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
ee630bac30
commit
c7b3f8a306
1 changed files with 31 additions and 24 deletions
|
|
@ -378,7 +378,13 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
services.hypridle = lib.mkIf isMacbook {
|
services.hypridle = lib.mkIf isMacbook (
|
||||||
|
let
|
||||||
|
# Skip the action if any MPRIS player is playing — covers windowed
|
||||||
|
# video (Jellyfin in a browser, mpv, …) that the fullscreen
|
||||||
|
# idle_inhibit rule misses. Browsers expose MPRIS via playerctl.
|
||||||
|
unlessPlaying = cmd: "playerctl -a status 2>/dev/null | grep -q Playing || ${cmd}";
|
||||||
|
in {
|
||||||
enable = true;
|
enable = true;
|
||||||
settings = {
|
settings = {
|
||||||
general = {
|
general = {
|
||||||
|
|
@ -389,20 +395,21 @@ in
|
||||||
listener = [
|
listener = [
|
||||||
{
|
{
|
||||||
timeout = 300; # 5 min — lock
|
timeout = 300; # 5 min — lock
|
||||||
on-timeout = "loginctl lock-session";
|
on-timeout = unlessPlaying "loginctl lock-session";
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
timeout = 420; # 7 min — display off
|
timeout = 420; # 7 min — display off
|
||||||
on-timeout = "hyprctl dispatch dpms off";
|
on-timeout = unlessPlaying "hyprctl dispatch dpms off";
|
||||||
on-resume = "hyprctl dispatch dpms on";
|
on-resume = "hyprctl dispatch dpms on";
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
timeout = 600; # 10 min — suspend
|
timeout = 600; # 10 min — suspend
|
||||||
on-timeout = "systemctl suspend";
|
on-timeout = unlessPlaying "systemctl suspend";
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
}
|
||||||
|
);
|
||||||
|
|
||||||
# Scope all HM Wayland services (hyprpaper, etc.) to the
|
# Scope all HM Wayland services (hyprpaper, etc.) to the
|
||||||
# Hyprland session so they don't crash-loop in a GNOME session.
|
# Hyprland session so they don't crash-loop in a GNOME session.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue