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