blob: 38d40cda99c0ea97ef412d81e94b44df0e494544 [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{
13 options.chimera.hyprland = {
14 enable = lib.mkEnableOption "Use hyprland as your window manager";
15
16 monitors = lib.mkOption {
17 type = lib.types.listOf lib.types.str;
18 description = "List of default monitors to set";
19 default = [ ];
20 };
21 };
22
23 /* general = {
24 gaps_in = 5;
25 gaps_out = 20;
26
27 border_size = 1;
28 "col.active_border" = "rgba(71AEF5EE)";
29 "col.inactive_border" = "rgba(C4C4C4EE)";
30
31 layout = "dwindle";
32 };
33
34 dwindle = {
35 pseudotile = true;
36 smart_split = true;
37 };
38
39 master = {
40 allow_small_split = true;
41 new_is_master = true;
42 };
43
44 decoration = {
45 rounding = 7;
46
47 drop_shadow = true;
48 shadow_range = 4;
49 shadow_render_power = 3;
50 "col.shadow" = "rgba(1a1a1aee)";
51 };
52 */
Skyler Greya0da6b22024-02-11 22:53:41 +000053
54 # TODO: Eww, SwayNC, hyprland-per-window-layout, waylock, hy3, anyrun, hypr-empty
55
Skyler Grey4e230892024-02-13 22:58:46 +000056 config = lib.mkIf config.chimera.hyprland.enable {
57 home.packages = [ pkgs.hyprpicker ];
Skyler Greya0da6b22024-02-11 22:53:41 +000058
Skyler Grey4e230892024-02-13 22:58:46 +000059 services.fusuma.settings.swipe = lib.mkIf config.chimera.touchpad.enable (
60 let
61 hyprctl = "${config.wayland.windowManager.hyprland.package}/bin/hyprctl";
62 jq = "${pkgs.jq}/bin/jq";
63 awk = "${pkgs.gawk}/bin/awk";
64 in
65 {
66 "3".up.command = "${hyprctl} dispatch fullscreen 0";
67 "3".down.command = "${hyprctl} dispatch fullscreen 0";
68 "4".down.command = lock;
69 "3".left.command = "${hyprctl} dispatch workspace $(${hyprctl} activeworkspace -j | ${jq} .id | ${awk} '{print $1+1}')";
70 "3".right.command = "${hyprctl} dispatch workspace $(${hyprctl} activeworkspace -j | ${jq} .id | ${awk} '{print $1-1}')";
71 }
72 );
Skyler Greya0da6b22024-02-11 22:53:41 +000073
Skyler Grey4e230892024-02-13 22:58:46 +000074 wayland.windowManager.hyprland = {
75 enable = true;
Skyler Greya0da6b22024-02-11 22:53:41 +000076
Skyler Grey4e230892024-02-13 22:58:46 +000077 xwayland.enable = true;
78 systemd.enable = true;
Skyler Greya0da6b22024-02-11 22:53:41 +000079
Skyler Grey4e230892024-02-13 22:58:46 +000080 settings =
81 let
82 mod = "SUPER";
83 terminal = "${pkgs.kitty}/bin/kitty";
84 menu = "${inputs.anyrun.packages.${system}.anyrun}/bin/anyrun";
85 in
86 {
87 misc = {
88 disable_hyprland_logo = true;
89 disable_splash_rendering = true;
90 };
Skyler Greya0da6b22024-02-11 22:53:41 +000091
Samuel Shuert02ffd1e2024-02-13 21:37:15 -050092 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 +000093
Skyler Grey4e230892024-02-13 22:58:46 +000094 monitor = config.chimera.hyprland.monitors ++ [ ",preferred,auto,1" ];
Skyler Greya0da6b22024-02-11 22:53:41 +000095
Skyler Grey4e230892024-02-13 22:58:46 +000096 decoration = {
97 rounding = 7;
98 };
Skyler Greya0da6b22024-02-11 22:53:41 +000099
Skyler Grey4e230892024-02-13 22:58:46 +0000100 input = {
101 kb_layout = "us";
102 kb_variant = "dvorak";
103 natural_scroll = true;
Skyler Greya0da6b22024-02-11 22:53:41 +0000104
Skyler Grey4e230892024-02-13 22:58:46 +0000105 touchpad = {
106 natural_scroll = true;
107 };
108 };
Skyler Greya0da6b22024-02-11 22:53:41 +0000109
Skyler Grey4e230892024-02-13 22:58:46 +0000110 xwayland = {
111 force_zero_scaling = true;
112 };
Skyler Greya0da6b22024-02-11 22:53:41 +0000113
Skyler Grey4e230892024-02-13 22:58:46 +0000114 dwindle = {
115 pseudotile = true;
116 smart_split = true;
117 };
118
119 master = {
120 allow_small_split = true;
121 new_is_master = true;
122 };
123
124 windowrulev2 = [ "opacity 1.0 0.85,title:(.*)" ];
125
126 bind =
127 [
128 "${mod}, Q, killactive"
129 "${mod}, SPACE, togglefloating"
130 "${mod}, RETURN, exec, ${terminal}"
131 "${mod}, down, movefocus, d"
132 "${mod}, up, movefocus, u"
133 "${mod}, right, movefocus, r"
134 "${mod}, left, movefocus, l"
135 "${mod}, L, exec, ${lock}"
136 "${mod}, D, exec, ${menu}"
Skyler Greya0da6b22024-02-11 22:53:41 +0000137 ]
Skyler Grey4e230892024-02-13 22:58:46 +0000138 ++ (builtins.concatLists (
139 builtins.genList
140 (
141 x:
142 let
143 ws =
144 let
145 c = (x + 1) / 10;
146 in
147 builtins.toString (x + 1 - (c * 10));
148 in
149 [
150 "${mod}, ${ws}, workspace, ${toString (x + 1)}"
151 "${mod} SHIFT, ${ws}, movetoworkspace, ${toString (x + 1)}"
152 ]
153 )
154 10
155 ));
Skyler Greya0da6b22024-02-11 22:53:41 +0000156
Skyler Grey4e230892024-02-13 22:58:46 +0000157 bindm = [
158 "${mod}, mouse:272, movewindow"
159 "${mod}, mouse:273, resizewindow"
160 ];
161 };
Skyler Greya0da6b22024-02-11 22:53:41 +0000162 };
163 };
Skyler Grey4e230892024-02-13 22:58:46 +0000164}