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 | |
Skyler Grey | e3e18d3 | 2024-02-17 11:33:17 +0000 | [diff] [blame] | 83 | exec-once = [ |
| 84 | "${pkgs.hyprpaper}/bin/hyprpaper" |
| 85 | "hyprctl setcursor ${config.chimera.theme.cursor.name} ${builtins.toString config.chimera.theme.cursor.size}" |
| 86 | ]; |
Skyler Grey | a0da6b2 | 2024-02-11 22:53:41 +0000 | [diff] [blame] | 87 | |
Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 88 | monitor = config.chimera.hyprland.monitors ++ [ ",preferred,auto,1" ]; |
Skyler Grey | a0da6b2 | 2024-02-11 22:53:41 +0000 | [diff] [blame] | 89 | |
Skyler Grey | abaa607 | 2024-02-15 19:07:00 +0000 | [diff] [blame] | 90 | general = { |
| 91 | border_size = 1; |
| 92 | "col.active_border" = "rgba(${config.chimera.theme.colors.Surface0.hex}FF)"; |
| 93 | "col.inactive_border" = "rgba(${config.chimera.theme.colors.Surface0.hex}FF)"; |
| 94 | }; |
| 95 | |
Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 96 | decoration = { |
| 97 | rounding = 7; |
Skyler Grey | abaa607 | 2024-02-15 19:07:00 +0000 | [diff] [blame] | 98 | drop_shadow = false; |
Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 99 | }; |
Skyler Grey | a0da6b2 | 2024-02-11 22:53:41 +0000 | [diff] [blame] | 100 | |
Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 101 | input = { |
Skyler Grey | 71b8198 | 2024-02-15 18:06:36 +0000 | [diff] [blame] | 102 | kb_layout = config.chimera.input.keyboard.layout; |
Skyler Grey | ec50d24 | 2024-02-15 23:09:46 +0000 | [diff] [blame] | 103 | kb_variant = |
| 104 | lib.mkIf (config.chimera.input.keyboard.variant != null) |
| 105 | config.chimera.input.keyboard.variant; |
Skyler Grey | 5e34498 | 2024-02-15 18:59:45 +0000 | [diff] [blame] | 106 | natural_scroll = config.chimera.input.mouse.scrolling.natural; |
| 107 | |
| 108 | numlock_by_default = true; |
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 | touchpad = { |
Skyler Grey | 5e34498 | 2024-02-15 18:59:45 +0000 | [diff] [blame] | 111 | natural_scroll = config.chimera.input.touchpad.scrolling.natural; |
Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 112 | }; |
| 113 | }; |
Skyler Grey | a0da6b2 | 2024-02-11 22:53:41 +0000 | [diff] [blame] | 114 | |
Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 115 | xwayland = { |
| 116 | force_zero_scaling = true; |
| 117 | }; |
Skyler Grey | a0da6b2 | 2024-02-11 22:53:41 +0000 | [diff] [blame] | 118 | |
Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 119 | dwindle = { |
| 120 | pseudotile = true; |
| 121 | smart_split = true; |
| 122 | }; |
| 123 | |
| 124 | master = { |
| 125 | allow_small_split = true; |
| 126 | new_is_master = true; |
| 127 | }; |
| 128 | |
| 129 | windowrulev2 = [ "opacity 1.0 0.85,title:(.*)" ]; |
| 130 | |
| 131 | bind = |
| 132 | [ |
| 133 | "${mod}, Q, killactive" |
| 134 | "${mod}, SPACE, togglefloating" |
| 135 | "${mod}, RETURN, exec, ${terminal}" |
| 136 | "${mod}, down, movefocus, d" |
| 137 | "${mod}, up, movefocus, u" |
| 138 | "${mod}, right, movefocus, r" |
| 139 | "${mod}, left, movefocus, l" |
| 140 | "${mod}, L, exec, ${lock}" |
| 141 | "${mod}, D, exec, ${menu}" |
Skyler Grey | a0da6b2 | 2024-02-11 22:53:41 +0000 | [diff] [blame] | 142 | ] |
Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 143 | ++ (builtins.concatLists ( |
| 144 | builtins.genList |
| 145 | ( |
| 146 | x: |
| 147 | let |
| 148 | ws = |
| 149 | let |
| 150 | c = (x + 1) / 10; |
| 151 | in |
| 152 | builtins.toString (x + 1 - (c * 10)); |
| 153 | in |
| 154 | [ |
| 155 | "${mod}, ${ws}, workspace, ${toString (x + 1)}" |
| 156 | "${mod} SHIFT, ${ws}, movetoworkspace, ${toString (x + 1)}" |
| 157 | ] |
| 158 | ) |
| 159 | 10 |
| 160 | )); |
Skyler Grey | a0da6b2 | 2024-02-11 22:53:41 +0000 | [diff] [blame] | 161 | |
Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 162 | bindm = [ |
| 163 | "${mod}, mouse:272, movewindow" |
| 164 | "${mod}, mouse:273, resizewindow" |
| 165 | ]; |
| 166 | }; |
Skyler Grey | a0da6b2 | 2024-02-11 22:53:41 +0000 | [diff] [blame] | 167 | }; |
| 168 | }; |
Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 169 | } |