From 8c13757c6d6c503774d833507f281eaa499b3bd9 Mon Sep 17 00:00:00 2001 From: Arpit Chakladar Date: Sun, 26 Jul 2026 01:09:12 +0530 Subject: feat: enable hyprland vfr and other optimizations - Enable misc.vfr in hyprland for variable frame rate --- modules/desktop/hyprland/default.nix | 73 +++++++++++++++++++++++++++++--- modules/desktop/hyprland/keybindings.nix | 5 --- 2 files changed, 67 insertions(+), 11 deletions(-) (limited to 'modules/desktop/hyprland') diff --git a/modules/desktop/hyprland/default.nix b/modules/desktop/hyprland/default.nix index 7c5f811..bea5c90 100644 --- a/modules/desktop/hyprland/default.nix +++ b/modules/desktop/hyprland/default.nix @@ -13,7 +13,57 @@ in ./keybindings.nix ]; + options.desktop.hardware.gpu = { + nvidia.enable = lib.mkEnableOption "Nvidia GPU Wayland/Hyprland optimizations"; + + amd.enable = lib.mkEnableOption "AMD GPU Wayland/Hyprland optimizations"; + + primaryCard = lib.mkOption { + type = lib.types.str; + default = "/dev/dri/by-path/pci-0000:05:00.0-card"; + description = "Path to primary DRM card device for Aquamarine/Hyprland rendering"; + }; + + secondaryCard = lib.mkOption { + type = lib.types.nullOr lib.types.str; + default = "/dev/dri/by-path/pci-0000:01:00.0-card"; + description = "Path to secondary DRM card device for offloading (null if single GPU)"; + }; + }; + config = lib.mkIf config.desktop.enable { + + home.sessionVariables = lib.mkMerge [ + { + NIXOS_OZONE_WL = "1"; + QT_QPA_PLATFORM = "wayland;xcb"; + SDL_VIDEODRIVER = "wayland"; + CLUTTER_BACKEND = "wayland"; + + AQ_DRM_DEVICES = + if config.desktop.hardware.gpu.secondaryCard != null then + "${config.desktop.hardware.gpu.primaryCard}:${config.desktop.hardware.gpu.secondaryCard}" + else + config.desktop.hardware.gpu.primaryCard; + } + + (lib.mkIf config.desktop.hardware.gpu.nvidia.enable { + LIBVA_DRIVER_NAME = "nvidia"; + __GLX_VENDOR_LIBRARY_NAME = "nvidia"; + GBM_BACKEND = "nvidia-drm"; + NVD_BACKEND = "direct"; + + AQ_NO_MODIFIERS = "1"; + __GL_YIELD = "USLEEP"; + __GL_VRR_ALLOWED = "0"; + }) + + (lib.mkIf config.desktop.hardware.gpu.amd.enable { + AMD_VULKAN_ICD = "RADV"; + MESA_VK_DEVICE_SELECT = "1002:"; + }) + ]; + wayland.windowManager.hyprland = { enable = true; configType = "lua"; @@ -40,8 +90,24 @@ in layout = "dwindle"; }; + debug = { + vfr = true; + }; + + misc = { + vrr = lib.mkIf config.desktop.hardware.gpu.amd.enable 1; + disable_hyprland_logo = true; + disable_splash_rendering = true; + }; + decoration = { rounding = 0; + blur = { + enabled = false; + }; + shadow = { + enabled = false; + }; }; input = { @@ -51,6 +117,7 @@ in cursor = { enable_hyprcursor = true; + no_hardware_cursors = config.desktop.hardware.gpu.nvidia.enable; }; dwindle = { @@ -87,11 +154,5 @@ in gtk.enable = false; x11.enable = false; }; - - home.packages = with pkgs; [ - grim - slurp - wl-clipboard - ]; }; } diff --git a/modules/desktop/hyprland/keybindings.nix b/modules/desktop/hyprland/keybindings.nix index a72c965..2612088 100644 --- a/modules/desktop/hyprland/keybindings.nix +++ b/modules/desktop/hyprland/keybindings.nix @@ -27,7 +27,6 @@ let in { config.wayland.windowManager.hyprland.settings.bind = lib.flatten [ - # --- General Applications --- (lib.optionals config.desktop.rofi.enable [ (bind "R" (execLua "${lib.getExe config.desktop.rofi.package} -show drun")) ]) @@ -41,7 +40,6 @@ in ]) (bind "Q" "hl.dsp.window.close()") - # --- Media / Hardware Keys --- (lib.optionals config.system.brightnessctl.enable [ (bindRawFlags "XF86MonBrightnessDown" (execLuaSingle "${lib.getExe config.system.brightnessctl.package} set 5%-") @@ -91,7 +89,6 @@ in ) ]) - # --- Window Management (Vim-style) --- (bind "H" "hl.dsp.focus({ direction = \"l\" })") (bind "J" "hl.dsp.focus({ direction = \"d\" })") (bind "K" "hl.dsp.focus({ direction = \"u\" })") @@ -110,7 +107,6 @@ in (bind "D" "hl.dsp.window.float({ action = \"toggle\" })") (bind "M" "hl.dsp.window.fullscreen()") - # --- Workspaces --- (bind "1" "hl.dsp.focus({ workspace = 1 })") (bind "2" "hl.dsp.focus({ workspace = 2 })") (bind "3" "hl.dsp.focus({ workspace = 3 })") @@ -133,7 +129,6 @@ in (bind "SHIFT + 9" "hl.dsp.window.move({ workspace = 9 })") (bind "SHIFT + 0" "hl.dsp.window.move({ workspace = 10 })") - # --- Screenshots --- (lib.optionals (config.media.grim.enable && config.media.slurp.enable) [ (bind "P" ( execLuaSingle "${lib.getExe config.media.grim.package} -g \"$(${lib.getExe config.media.slurp.package})\" - | wl-copy" -- cgit v1.2.3