blob: 3e2e780b2e78d461b6e21aa20320fa733320ff8f [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 {
46 home.packages = [ pkgs.hyprpicker ];
Skyler Greya0da6b22024-02-11 22:53:41 +000047
Skyler Grey4e230892024-02-13 22:58:46 +000048 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 Greya0da6b22024-02-11 22:53:41 +000062
Skyler Grey4e230892024-02-13 22:58:46 +000063 wayland.windowManager.hyprland = {
64 enable = true;
Skyler Greya0da6b22024-02-11 22:53:41 +000065
Skyler Grey4e230892024-02-13 22:58:46 +000066 xwayland.enable = true;
67 systemd.enable = true;
Skyler Greya0da6b22024-02-11 22:53:41 +000068
Skyler Grey4e230892024-02-13 22:58:46 +000069 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 Greya0da6b22024-02-11 22:53:41 +000080
Skyler Greye3e18d32024-02-17 11:33:17 +000081 exec-once = [
82 "${pkgs.hyprpaper}/bin/hyprpaper"
83 "hyprctl setcursor ${config.chimera.theme.cursor.name} ${builtins.toString config.chimera.theme.cursor.size}"
84 ];
Skyler Greya0da6b22024-02-11 22:53:41 +000085
Skyler Grey4e230892024-02-13 22:58:46 +000086 monitor = config.chimera.hyprland.monitors ++ [ ",preferred,auto,1" ];
Skyler Greya0da6b22024-02-11 22:53:41 +000087
Skyler Greyabaa6072024-02-15 19:07:00 +000088 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 Grey4e230892024-02-13 22:58:46 +000094 decoration = {
95 rounding = 7;
Skyler Greyabaa6072024-02-15 19:07:00 +000096 drop_shadow = false;
Skyler Grey4e230892024-02-13 22:58:46 +000097 };
Skyler Greya0da6b22024-02-11 22:53:41 +000098
Skyler Grey4e230892024-02-13 22:58:46 +000099 input = {
Skyler Grey71b81982024-02-15 18:06:36 +0000100 kb_layout = config.chimera.input.keyboard.layout;
Skyler Greyec50d242024-02-15 23:09:46 +0000101 kb_variant =
102 lib.mkIf (config.chimera.input.keyboard.variant != null)
103 config.chimera.input.keyboard.variant;
Skyler Grey5e344982024-02-15 18:59:45 +0000104 natural_scroll = config.chimera.input.mouse.scrolling.natural;
105
106 numlock_by_default = true;
Skyler Greya0da6b22024-02-11 22:53:41 +0000107
Skyler Grey4e230892024-02-13 22:58:46 +0000108 touchpad = {
Skyler Grey5e344982024-02-15 18:59:45 +0000109 natural_scroll = config.chimera.input.touchpad.scrolling.natural;
Skyler Grey4e230892024-02-13 22:58:46 +0000110 };
111 };
Skyler Greya0da6b22024-02-11 22:53:41 +0000112
Skyler Grey4e230892024-02-13 22:58:46 +0000113 xwayland = {
114 force_zero_scaling = true;
115 };
Skyler Greya0da6b22024-02-11 22:53:41 +0000116
Skyler Grey4e230892024-02-13 22:58:46 +0000117 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 Greya0da6b22024-02-11 22:53:41 +0000140 ]
Skyler Grey4e230892024-02-13 22:58:46 +0000141 ++ (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 Greya0da6b22024-02-11 22:53:41 +0000159
Skyler Grey4e230892024-02-13 22:58:46 +0000160 bindm = [
161 "${mod}, mouse:272, movewindow"
162 "${mod}, mouse:273, resizewindow"
163 ];
164 };
Skyler Greya0da6b22024-02-11 22:53:41 +0000165 };
166 };
Skyler Grey4e230892024-02-13 22:58:46 +0000167}