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