Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 1 | { |
| 2 | pkgs, |
| 3 | config, |
| 4 | inputs, |
| 5 | system, |
| 6 | lib, |
| 7 | ... |
| 8 | }: |
| 9 | let |
Skyler Grey | a0da6b2 | 2024-02-11 22:53:41 +0000 | [diff] [blame] | 10 | lock = "${pkgs.waylock}/bin/waylock"; |
Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 11 | in |
| 12 | { |
Skyler Grey | 71b8198 | 2024-02-15 18:06:36 +0000 | [diff] [blame] | 13 | options.chimera = { |
Skyler Grey | 5e34498 | 2024-02-15 18:59:45 +0000 | [diff] [blame] | 14 | input.mouse.scrolling.natural = lib.mkEnableOption "Enable natural scrolling"; |
| 15 | input.touchpad.scrolling.natural = lib.mkOption { |
| 16 | type = lib.types.bool; |
| 17 | description = "Enable natural scrolling"; |
| 18 | default = config.chimera.input.mouse.scrolling.natural; |
| 19 | }; |
Skyler Grey | 71b8198 | 2024-02-15 18:06:36 +0000 | [diff] [blame] | 20 | input.keyboard = { |
| 21 | layout = lib.mkOption { |
| 22 | type = lib.types.str; |
| 23 | description = "Keyboard layouts, comma seperated"; |
| 24 | example = "us,de"; |
| 25 | default = "us"; |
| 26 | }; |
| 27 | variant = lib.mkOption { |
| 28 | type = lib.types.nullOr lib.types.str; |
| 29 | description = "Keyboard layout variants, comma seperated"; |
| 30 | example = "dvorak"; |
| 31 | default = null; |
| 32 | }; |
| 33 | }; |
PineaFan | 66e4674 | 2024-04-20 20:59:22 +0100 | [diff] [blame] | 34 | |
| 35 | nvidia.enable = lib.mkEnableOption "Enable NVIDIA support"; |
| 36 | |
Skyler Grey | 71b8198 | 2024-02-15 18:06:36 +0000 | [diff] [blame] | 37 | hyprland = { |
| 38 | enable = lib.mkEnableOption "Use hyprland as your window manager"; |
Skyler Grey | 71b8198 | 2024-02-15 18:06:36 +0000 | [diff] [blame] | 39 | monitors = lib.mkOption { |
| 40 | type = lib.types.listOf lib.types.str; |
| 41 | description = "List of default monitors to set"; |
| 42 | default = [ ]; |
| 43 | }; |
Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 44 | }; |
| 45 | }; |
| 46 | |
Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 47 | config = lib.mkIf config.chimera.hyprland.enable { |
Samuel Shuert | dab963e | 2024-03-23 19:54:28 -0400 | [diff] [blame] | 48 | chimera.waybar.enable = lib.mkDefault true; |
| 49 | |
Skyler Grey | b8bc97b | 2024-02-25 11:12:08 +0000 | [diff] [blame] | 50 | programs.bash.profileExtra = lib.mkIf config.chimera.shell.bash.enable (lib.mkBefore '' |
| 51 | if [ -z $WAYLAND_DISPLAY ] && [ "$(tty)" = "/dev/tty1" ]; then |
Skyler Grey | fb254d2 | 2024-03-03 13:03:22 +0000 | [diff] [blame] | 52 | exec ${pkgs.systemd}/bin/systemd-cat -t hyprland ${pkgs.dbus}/bin/dbus-run-session ${config.wayland.windowManager.hyprland.package}/bin/Hyprland |
Skyler Grey | b8bc97b | 2024-02-25 11:12:08 +0000 | [diff] [blame] | 53 | fi |
| 54 | ''); |
| 55 | |
| 56 | programs.zsh.profileExtra = lib.mkIf config.chimera.shell.zsh.enable (lib.mkBefore '' |
| 57 | if [ -z $WAYLAND_DISPLAY ] && [ "$(tty)" = "/dev/tty1" ]; then |
Skyler Grey | fb254d2 | 2024-03-03 13:03:22 +0000 | [diff] [blame] | 58 | exec ${pkgs.systemd}/bin/systemd-cat -t hyprland ${pkgs.dbus}/bin/dbus-run-session ${config.wayland.windowManager.hyprland.package}/bin/Hyprland |
Skyler Grey | b8bc97b | 2024-02-25 11:12:08 +0000 | [diff] [blame] | 59 | fi |
| 60 | ''); |
| 61 | |
Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 62 | home.packages = [ pkgs.hyprpicker ]; |
Skyler Grey | a0da6b2 | 2024-02-11 22:53:41 +0000 | [diff] [blame] | 63 | |
Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 64 | services.fusuma.settings.swipe = lib.mkIf config.chimera.touchpad.enable ( |
| 65 | let |
| 66 | hyprctl = "${config.wayland.windowManager.hyprland.package}/bin/hyprctl"; |
| 67 | jq = "${pkgs.jq}/bin/jq"; |
| 68 | awk = "${pkgs.gawk}/bin/awk"; |
| 69 | in |
| 70 | { |
| 71 | "3".up.command = "${hyprctl} dispatch fullscreen 0"; |
| 72 | "3".down.command = "${hyprctl} dispatch fullscreen 0"; |
| 73 | "4".down.command = lock; |
| 74 | "3".left.command = "${hyprctl} dispatch workspace $(${hyprctl} activeworkspace -j | ${jq} .id | ${awk} '{print $1+1}')"; |
| 75 | "3".right.command = "${hyprctl} dispatch workspace $(${hyprctl} activeworkspace -j | ${jq} .id | ${awk} '{print $1-1}')"; |
| 76 | } |
| 77 | ); |
Skyler Grey | a0da6b2 | 2024-02-11 22:53:41 +0000 | [diff] [blame] | 78 | |
Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 79 | wayland.windowManager.hyprland = { |
| 80 | enable = true; |
Skyler Grey | a0da6b2 | 2024-02-11 22:53:41 +0000 | [diff] [blame] | 81 | |
Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 82 | xwayland.enable = true; |
| 83 | systemd.enable = true; |
Skyler Grey | a0da6b2 | 2024-02-11 22:53:41 +0000 | [diff] [blame] | 84 | |
Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 85 | settings = |
| 86 | let |
| 87 | mod = "SUPER"; |
| 88 | terminal = "${pkgs.kitty}/bin/kitty"; |
Samuel Shuert | 004d075 | 2024-03-02 11:57:09 -0500 | [diff] [blame] | 89 | menu = (if config.chimera.runner.anyrun.enable then "${inputs.anyrun.packages.${system}.anyrun}/bin/anyrun" else ""); |
Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 90 | in |
| 91 | { |
| 92 | misc = { |
| 93 | disable_hyprland_logo = true; |
| 94 | disable_splash_rendering = true; |
| 95 | }; |
Skyler Grey | a0da6b2 | 2024-02-11 22:53:41 +0000 | [diff] [blame] | 96 | |
Skyler Grey | e3e18d3 | 2024-02-17 11:33:17 +0000 | [diff] [blame] | 97 | exec-once = [ |
Samuel Shuert | 659b564 | 2024-02-23 20:47:43 +0000 | [diff] [blame] | 98 | "${pkgs.hyprpaper}/bin/hyprpaper" |
| 99 | "hyprctl setcursor ${config.chimera.theme.cursor.name} ${builtins.toString config.chimera.theme.cursor.size}" |
Samuel Shuert | dab963e | 2024-03-23 19:54:28 -0400 | [diff] [blame] | 100 | "${pkgs.waybar}/bin/waybar" |
Samuel Shuert | 659b564 | 2024-02-23 20:47:43 +0000 | [diff] [blame] | 101 | ]; |
Skyler Grey | a0da6b2 | 2024-02-11 22:53:41 +0000 | [diff] [blame] | 102 | |
Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 103 | monitor = config.chimera.hyprland.monitors ++ [ ",preferred,auto,1" ]; |
Skyler Grey | a0da6b2 | 2024-02-11 22:53:41 +0000 | [diff] [blame] | 104 | |
Skyler Grey | abaa607 | 2024-02-15 19:07:00 +0000 | [diff] [blame] | 105 | general = { |
| 106 | border_size = 1; |
| 107 | "col.active_border" = "rgba(${config.chimera.theme.colors.Surface0.hex}FF)"; |
| 108 | "col.inactive_border" = "rgba(${config.chimera.theme.colors.Surface0.hex}FF)"; |
| 109 | }; |
| 110 | |
Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 111 | decoration = { |
| 112 | rounding = 7; |
Skyler Grey | abaa607 | 2024-02-15 19:07:00 +0000 | [diff] [blame] | 113 | drop_shadow = false; |
Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 114 | }; |
Skyler Grey | a0da6b2 | 2024-02-11 22:53:41 +0000 | [diff] [blame] | 115 | |
Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 116 | input = { |
Skyler Grey | 71b8198 | 2024-02-15 18:06:36 +0000 | [diff] [blame] | 117 | kb_layout = config.chimera.input.keyboard.layout; |
Skyler Grey | ec50d24 | 2024-02-15 23:09:46 +0000 | [diff] [blame] | 118 | kb_variant = |
| 119 | lib.mkIf (config.chimera.input.keyboard.variant != null) |
| 120 | config.chimera.input.keyboard.variant; |
Skyler Grey | 5e34498 | 2024-02-15 18:59:45 +0000 | [diff] [blame] | 121 | natural_scroll = config.chimera.input.mouse.scrolling.natural; |
| 122 | |
| 123 | numlock_by_default = true; |
Skyler Grey | a0da6b2 | 2024-02-11 22:53:41 +0000 | [diff] [blame] | 124 | |
Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 125 | touchpad = { |
Skyler Grey | 5e34498 | 2024-02-15 18:59:45 +0000 | [diff] [blame] | 126 | natural_scroll = config.chimera.input.touchpad.scrolling.natural; |
Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 127 | }; |
| 128 | }; |
Skyler Grey | a0da6b2 | 2024-02-11 22:53:41 +0000 | [diff] [blame] | 129 | |
Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 130 | xwayland = { |
| 131 | force_zero_scaling = true; |
| 132 | }; |
Skyler Grey | a0da6b2 | 2024-02-11 22:53:41 +0000 | [diff] [blame] | 133 | |
Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 134 | dwindle = { |
| 135 | pseudotile = true; |
| 136 | smart_split = true; |
| 137 | }; |
| 138 | |
| 139 | master = { |
| 140 | allow_small_split = true; |
| 141 | new_is_master = true; |
| 142 | }; |
| 143 | |
| 144 | windowrulev2 = [ "opacity 1.0 0.85,title:(.*)" ]; |
| 145 | |
| 146 | bind = |
| 147 | [ |
| 148 | "${mod}, Q, killactive" |
| 149 | "${mod}, SPACE, togglefloating" |
| 150 | "${mod}, RETURN, exec, ${terminal}" |
| 151 | "${mod}, down, movefocus, d" |
| 152 | "${mod}, up, movefocus, u" |
| 153 | "${mod}, right, movefocus, r" |
| 154 | "${mod}, left, movefocus, l" |
| 155 | "${mod}, L, exec, ${lock}" |
Skyler Grey | a0da6b2 | 2024-02-11 22:53:41 +0000 | [diff] [blame] | 156 | ] |
Samuel Shuert | 004d075 | 2024-03-02 11:57:09 -0500 | [diff] [blame] | 157 | ++ (if config.chimera.runner.enable then [ "${mod}, D, exec, ${menu}" ] else []) |
Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 158 | ++ (builtins.concatLists ( |
| 159 | builtins.genList |
| 160 | ( |
| 161 | x: |
| 162 | let |
| 163 | ws = |
| 164 | let |
| 165 | c = (x + 1) / 10; |
| 166 | in |
| 167 | builtins.toString (x + 1 - (c * 10)); |
| 168 | in |
| 169 | [ |
| 170 | "${mod}, ${ws}, workspace, ${toString (x + 1)}" |
| 171 | "${mod} SHIFT, ${ws}, movetoworkspace, ${toString (x + 1)}" |
| 172 | ] |
| 173 | ) |
| 174 | 10 |
| 175 | )); |
Skyler Grey | a0da6b2 | 2024-02-11 22:53:41 +0000 | [diff] [blame] | 176 | |
Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 177 | bindm = [ |
| 178 | "${mod}, mouse:272, movewindow" |
| 179 | "${mod}, mouse:273, resizewindow" |
| 180 | ]; |
PineaFan | 66e4674 | 2024-04-20 20:59:22 +0100 | [diff] [blame] | 181 | |
| 182 | env = lib.mkIf config.chimera.nvidia.enable [ |
| 183 | "LIBVA_DRIVER_NAME,nvidia" |
| 184 | "XDG_SESSION_TYPE,wayland" |
| 185 | "GBM_BACKEND,nvidia-drm" |
| 186 | "__GLX_VENDOR_LIBRARY_NAME,nvidia" |
| 187 | "WLR_NO_HARDWARE_CURSORS,1" |
| 188 | ] |
Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 189 | }; |
Skyler Grey | a0da6b2 | 2024-02-11 22:53:41 +0000 | [diff] [blame] | 190 | }; |
| 191 | }; |
Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 192 | } |