Skip to content

Commit 442c50f

Browse files
committed
feat(hyprland): make gamemode VRR toggle opt-in per host
The gamemode start/end hooks hardcoded a misc:vrr keyword directly in the shared hyprland module, with no way for a host to opt out. Any future host enabling Hyprland + gamemode would inherit VRR toggling regardless of whether its displays support VRR. Add khanelinix.programs.graphical.wms.hyprland.gamemode.vrr.enable and only emit the misc:vrr hyprctl keyword when it's set. Also fixes the existing behavior where the start-hook forced VRR off during gameplay (misc:vrr 0) while the end-hook only turned it back on (misc:vrr 2) on exit — both hooks now use the same value when the option is enabled. Enabled on khanelinix, whose Odyssey G9 (DP-1) supports VRR.
1 parent da8fd0b commit 442c50f

2 files changed

Lines changed: 29 additions & 21 deletions

File tree

modules/nixos/programs/graphical/wms/hyprland/default.nix

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ in
4040
"Custom configuration files that can be used to override the default files.";
4141
customFiles = mkOpt attrs { } "Custom files that can be used to override the default files.";
4242
wallpaper = mkOpt (nullOr package) null "The wallpaper to display.";
43+
gamemode.vrr.enable = lib.mkEnableOption "toggling Hyprland VRR mode during gamemode (only for VRR-capable displays)";
4344
};
4445

4546
config = mkIf cfg.enable {
@@ -106,16 +107,18 @@ in
106107
echo "=== Gamemode Start: $(date) ===" > "$LOG_FILE"
107108
108109
hyprctl --batch '${
109-
lib.concatStringsSep " " [
110-
"keyword animations:enabled 0;"
111-
"keyword decoration:shadow:enabled 0;"
112-
"keyword decoration:blur:enabled 0;"
113-
"keyword decoration:active_opacity 1.0;"
114-
"keyword decoration:inactive_opacity 1.0;"
115-
"keyword decoration:fullscreen_opacity 1.0;"
116-
"keyword debug:vfr 0;"
117-
"keyword misc:vrr 0"
118-
]
110+
lib.concatStringsSep " " (
111+
[
112+
"keyword animations:enabled 0;"
113+
"keyword decoration:shadow:enabled 0;"
114+
"keyword decoration:blur:enabled 0;"
115+
"keyword decoration:active_opacity 1.0;"
116+
"keyword decoration:inactive_opacity 1.0;"
117+
"keyword decoration:fullscreen_opacity 1.0;"
118+
"keyword debug:vfr 0;"
119+
]
120+
++ lib.optional cfg.gamemode.vrr.enable "keyword misc:vrr 2"
121+
)
119122
}'
120123
121124
echo "Setting kitty opacity to 1.0..." >> "$LOG_FILE"
@@ -157,16 +160,18 @@ in
157160
echo "=== Gamemode End: $(date) ===" > "$LOG_FILE"
158161
159162
hyprctl --batch '${
160-
lib.concatStringsSep " " [
161-
"keyword animations:enabled 1;"
162-
"keyword decoration:shadow:enabled 1;"
163-
"keyword decoration:blur:enabled 1;"
164-
"keyword decoration:active_opacity 0.95;"
165-
"keyword decoration:inactive_opacity 0.9;"
166-
"keyword decoration:fullscreen_opacity 1.0;"
167-
"keyword debug:vfr 1;"
168-
"keyword misc:vrr 2"
169-
]
163+
lib.concatStringsSep " " (
164+
[
165+
"keyword animations:enabled 1;"
166+
"keyword decoration:shadow:enabled 1;"
167+
"keyword decoration:blur:enabled 1;"
168+
"keyword decoration:active_opacity 0.95;"
169+
"keyword decoration:inactive_opacity 0.9;"
170+
"keyword decoration:fullscreen_opacity 1.0;"
171+
"keyword debug:vfr 1;"
172+
]
173+
++ lib.optional cfg.gamemode.vrr.enable "keyword misc:vrr 2"
174+
)
170175
}'
171176
172177
echo "Restoring kitty opacity to 0.90..." >> "$LOG_FILE"

systems/x86_64-linux/khanelinix/default.nix

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,10 @@ in
5656

5757
wms = mkMerge [
5858
{
59-
hyprland.enable = true;
59+
hyprland = {
60+
enable = true;
61+
gamemode.vrr.enable = true; # Odyssey G9 (DP-1) supports VRR
62+
};
6063
niri = {
6164
enable = true;
6265
package = pkgs.niri-unstable;

0 commit comments

Comments
 (0)