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 | |
PineaFan | 2f02bca | 2024-04-20 21:21:44 +0100 | [diff] [blame^] | 35 | input.keybinds = { |
| 36 | alternativeSearch.enable = lib.mkEnableOption "Use alt + space or SUPER + D to open search"; |
| 37 | extraBinds = let |
| 38 | binds = lib.types.submodule { |
| 39 | options = { |
| 40 | meta = lib.mkOption { |
| 41 | type = lib.types.nullOr lib.types.str; |
| 42 | description = "Additional modifier keys space seperated"; |
| 43 | default = null; |
| 44 | }; |
| 45 | key = lib.mkOption { |
| 46 | type = lib.types.str; |
| 47 | description = "Final key"; |
| 48 | }; |
| 49 | function = lib.mkOption { |
| 50 | type = lib.types.str; |
| 51 | description = "Hyprland bind function"; |
| 52 | }; |
| 53 | }; |
| 54 | }; |
| 55 | in lib.mkOption { |
| 56 | type = lib.types.listOf binds; |
| 57 | description = "Extra keybinds to add"; |
| 58 | default = [ ]; |
| 59 | }; |
| 60 | }; |
| 61 | |
PineaFan | 66e4674 | 2024-04-20 20:59:22 +0100 | [diff] [blame] | 62 | nvidia.enable = lib.mkEnableOption "Enable NVIDIA support"; |
| 63 | |
Skyler Grey | 71b8198 | 2024-02-15 18:06:36 +0000 | [diff] [blame] | 64 | hyprland = { |
| 65 | enable = lib.mkEnableOption "Use hyprland as your window manager"; |
Skyler Grey | 71b8198 | 2024-02-15 18:06:36 +0000 | [diff] [blame] | 66 | monitors = lib.mkOption { |
| 67 | type = lib.types.listOf lib.types.str; |
| 68 | description = "List of default monitors to set"; |
| 69 | default = [ ]; |
| 70 | }; |
PineaFan | 2f02bca | 2024-04-20 21:21:44 +0100 | [diff] [blame^] | 71 | window = { |
| 72 | rounding = lib.mkOption { |
| 73 | type = lib.types.int; |
| 74 | description = "How round the windows should be"; |
| 75 | default = 7; |
| 76 | }; |
| 77 | blur = lib.mkOption { |
| 78 | type = lib.types.int; |
| 79 | description = "How blurred the wallpaper under innactive windows should be"; |
| 80 | default = 8; |
| 81 | }; |
| 82 | }; |
Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 83 | }; |
| 84 | }; |
| 85 | |
Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 86 | config = lib.mkIf config.chimera.hyprland.enable { |
Samuel Shuert | dab963e | 2024-03-23 19:54:28 -0400 | [diff] [blame] | 87 | chimera.waybar.enable = lib.mkDefault true; |
| 88 | |
Skyler Grey | b8bc97b | 2024-02-25 11:12:08 +0000 | [diff] [blame] | 89 | programs.bash.profileExtra = lib.mkIf config.chimera.shell.bash.enable (lib.mkBefore '' |
| 90 | if [ -z $WAYLAND_DISPLAY ] && [ "$(tty)" = "/dev/tty1" ]; then |
Skyler Grey | fb254d2 | 2024-03-03 13:03:22 +0000 | [diff] [blame] | 91 | 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] | 92 | fi |
| 93 | ''); |
| 94 | |
| 95 | programs.zsh.profileExtra = lib.mkIf config.chimera.shell.zsh.enable (lib.mkBefore '' |
| 96 | if [ -z $WAYLAND_DISPLAY ] && [ "$(tty)" = "/dev/tty1" ]; then |
Skyler Grey | fb254d2 | 2024-03-03 13:03:22 +0000 | [diff] [blame] | 97 | 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] | 98 | fi |
| 99 | ''); |
| 100 | |
Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 101 | home.packages = [ pkgs.hyprpicker ]; |
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 | services.fusuma.settings.swipe = lib.mkIf config.chimera.touchpad.enable ( |
| 104 | let |
| 105 | hyprctl = "${config.wayland.windowManager.hyprland.package}/bin/hyprctl"; |
| 106 | jq = "${pkgs.jq}/bin/jq"; |
| 107 | awk = "${pkgs.gawk}/bin/awk"; |
| 108 | in |
| 109 | { |
| 110 | "3".up.command = "${hyprctl} dispatch fullscreen 0"; |
| 111 | "3".down.command = "${hyprctl} dispatch fullscreen 0"; |
| 112 | "4".down.command = lock; |
| 113 | "3".left.command = "${hyprctl} dispatch workspace $(${hyprctl} activeworkspace -j | ${jq} .id | ${awk} '{print $1+1}')"; |
| 114 | "3".right.command = "${hyprctl} dispatch workspace $(${hyprctl} activeworkspace -j | ${jq} .id | ${awk} '{print $1-1}')"; |
| 115 | } |
| 116 | ); |
Skyler Grey | a0da6b2 | 2024-02-11 22:53:41 +0000 | [diff] [blame] | 117 | |
Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 118 | wayland.windowManager.hyprland = { |
| 119 | enable = true; |
Skyler Grey | a0da6b2 | 2024-02-11 22:53:41 +0000 | [diff] [blame] | 120 | |
Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 121 | xwayland.enable = true; |
| 122 | systemd.enable = true; |
Skyler Grey | a0da6b2 | 2024-02-11 22:53:41 +0000 | [diff] [blame] | 123 | |
Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 124 | settings = |
| 125 | let |
| 126 | mod = "SUPER"; |
| 127 | terminal = "${pkgs.kitty}/bin/kitty"; |
Samuel Shuert | 004d075 | 2024-03-02 11:57:09 -0500 | [diff] [blame] | 128 | menu = (if config.chimera.runner.anyrun.enable then "${inputs.anyrun.packages.${system}.anyrun}/bin/anyrun" else ""); |
PineaFan | 2f02bca | 2024-04-20 21:21:44 +0100 | [diff] [blame^] | 129 | screenshot = "${pkgs.grim}/bin/grim -g \"$(${pkgs.slurp}/bin/slurp -d)\" - | ${pkgs.wl-clipboard}/bin/wl-copy"; |
Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 130 | in |
| 131 | { |
| 132 | misc = { |
| 133 | disable_hyprland_logo = true; |
| 134 | disable_splash_rendering = true; |
| 135 | }; |
Skyler Grey | a0da6b2 | 2024-02-11 22:53:41 +0000 | [diff] [blame] | 136 | |
Skyler Grey | e3e18d3 | 2024-02-17 11:33:17 +0000 | [diff] [blame] | 137 | exec-once = [ |
Samuel Shuert | 659b564 | 2024-02-23 20:47:43 +0000 | [diff] [blame] | 138 | "${pkgs.hyprpaper}/bin/hyprpaper" |
| 139 | "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] | 140 | "${pkgs.waybar}/bin/waybar" |
Samuel Shuert | 659b564 | 2024-02-23 20:47:43 +0000 | [diff] [blame] | 141 | ]; |
Skyler Grey | a0da6b2 | 2024-02-11 22:53:41 +0000 | [diff] [blame] | 142 | |
Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 143 | monitor = config.chimera.hyprland.monitors ++ [ ",preferred,auto,1" ]; |
Skyler Grey | a0da6b2 | 2024-02-11 22:53:41 +0000 | [diff] [blame] | 144 | |
Skyler Grey | abaa607 | 2024-02-15 19:07:00 +0000 | [diff] [blame] | 145 | general = { |
| 146 | border_size = 1; |
| 147 | "col.active_border" = "rgba(${config.chimera.theme.colors.Surface0.hex}FF)"; |
| 148 | "col.inactive_border" = "rgba(${config.chimera.theme.colors.Surface0.hex}FF)"; |
| 149 | }; |
| 150 | |
Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 151 | decoration = { |
PineaFan | 2f02bca | 2024-04-20 21:21:44 +0100 | [diff] [blame^] | 152 | rounding = config.chimera.hyprland.window.rounding; |
Skyler Grey | abaa607 | 2024-02-15 19:07:00 +0000 | [diff] [blame] | 153 | drop_shadow = false; |
PineaFan | 2f02bca | 2024-04-20 21:21:44 +0100 | [diff] [blame^] | 154 | blur.size = config.chimera.hyprland.window.blur; |
Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 155 | }; |
Skyler Grey | a0da6b2 | 2024-02-11 22:53:41 +0000 | [diff] [blame] | 156 | |
Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 157 | input = { |
Skyler Grey | 71b8198 | 2024-02-15 18:06:36 +0000 | [diff] [blame] | 158 | kb_layout = config.chimera.input.keyboard.layout; |
Skyler Grey | ec50d24 | 2024-02-15 23:09:46 +0000 | [diff] [blame] | 159 | kb_variant = |
| 160 | lib.mkIf (config.chimera.input.keyboard.variant != null) |
| 161 | config.chimera.input.keyboard.variant; |
Skyler Grey | 5e34498 | 2024-02-15 18:59:45 +0000 | [diff] [blame] | 162 | natural_scroll = config.chimera.input.mouse.scrolling.natural; |
| 163 | |
| 164 | numlock_by_default = true; |
Skyler Grey | a0da6b2 | 2024-02-11 22:53:41 +0000 | [diff] [blame] | 165 | |
Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 166 | touchpad = { |
Skyler Grey | 5e34498 | 2024-02-15 18:59:45 +0000 | [diff] [blame] | 167 | natural_scroll = config.chimera.input.touchpad.scrolling.natural; |
Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 168 | }; |
| 169 | }; |
Skyler Grey | a0da6b2 | 2024-02-11 22:53:41 +0000 | [diff] [blame] | 170 | |
Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 171 | xwayland = { |
| 172 | force_zero_scaling = true; |
| 173 | }; |
Skyler Grey | a0da6b2 | 2024-02-11 22:53:41 +0000 | [diff] [blame] | 174 | |
Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 175 | dwindle = { |
| 176 | pseudotile = true; |
| 177 | smart_split = true; |
| 178 | }; |
| 179 | |
| 180 | master = { |
| 181 | allow_small_split = true; |
| 182 | new_is_master = true; |
| 183 | }; |
| 184 | |
| 185 | windowrulev2 = [ "opacity 1.0 0.85,title:(.*)" ]; |
| 186 | |
| 187 | bind = |
| 188 | [ |
| 189 | "${mod}, Q, killactive" |
| 190 | "${mod}, SPACE, togglefloating" |
| 191 | "${mod}, RETURN, exec, ${terminal}" |
| 192 | "${mod}, down, movefocus, d" |
| 193 | "${mod}, up, movefocus, u" |
| 194 | "${mod}, right, movefocus, r" |
| 195 | "${mod}, left, movefocus, l" |
| 196 | "${mod}, L, exec, ${lock}" |
PineaFan | 2f02bca | 2024-04-20 21:21:44 +0100 | [diff] [blame^] | 197 | "${mod}, R, exec, ${screenshot}" |
| 198 | ", Print, exec, ${screenshot}" |
Skyler Grey | a0da6b2 | 2024-02-11 22:53:41 +0000 | [diff] [blame] | 199 | ] |
Samuel Shuert | 004d075 | 2024-03-02 11:57:09 -0500 | [diff] [blame] | 200 | ++ (if config.chimera.runner.enable then [ "${mod}, D, exec, ${menu}" ] else []) |
PineaFan | 2f02bca | 2024-04-20 21:21:44 +0100 | [diff] [blame^] | 201 | ++ (if lib.and config.chimera.input.keybinds.alternativeSearch.enable config.chimera.runner.enable then [ "ALT, SPACE, exec, ${menu}" ] else []) |
Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 202 | ++ (builtins.concatLists ( |
| 203 | builtins.genList |
| 204 | ( |
| 205 | x: |
| 206 | let |
| 207 | ws = |
| 208 | let |
| 209 | c = (x + 1) / 10; |
| 210 | in |
| 211 | builtins.toString (x + 1 - (c * 10)); |
| 212 | in |
| 213 | [ |
| 214 | "${mod}, ${ws}, workspace, ${toString (x + 1)}" |
| 215 | "${mod} SHIFT, ${ws}, movetoworkspace, ${toString (x + 1)}" |
| 216 | ] |
| 217 | ) |
| 218 | 10 |
PineaFan | 2f02bca | 2024-04-20 21:21:44 +0100 | [diff] [blame^] | 219 | )) |
| 220 | ++ (builtins.map (item: "SUPER_${item.meta}, ${item.key}, ${item.function}") config.chimera.input.keybinds.extraBinds); |
Skyler Grey | a0da6b2 | 2024-02-11 22:53:41 +0000 | [diff] [blame] | 221 | |
Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 222 | bindm = [ |
| 223 | "${mod}, mouse:272, movewindow" |
| 224 | "${mod}, mouse:273, resizewindow" |
| 225 | ]; |
PineaFan | 66e4674 | 2024-04-20 20:59:22 +0100 | [diff] [blame] | 226 | |
| 227 | env = lib.mkIf config.chimera.nvidia.enable [ |
| 228 | "LIBVA_DRIVER_NAME,nvidia" |
| 229 | "XDG_SESSION_TYPE,wayland" |
| 230 | "GBM_BACKEND,nvidia-drm" |
| 231 | "__GLX_VENDOR_LIBRARY_NAME,nvidia" |
| 232 | "WLR_NO_HARDWARE_CURSORS,1" |
PineaFan | 2f02bca | 2024-04-20 21:21:44 +0100 | [diff] [blame^] | 233 | ]; |
Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 234 | }; |
Skyler Grey | a0da6b2 | 2024-02-11 22:53:41 +0000 | [diff] [blame] | 235 | }; |
| 236 | }; |
Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 237 | } |