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