blob: ee647d39aab75f500f5b9eb6a9064eb7285c52fd [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 Greya0da6b22024-02-11 22:53:41 +000045 # TODO: Eww, SwayNC, hyprland-per-window-layout, waylock, hy3, anyrun, hypr-empty
46
Skyler Grey4e230892024-02-13 22:58:46 +000047 config = lib.mkIf config.chimera.hyprland.enable {
48 home.packages = [ pkgs.hyprpicker ];
Skyler Greya0da6b22024-02-11 22:53:41 +000049
Skyler Grey4e230892024-02-13 22:58:46 +000050 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 Greya0da6b22024-02-11 22:53:41 +000064
Skyler Grey4e230892024-02-13 22:58:46 +000065 wayland.windowManager.hyprland = {
66 enable = true;
Skyler Greya0da6b22024-02-11 22:53:41 +000067
Skyler Grey4e230892024-02-13 22:58:46 +000068 xwayland.enable = true;
69 systemd.enable = true;
Skyler Greya0da6b22024-02-11 22:53:41 +000070
Skyler Grey4e230892024-02-13 22:58:46 +000071 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 Greya0da6b22024-02-11 22:53:41 +000082
Samuel Shuert02ffd1e2024-02-13 21:37:15 -050083 exec-once = "${pkgs.hyprpaper}/bin/hyprpaper; hyprctl setcursor ${config.chimera.theme.cursor.name} ${builtins.toString config.chimera.theme.cursor.size}";
Skyler Greya0da6b22024-02-11 22:53:41 +000084
Skyler Grey4e230892024-02-13 22:58:46 +000085 monitor = config.chimera.hyprland.monitors ++ [ ",preferred,auto,1" ];
Skyler Greya0da6b22024-02-11 22:53:41 +000086
Skyler Greyabaa6072024-02-15 19:07:00 +000087 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 Grey4e230892024-02-13 22:58:46 +000093 decoration = {
94 rounding = 7;
Skyler Greyabaa6072024-02-15 19:07:00 +000095 drop_shadow = false;
Skyler Grey4e230892024-02-13 22:58:46 +000096 };
Skyler Greya0da6b22024-02-11 22:53:41 +000097
Skyler Grey4e230892024-02-13 22:58:46 +000098 input = {
Skyler Grey71b81982024-02-15 18:06:36 +000099 kb_layout = config.chimera.input.keyboard.layout;
Skyler Greyec50d242024-02-15 23:09:46 +0000100 kb_variant =
101 lib.mkIf (config.chimera.input.keyboard.variant != null)
102 config.chimera.input.keyboard.variant;
Skyler Grey5e344982024-02-15 18:59:45 +0000103 natural_scroll = config.chimera.input.mouse.scrolling.natural;
104
105 numlock_by_default = true;
Skyler Greya0da6b22024-02-11 22:53:41 +0000106
Skyler Grey4e230892024-02-13 22:58:46 +0000107 touchpad = {
Skyler Grey5e344982024-02-15 18:59:45 +0000108 natural_scroll = config.chimera.input.touchpad.scrolling.natural;
Skyler Grey4e230892024-02-13 22:58:46 +0000109 };
110 };
Skyler Greya0da6b22024-02-11 22:53:41 +0000111
Skyler Grey4e230892024-02-13 22:58:46 +0000112 xwayland = {
113 force_zero_scaling = true;
114 };
Skyler Greya0da6b22024-02-11 22:53:41 +0000115
Skyler Grey4e230892024-02-13 22:58:46 +0000116 dwindle = {
117 pseudotile = true;
118 smart_split = true;
119 };
120
121 master = {
122 allow_small_split = true;
123 new_is_master = true;
124 };
125
126 windowrulev2 = [ "opacity 1.0 0.85,title:(.*)" ];
127
128 bind =
129 [
130 "${mod}, Q, killactive"
131 "${mod}, SPACE, togglefloating"
132 "${mod}, RETURN, exec, ${terminal}"
133 "${mod}, down, movefocus, d"
134 "${mod}, up, movefocus, u"
135 "${mod}, right, movefocus, r"
136 "${mod}, left, movefocus, l"
137 "${mod}, L, exec, ${lock}"
138 "${mod}, D, exec, ${menu}"
Skyler Greya0da6b22024-02-11 22:53:41 +0000139 ]
Skyler Grey4e230892024-02-13 22:58:46 +0000140 ++ (builtins.concatLists (
141 builtins.genList
142 (
143 x:
144 let
145 ws =
146 let
147 c = (x + 1) / 10;
148 in
149 builtins.toString (x + 1 - (c * 10));
150 in
151 [
152 "${mod}, ${ws}, workspace, ${toString (x + 1)}"
153 "${mod} SHIFT, ${ws}, movetoworkspace, ${toString (x + 1)}"
154 ]
155 )
156 10
157 ));
Skyler Greya0da6b22024-02-11 22:53:41 +0000158
Skyler Grey4e230892024-02-13 22:58:46 +0000159 bindm = [
160 "${mod}, mouse:272, movewindow"
161 "${mod}, mouse:273, resizewindow"
162 ];
163 };
Skyler Greya0da6b22024-02-11 22:53:41 +0000164 };
165 };
Skyler Grey4e230892024-02-13 22:58:46 +0000166}