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