blob: 539523b91815133124bbbf3eee2aa0783b15ddb9 [file] [log] [blame]
Skyler Grey4e230892024-02-13 22:58:46 +00001{
2 pkgs,
3 config,
4 inputs,
5 system,
6 lib,
7 ...
8}:
9let
Skyler Greya0da6b22024-02-11 22:53:41 +000010 lock = "${pkgs.waylock}/bin/waylock";
Skyler Grey4e230892024-02-13 22:58:46 +000011in
12{
Skyler Grey71b81982024-02-15 18:06:36 +000013 options.chimera = {
Skyler Grey5e344982024-02-15 18:59:45 +000014 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 Grey71b81982024-02-15 18:06:36 +000020 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 Grey4e230892024-02-13 22:58:46 +000036
Skyler Grey71b81982024-02-15 18:06:36 +000037 monitors = lib.mkOption {
38 type = lib.types.listOf lib.types.str;
39 description = "List of default monitors to set";
40 default = [ ];
41 };
Skyler Grey4e230892024-02-13 22:58:46 +000042 };
43 };
44
Skyler Grey4e230892024-02-13 22:58:46 +000045 config = lib.mkIf config.chimera.hyprland.enable {
Skyler Greyb8bc97b2024-02-25 11:12:08 +000046 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 Grey4e230892024-02-13 22:58:46 +000058 home.packages = [ pkgs.hyprpicker ];
Skyler Greya0da6b22024-02-11 22:53:41 +000059
Skyler Grey4e230892024-02-13 22:58:46 +000060 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 Greya0da6b22024-02-11 22:53:41 +000074
Skyler Grey4e230892024-02-13 22:58:46 +000075 wayland.windowManager.hyprland = {
76 enable = true;
Skyler Greya0da6b22024-02-11 22:53:41 +000077
Skyler Grey4e230892024-02-13 22:58:46 +000078 xwayland.enable = true;
79 systemd.enable = true;
Skyler Greya0da6b22024-02-11 22:53:41 +000080
Skyler Grey4e230892024-02-13 22:58:46 +000081 settings =
82 let
83 mod = "SUPER";
84 terminal = "${pkgs.kitty}/bin/kitty";
85 menu = "${inputs.anyrun.packages.${system}.anyrun}/bin/anyrun";
86 in
87 {
88 misc = {
89 disable_hyprland_logo = true;
90 disable_splash_rendering = true;
91 };
Skyler Greya0da6b22024-02-11 22:53:41 +000092
Skyler Greye3e18d32024-02-17 11:33:17 +000093 exec-once = [
Samuel Shuert659b5642024-02-23 20:47:43 +000094 "${pkgs.hyprpaper}/bin/hyprpaper"
95 "hyprctl setcursor ${config.chimera.theme.cursor.name} ${builtins.toString config.chimera.theme.cursor.size}"
96 ];
Skyler Greya0da6b22024-02-11 22:53:41 +000097
Skyler Grey4e230892024-02-13 22:58:46 +000098 monitor = config.chimera.hyprland.monitors ++ [ ",preferred,auto,1" ];
Skyler Greya0da6b22024-02-11 22:53:41 +000099
Skyler Greyabaa6072024-02-15 19:07:00 +0000100 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 Grey4e230892024-02-13 22:58:46 +0000106 decoration = {
107 rounding = 7;
Skyler Greyabaa6072024-02-15 19:07:00 +0000108 drop_shadow = false;
Skyler Grey4e230892024-02-13 22:58:46 +0000109 };
Skyler Greya0da6b22024-02-11 22:53:41 +0000110
Skyler Grey4e230892024-02-13 22:58:46 +0000111 input = {
Skyler Grey71b81982024-02-15 18:06:36 +0000112 kb_layout = config.chimera.input.keyboard.layout;
Skyler Greyec50d242024-02-15 23:09:46 +0000113 kb_variant =
114 lib.mkIf (config.chimera.input.keyboard.variant != null)
115 config.chimera.input.keyboard.variant;
Skyler Grey5e344982024-02-15 18:59:45 +0000116 natural_scroll = config.chimera.input.mouse.scrolling.natural;
117
118 numlock_by_default = true;
Skyler Greya0da6b22024-02-11 22:53:41 +0000119
Skyler Grey4e230892024-02-13 22:58:46 +0000120 touchpad = {
Skyler Grey5e344982024-02-15 18:59:45 +0000121 natural_scroll = config.chimera.input.touchpad.scrolling.natural;
Skyler Grey4e230892024-02-13 22:58:46 +0000122 };
123 };
Skyler Greya0da6b22024-02-11 22:53:41 +0000124
Skyler Grey4e230892024-02-13 22:58:46 +0000125 xwayland = {
126 force_zero_scaling = true;
127 };
Skyler Greya0da6b22024-02-11 22:53:41 +0000128
Skyler Grey4e230892024-02-13 22:58:46 +0000129 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}"
151 "${mod}, D, exec, ${menu}"
Skyler Greya0da6b22024-02-11 22:53:41 +0000152 ]
Skyler Grey4e230892024-02-13 22:58:46 +0000153 ++ (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 Greya0da6b22024-02-11 22:53:41 +0000171
Skyler Grey4e230892024-02-13 22:58:46 +0000172 bindm = [
173 "${mod}, mouse:272, movewindow"
174 "${mod}, mouse:273, resizewindow"
175 ];
176 };
Skyler Greya0da6b22024-02-11 22:53:41 +0000177 };
178 };
Skyler Grey4e230892024-02-13 22:58:46 +0000179}