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 | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 87 | decoration = { |
| 88 | rounding = 7; |
| 89 | }; |
Skyler Grey | a0da6b2 | 2024-02-11 22:53:41 +0000 | [diff] [blame] | 90 | |
Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 91 | input = { |
Skyler Grey | 71b8198 | 2024-02-15 18:06:36 +0000 | [diff] [blame] | 92 | kb_layout = config.chimera.input.keyboard.layout; |
| 93 | 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] | 94 | natural_scroll = config.chimera.input.mouse.scrolling.natural; |
| 95 | |
| 96 | numlock_by_default = true; |
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 | touchpad = { |
Skyler Grey | 5e34498 | 2024-02-15 18:59:45 +0000 | [diff] [blame] | 99 | natural_scroll = config.chimera.input.touchpad.scrolling.natural; |
Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 100 | }; |
| 101 | }; |
Skyler Grey | a0da6b2 | 2024-02-11 22:53:41 +0000 | [diff] [blame] | 102 | |
Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 103 | xwayland = { |
| 104 | force_zero_scaling = true; |
| 105 | }; |
Skyler Grey | a0da6b2 | 2024-02-11 22:53:41 +0000 | [diff] [blame] | 106 | |
Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 107 | dwindle = { |
| 108 | pseudotile = true; |
| 109 | smart_split = true; |
| 110 | }; |
| 111 | |
| 112 | master = { |
| 113 | allow_small_split = true; |
| 114 | new_is_master = true; |
| 115 | }; |
| 116 | |
| 117 | windowrulev2 = [ "opacity 1.0 0.85,title:(.*)" ]; |
| 118 | |
| 119 | bind = |
| 120 | [ |
| 121 | "${mod}, Q, killactive" |
| 122 | "${mod}, SPACE, togglefloating" |
| 123 | "${mod}, RETURN, exec, ${terminal}" |
| 124 | "${mod}, down, movefocus, d" |
| 125 | "${mod}, up, movefocus, u" |
| 126 | "${mod}, right, movefocus, r" |
| 127 | "${mod}, left, movefocus, l" |
| 128 | "${mod}, L, exec, ${lock}" |
| 129 | "${mod}, D, exec, ${menu}" |
Skyler Grey | a0da6b2 | 2024-02-11 22:53:41 +0000 | [diff] [blame] | 130 | ] |
Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 131 | ++ (builtins.concatLists ( |
| 132 | builtins.genList |
| 133 | ( |
| 134 | x: |
| 135 | let |
| 136 | ws = |
| 137 | let |
| 138 | c = (x + 1) / 10; |
| 139 | in |
| 140 | builtins.toString (x + 1 - (c * 10)); |
| 141 | in |
| 142 | [ |
| 143 | "${mod}, ${ws}, workspace, ${toString (x + 1)}" |
| 144 | "${mod} SHIFT, ${ws}, movetoworkspace, ${toString (x + 1)}" |
| 145 | ] |
| 146 | ) |
| 147 | 10 |
| 148 | )); |
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 | bindm = [ |
| 151 | "${mod}, mouse:272, movewindow" |
| 152 | "${mod}, mouse:273, resizewindow" |
| 153 | ]; |
| 154 | }; |
Skyler Grey | a0da6b2 | 2024-02-11 22:53:41 +0000 | [diff] [blame] | 155 | }; |
| 156 | }; |
Skyler Grey | 4e23089 | 2024-02-13 22:58:46 +0000 | [diff] [blame] | 157 | } |