blob: b1263d83c067af940e29fa561b6818f526bb6430 [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 Grey4e230892024-02-13 22:58:46 +000087 decoration = {
88 rounding = 7;
89 };
Skyler Greya0da6b22024-02-11 22:53:41 +000090
Skyler Grey4e230892024-02-13 22:58:46 +000091 input = {
Skyler Grey71b81982024-02-15 18:06:36 +000092 kb_layout = config.chimera.input.keyboard.layout;
93 kb_variant = lib.mkIf (config.chimera.input.keyboard.variant != null) config.chimera.input.keyboard.variant;
Skyler Grey5e344982024-02-15 18:59:45 +000094 natural_scroll = config.chimera.input.mouse.scrolling.natural;
95
96 numlock_by_default = true;
Skyler Greya0da6b22024-02-11 22:53:41 +000097
Skyler Grey4e230892024-02-13 22:58:46 +000098 touchpad = {
Skyler Grey5e344982024-02-15 18:59:45 +000099 natural_scroll = config.chimera.input.touchpad.scrolling.natural;
Skyler Grey4e230892024-02-13 22:58:46 +0000100 };
101 };
Skyler Greya0da6b22024-02-11 22:53:41 +0000102
Skyler Grey4e230892024-02-13 22:58:46 +0000103 xwayland = {
104 force_zero_scaling = true;
105 };
Skyler Greya0da6b22024-02-11 22:53:41 +0000106
Skyler Grey4e230892024-02-13 22:58:46 +0000107 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 Greya0da6b22024-02-11 22:53:41 +0000130 ]
Skyler Grey4e230892024-02-13 22:58:46 +0000131 ++ (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 Greya0da6b22024-02-11 22:53:41 +0000149
Skyler Grey4e230892024-02-13 22:58:46 +0000150 bindm = [
151 "${mod}, mouse:272, movewindow"
152 "${mod}, mouse:273, resizewindow"
153 ];
154 };
Skyler Greya0da6b22024-02-11 22:53:41 +0000155 };
156 };
Skyler Grey4e230892024-02-13 22:58:46 +0000157}