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 | a0da6b2 | 2024-02-11 22:53:41 +0000 | [diff] [blame] | 45 | # TODO: Eww, SwayNC, hyprland-per-window-layout, waylock, hy3, anyrun, hypr-empty |
| 46 | |
Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 47 | config = lib.mkIf config.chimera.hyprland.enable { |
| 48 | home.packages = [ pkgs.hyprpicker ]; |
Skyler Grey | a0da6b2 | 2024-02-11 22:53:41 +0000 | [diff] [blame] | 49 | |
Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 50 | services.fusuma.settings.swipe = lib.mkIf config.chimera.touchpad.enable ( |
| 51 | let |
| 52 | hyprctl = "${config.wayland.windowManager.hyprland.package}/bin/hyprctl"; |
| 53 | jq = "${pkgs.jq}/bin/jq"; |
| 54 | awk = "${pkgs.gawk}/bin/awk"; |
| 55 | in |
| 56 | { |
| 57 | "3".up.command = "${hyprctl} dispatch fullscreen 0"; |
| 58 | "3".down.command = "${hyprctl} dispatch fullscreen 0"; |
| 59 | "4".down.command = lock; |
| 60 | "3".left.command = "${hyprctl} dispatch workspace $(${hyprctl} activeworkspace -j | ${jq} .id | ${awk} '{print $1+1}')"; |
| 61 | "3".right.command = "${hyprctl} dispatch workspace $(${hyprctl} activeworkspace -j | ${jq} .id | ${awk} '{print $1-1}')"; |
| 62 | } |
| 63 | ); |
Skyler Grey | a0da6b2 | 2024-02-11 22:53:41 +0000 | [diff] [blame] | 64 | |
Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 65 | wayland.windowManager.hyprland = { |
| 66 | enable = true; |
Skyler Grey | a0da6b2 | 2024-02-11 22:53:41 +0000 | [diff] [blame] | 67 | |
Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 68 | xwayland.enable = true; |
| 69 | systemd.enable = true; |
Skyler Grey | a0da6b2 | 2024-02-11 22:53:41 +0000 | [diff] [blame] | 70 | |
Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 71 | settings = |
| 72 | let |
| 73 | mod = "SUPER"; |
| 74 | terminal = "${pkgs.kitty}/bin/kitty"; |
| 75 | menu = "${inputs.anyrun.packages.${system}.anyrun}/bin/anyrun"; |
| 76 | in |
| 77 | { |
| 78 | misc = { |
| 79 | disable_hyprland_logo = true; |
| 80 | disable_splash_rendering = true; |
| 81 | }; |
Skyler Grey | a0da6b2 | 2024-02-11 22:53:41 +0000 | [diff] [blame] | 82 | |
Samuel Shuert | 02ffd1e | 2024-02-13 21:37:15 -0500 | [diff] [blame] | 83 | exec-once = "${pkgs.hyprpaper}/bin/hyprpaper; hyprctl setcursor ${config.chimera.theme.cursor.name} ${builtins.toString config.chimera.theme.cursor.size}"; |
Skyler Grey | a0da6b2 | 2024-02-11 22:53:41 +0000 | [diff] [blame] | 84 | |
Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 85 | monitor = config.chimera.hyprland.monitors ++ [ ",preferred,auto,1" ]; |
Skyler Grey | a0da6b2 | 2024-02-11 22:53:41 +0000 | [diff] [blame] | 86 | |
Skyler Grey | abaa607 | 2024-02-15 19:07:00 +0000 | [diff] [blame] | 87 | general = { |
| 88 | border_size = 1; |
| 89 | "col.active_border" = "rgba(${config.chimera.theme.colors.Surface0.hex}FF)"; |
| 90 | "col.inactive_border" = "rgba(${config.chimera.theme.colors.Surface0.hex}FF)"; |
| 91 | }; |
| 92 | |
Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 93 | decoration = { |
| 94 | rounding = 7; |
Skyler Grey | abaa607 | 2024-02-15 19:07:00 +0000 | [diff] [blame] | 95 | drop_shadow = false; |
Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 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 | input = { |
Skyler Grey | 71b8198 | 2024-02-15 18:06:36 +0000 | [diff] [blame] | 99 | kb_layout = config.chimera.input.keyboard.layout; |
| 100 | kb_variant = lib.mkIf (config.chimera.input.keyboard.variant != null) config.chimera.input.keyboard.variant; |
Skyler Grey | 5e34498 | 2024-02-15 18:59:45 +0000 | [diff] [blame] | 101 | natural_scroll = config.chimera.input.mouse.scrolling.natural; |
| 102 | |
| 103 | numlock_by_default = 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 | touchpad = { |
Skyler Grey | 5e34498 | 2024-02-15 18:59:45 +0000 | [diff] [blame] | 106 | natural_scroll = config.chimera.input.touchpad.scrolling.natural; |
Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 107 | }; |
| 108 | }; |
Skyler Grey | a0da6b2 | 2024-02-11 22:53:41 +0000 | [diff] [blame] | 109 | |
Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 110 | xwayland = { |
| 111 | force_zero_scaling = true; |
| 112 | }; |
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 | dwindle = { |
| 115 | pseudotile = true; |
| 116 | smart_split = true; |
| 117 | }; |
| 118 | |
| 119 | master = { |
| 120 | allow_small_split = true; |
| 121 | new_is_master = true; |
| 122 | }; |
| 123 | |
| 124 | windowrulev2 = [ "opacity 1.0 0.85,title:(.*)" ]; |
| 125 | |
| 126 | bind = |
| 127 | [ |
| 128 | "${mod}, Q, killactive" |
| 129 | "${mod}, SPACE, togglefloating" |
| 130 | "${mod}, RETURN, exec, ${terminal}" |
| 131 | "${mod}, down, movefocus, d" |
| 132 | "${mod}, up, movefocus, u" |
| 133 | "${mod}, right, movefocus, r" |
| 134 | "${mod}, left, movefocus, l" |
| 135 | "${mod}, L, exec, ${lock}" |
| 136 | "${mod}, D, exec, ${menu}" |
Skyler Grey | a0da6b2 | 2024-02-11 22:53:41 +0000 | [diff] [blame] | 137 | ] |
Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 138 | ++ (builtins.concatLists ( |
| 139 | builtins.genList |
| 140 | ( |
| 141 | x: |
| 142 | let |
| 143 | ws = |
| 144 | let |
| 145 | c = (x + 1) / 10; |
| 146 | in |
| 147 | builtins.toString (x + 1 - (c * 10)); |
| 148 | in |
| 149 | [ |
| 150 | "${mod}, ${ws}, workspace, ${toString (x + 1)}" |
| 151 | "${mod} SHIFT, ${ws}, movetoworkspace, ${toString (x + 1)}" |
| 152 | ] |
| 153 | ) |
| 154 | 10 |
| 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 | bindm = [ |
| 158 | "${mod}, mouse:272, movewindow" |
| 159 | "${mod}, mouse:273, resizewindow" |
| 160 | ]; |
| 161 | }; |
Skyler Grey | a0da6b2 | 2024-02-11 22:53:41 +0000 | [diff] [blame] | 162 | }; |
| 163 | }; |
Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 164 | } |