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