aboutsummaryrefslogtreecommitdiffstats
path: root/modules/desktop/hyprland
diff options
context:
space:
mode:
Diffstat (limited to 'modules/desktop/hyprland')
-rw-r--r--modules/desktop/hyprland/default.nix184
-rw-r--r--modules/desktop/hyprland/hyprpaper.nix25
-rw-r--r--modules/desktop/hyprland/keybindings.nix153
3 files changed, 0 insertions, 362 deletions
diff --git a/modules/desktop/hyprland/default.nix b/modules/desktop/hyprland/default.nix
deleted file mode 100644
index 749fb87..0000000
--- a/modules/desktop/hyprland/default.nix
+++ /dev/null
@@ -1,184 +0,0 @@
-{
- config,
- lib,
- pkgs,
- ...
-}:
-let
- toHyprColor = hex: "rgba(${lib.removePrefix "#" hex}ff)";
-in
-{
- imports = [
- ./hyprpaper.nix
- ./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/gpu-amd";
- description = "Path to primary DRM card device for Aquamarine/Hyprland rendering";
- };
-
- secondaryCard = lib.mkOption {
- type = lib.types.nullOr lib.types.str;
- default = "/dev/dri/gpu-nvidia";
- 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";
- GDK_SCALE = "1";
- QT_SCALE_FACTOR = "1";
- GTK_THEME = "Adwaita:dark"; # Keeping for any that still use gtk
-
- 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";
- xwayland.enable = true;
- systemd.enable = true;
-
- extraConfig = ''
- ${lib.concatStringsSep "\n" (
- lib.mapAttrsToList (
- name: value:
- let
- escapedValue = lib.escape [ "\"" "\\" ] (toString value);
- in
- ''hl.env("${name}", "${escapedValue}")''
- ) config.home.sessionVariables
- )}
- '';
-
- settings = {
- monitor = [
- {
- output = "";
- mode = "preferred";
- position = "auto";
- scale = 1;
- }
- ];
- mainMod = {
- _var = "SUPER";
- };
-
- config = {
- general = with config.scheme.withHashtag; {
- gaps_in = 5;
- gaps_out = 10;
- border_size = 1;
- col = {
- active_border = {
- colors = [ (toHyprColor base07) ];
- angle = 45;
- };
- inactive_border = toHyprColor base03;
- };
- layout = "scrolling";
- };
-
- xwayland = {
- force_zero_scaling = true;
- };
-
- scrolling = {
- column_width = 1;
- explicit_column_widths = "0.5, 1.0";
- focus_fit_method = 1;
- follow_focus = true;
- };
-
- 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 = {
- follow_mouse = 1;
- kb_layout = "us";
- sensitivity = 0.5;
- touchpad = {
- natural_scroll = true;
- clickfinger_behavior = true;
- disable_while_typing = true;
- tap_to_click = true;
- tap_and_drag = false;
- drag_lock = 2;
- drag_3fg = 1;
- };
- };
-
- cursor = {
- enable_hyprcursor = true;
- no_hardware_cursors = config.desktop.hardware.gpu.nvidia.enable;
- };
-
- dwindle = {
- preserve_split = true;
- };
- };
- };
- };
-
- home.pointerCursor = {
- enable = true;
- package = pkgs.rose-pine-hyprcursor;
- name = "rose-pine-hyprcursor";
- size = 20;
- hyprcursor.enable = true;
- gtk.enable = false;
- x11.enable = false;
- };
- };
-}
diff --git a/modules/desktop/hyprland/hyprpaper.nix b/modules/desktop/hyprland/hyprpaper.nix
deleted file mode 100644
index 5b8eab3..0000000
--- a/modules/desktop/hyprland/hyprpaper.nix
+++ /dev/null
@@ -1,25 +0,0 @@
-{
- config,
- lib,
- pkgs,
- ...
-}:
-{
- config = lib.mkIf config.desktop.enable {
- services.hyprpaper = {
- enable = true;
- package = pkgs.hyprpaper;
- settings = {
- ipc = "on";
- splash = false;
- preload = [ "${../../../assets/sapling.png}" ];
- wallpaper = [
- {
- monitor = "";
- path = "${../../../assets/sapling.png}";
- }
- ];
- };
- };
- };
-}
diff --git a/modules/desktop/hyprland/keybindings.nix b/modules/desktop/hyprland/keybindings.nix
deleted file mode 100644
index c048153..0000000
--- a/modules/desktop/hyprland/keybindings.nix
+++ /dev/null
@@ -1,153 +0,0 @@
-{
- config,
- lib,
- ...
-}:
-let
- lua = lib.generators.mkLuaInline;
-
- bind = key: dispatcher: {
- _args = [
- (lua "mainMod .. \" + ${key}\"")
- (lua dispatcher)
- ];
- };
-
- bindRawFlags = key: dispatcher: flags: {
- _args = [
- key
- (lua dispatcher)
- flags
- ];
- };
-
- bindMouse = key: dispatcher: {
- _args = [
- (lua "mainMod .. \" + ${key}\"")
- (lua dispatcher)
- { mouse = true; }
- ];
- };
-
- execLua = cmd: "hl.dsp.exec_cmd(\"${cmd}\")";
-
- execLuaSingle = cmd: "hl.dsp.exec_cmd('${cmd}')";
-in
-{
- config.wayland.windowManager.hyprland.settings.bind = lib.flatten [
- (bindMouse "mouse:272" "hl.dsp.window.drag()") # mainMod + LMB drag: move
- (bindMouse "mouse:273" "hl.dsp.window.resize()") # mainMod + RMB drag: resize
-
- (lib.optionals config.desktop.enable [
- (bind "R" (execLua "${lib.getExe config.desktop.rofi.package} -show drun"))
- ])
- (lib.optionals config.terminal.kitty.enable [
- (bind "Return" (execLua "${lib.getExe config.terminal.kitty.package}"))
- ])
- (lib.optionals (config.terminal.kitty.enable && config.file-management.yazi.enable) [
- (bind "F" (
- execLua "${lib.getExe config.terminal.kitty.package} --class yazi --title 'Yazi' -e ${lib.getExe config.file-management.yazi.package}"
- ))
- ])
- (bind "SHIFT + Q" "hl.dsp.window.close()")
- (bind "Equal" "hl.dsp.layout(\"colresize +conf\")")
-
- (lib.optionals config.system.brightnessctl.enable [
- (bindRawFlags "XF86MonBrightnessDown"
- (execLuaSingle "${lib.getExe config.system.brightnessctl.package} set 5%-")
- {
- locked = true;
- repeating = true;
- }
- )
- (bindRawFlags "XF86MonBrightnessUp"
- (execLuaSingle "${lib.getExe config.system.brightnessctl.package} set +5%")
- {
- locked = true;
- repeating = true;
- }
- )
- ])
- (lib.optionals config.media.pamixer.enable [
- (bindRawFlags "XF86AudioLowerVolume"
- (execLuaSingle "${lib.getExe config.media.pamixer.package} --decrease 5")
- {
- locked = true;
- repeating = true;
- }
- )
- (bindRawFlags "XF86AudioRaiseVolume"
- (execLuaSingle "${lib.getExe config.media.pamixer.package} --increase 5")
- {
- locked = true;
- repeating = true;
- }
- )
- (bindRawFlags "XF86AudioMute"
- (execLuaSingle "${lib.getExe config.media.pamixer.package} --toggle-mute")
- {
- locked = true;
- repeating = true;
- }
- )
- ])
- (lib.optionals config.media.playerctl.enable [
- (bindRawFlags "XF86AudioPlay"
- (execLuaSingle "${lib.getExe config.media.playerctl.package} play-pause")
- {
- locked = true;
- repeating = true;
- }
- )
- ])
-
- (bind "H" "hl.dsp.focus({ direction = \"l\" })")
- (bind "J" "hl.dsp.focus({ direction = \"d\" })")
- (bind "K" "hl.dsp.focus({ direction = \"u\" })")
- (bind "L" "hl.dsp.focus({ direction = \"r\" })")
-
- (bind "SHIFT + H" "hl.dsp.window.move({ direction = \"l\" })")
- (bind "SHIFT + J" "hl.dsp.window.move({ direction = \"d\" })")
- (bind "SHIFT + K" "hl.dsp.window.move({ direction = \"u\" })")
- (bind "SHIFT + L" "hl.dsp.window.move({ direction = \"r\" })")
-
- (bind "CTRL + H" "hl.dsp.window.resize({ x = -20, y = 0 })")
- (bind "CTRL + J" "hl.dsp.window.resize({ x = 0, y = 20 })")
- (bind "CTRL + K" "hl.dsp.window.resize({ x = 0, y = -20 })")
- (bind "CTRL + L" "hl.dsp.window.resize({ x = 20, y = 0 })")
-
- (bind "D" "hl.dsp.window.float({ action = \"toggle\" })")
- (bind "M" "hl.dsp.window.fullscreen()")
-
- (bind "1" "hl.dsp.focus({ workspace = 1 })")
- (bind "2" "hl.dsp.focus({ workspace = 2 })")
- (bind "3" "hl.dsp.focus({ workspace = 3 })")
- (bind "4" "hl.dsp.focus({ workspace = 4 })")
- (bind "5" "hl.dsp.focus({ workspace = 5 })")
- (bind "6" "hl.dsp.focus({ workspace = 6 })")
- (bind "7" "hl.dsp.focus({ workspace = 7 })")
- (bind "8" "hl.dsp.focus({ workspace = 8 })")
- (bind "9" "hl.dsp.focus({ workspace = 9 })")
- (bind "0" "hl.dsp.focus({ workspace = 10 })")
-
- (bind "SHIFT + 1" "hl.dsp.window.move({ workspace = 1 })")
- (bind "SHIFT + 2" "hl.dsp.window.move({ workspace = 2 })")
- (bind "SHIFT + 3" "hl.dsp.window.move({ workspace = 3 })")
- (bind "SHIFT + 4" "hl.dsp.window.move({ workspace = 4 })")
- (bind "SHIFT + 5" "hl.dsp.window.move({ workspace = 5 })")
- (bind "SHIFT + 6" "hl.dsp.window.move({ workspace = 6 })")
- (bind "SHIFT + 7" "hl.dsp.window.move({ workspace = 7 })")
- (bind "SHIFT + 8" "hl.dsp.window.move({ workspace = 8 })")
- (bind "SHIFT + 9" "hl.dsp.window.move({ workspace = 9 })")
- (bind "SHIFT + 0" "hl.dsp.window.move({ workspace = 10 })")
-
- (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})\" - | ${lib.getExe' config.desktop.wl-clipboard.package "wl-copy"}"
- ))
- (bind "SHIFT + P" (
- execLuaSingle "mkdir -p ~/Pictures/Screenshots && ${lib.getExe config.media.grim.package} -g \"$(${lib.getExe config.media.slurp.package})\" ~/Pictures/Screenshots/screenshot-$(date +%Y%m%d-%H%M%S).png"
- ))
- ])
- ];
-}