dotfiles
My PC Dotfiles & Websitegit clone https://github.com/maydayv7/dotfiles
modules/desktop/hyprland/_settings/main.nix (8838B)
1## Compositor Settings
2_: {
3 lib,
4 osConfig ? null,
5 ...
6}:
7lib.mkIf (osConfig != null) (
8 let
9 lua = import ./_lib.nix lib;
10 inherit (lua) curve;
11
12 inherit (osConfig.gui) display fancy;
13 inherit (osConfig.lib.stylix.colors) base03 base05 base0D;
14
15 gradient = a: b: {
16 colors = ["rgb(${a})" "rgb(${b})"];
17 angle = 90;
18 };
19 in {
20 gui._unmanaged = ["hyprland"];
21 wayland.windowManager.hyprland = {
22 inherit (osConfig.programs.hyprland) enable package portalPackage;
23
24 # Use 'nwg-displays' to configure monitors
25 extraConfig = ''
26 pcall(require, "monitors")
27 pcall(require, "workspaces")
28 '';
29
30 settings = {
31 # Display
32 monitor = {
33 output = "";
34 mode = "preferred";
35 position = "auto";
36 scale = 1;
37 };
38
39 # Touchpad Gestures
40 gesture = [
41 {
42 fingers = 3;
43 direction = "horizontal";
44 action = "scroll_move";
45 scale = 2;
46 }
47 {
48 fingers = 3;
49 direction = "vertical";
50 action = "workspace";
51 }
52 ];
53
54 # Smart Gaps
55 workspace_rule = [
56 {
57 workspace = "w[tv1]s[false]";
58 gaps_out = 0;
59 gaps_in = 0;
60 }
61 {
62 workspace = "f[1]s[false]";
63 gaps_out = 0;
64 gaps_in = 0;
65 }
66 ];
67 window_rule = [
68 {
69 name = "no-gaps-wtv1";
70 match = {
71 float = false;
72 workspace = "w[tv1]s[false]";
73 };
74 border_size = 0;
75 rounding = 0;
76 }
77 {
78 name = "no-gaps-f1";
79 match = {
80 float = false;
81 workspace = "f[1]s[false]";
82 };
83 border_size = 0;
84 rounding = 0;
85 }
86 ];
87
88 # Custom Animations
89 curve = lib.optionals fancy [
90 (curve "snappy" {
91 type = "bezier";
92 points = [[0.2 1] [0.25 1]];
93 })
94 (curve "overshoot" {
95 type = "bezier";
96 points = [[0.05 0.9] [0.1 1.05]];
97 })
98 (curve "slide" {
99 type = "bezier";
100 points = [[0.25 1] [0.5 1]];
101 })
102 ];
103 animation = lib.optionals fancy [
104 {
105 leaf = "border";
106 enabled = true;
107 speed = 10;
108 bezier = "default";
109 }
110 {
111 leaf = "fade";
112 enabled = true;
113 speed = 2;
114 bezier = "snappy";
115 }
116 {
117 leaf = "fadeLayersIn";
118 enabled = true;
119 speed = 2;
120 bezier = "snappy";
121 }
122 {
123 leaf = "fadeLayersOut";
124 enabled = true;
125 speed = 0.5;
126 bezier = "snappy";
127 }
128 {
129 leaf = "specialWorkspace";
130 enabled = true;
131 speed = 2.5;
132 bezier = "snappy";
133 style = "slidevert";
134 }
135 {
136 leaf = "windows";
137 enabled = true;
138 speed = 2.5;
139 bezier = "overshoot";
140 style = "popin 70%";
141 }
142 {
143 leaf = "windowsIn";
144 enabled = true;
145 speed = 2.5;
146 bezier = "overshoot";
147 style = "popin 70%";
148 }
149 {
150 leaf = "windowsOut";
151 enabled = true;
152 speed = 2;
153 bezier = "snappy";
154 style = "popin 70%";
155 }
156 {
157 leaf = "windowsMove";
158 enabled = true;
159 speed = 2.5;
160 bezier = "slide";
161 }
162 {
163 leaf = "workspaces";
164 enabled = true;
165 speed = 4;
166 bezier = "slide";
167 style = "slidevert";
168 }
169 ];
170
171 config =
172 {
173 xwayland = {
174 enabled = true;
175 force_zero_scaling = true;
176 };
177
178 input = {
179 follow_mouse = 1; # Focus on cursor move
180 follow_mouse_threshold = 15;
181 focus_on_close = 1;
182
183 # Keyboard
184 kb_layout = "us";
185 numlock_by_default = true;
186
187 # Mouse
188 accel_profile = "flat";
189 touchpad = {
190 tap_to_click = true;
191 tap_and_drag = true;
192 natural_scroll = true;
193 disable_while_typing = false;
194 };
195 };
196
197 # Workspace Behaviour
198 binds = {
199 workspace_center_on = 1;
200 movefocus_cycles_fullscreen = true;
201 workspace_back_and_forth = true;
202 drag_threshold = 30;
203 };
204
205 # Touchpad Gestures
206 gestures = {
207 workspace_swipe_use_r = false;
208 workspace_swipe_create_new = true;
209 };
210
211 # Cursor Settings
212 cursor = {
213 default_monitor = display;
214 hide_on_key_press = true;
215 sync_gsettings_theme = true;
216 warp_on_change_workspace = true;
217 };
218
219 # Tiling Layout
220 scrolling = {
221 column_width = 0.5;
222 explicit_column_widths = "0.333, 0.5, 0.667, 1.0";
223 follow_focus = true;
224 fullscreen_on_one_column = true;
225 };
226 dwindle = {
227 preserve_split = true;
228 smart_split = true;
229 };
230
231 misc = {
232 disable_autoreload = true; # Disable configuration Polling
233
234 focus_on_activate = true;
235 initial_workspace_tracking = 1;
236 middle_click_paste = false;
237 on_focus_under_fullscreen = 2;
238
239 # Window Swallowing
240 enable_swallow = true;
241 swallow_regex = "^(kitty)$";
242
243 # Interfere with wallpaper daemons
244 force_default_wallpaper = 0;
245 disable_hyprland_logo = true;
246
247 # Graphics
248 vrr = 1;
249 };
250 render.direct_scanout = 1;
251
252 general = {
253 allow_tearing = !fancy;
254 resize_on_border = true;
255 layout = "scrolling";
256
257 # Floating Layout
258 snap = {
259 enabled = true;
260 border_overlap = true;
261 respect_gaps = true;
262 monitor_gap = 10;
263 window_gap = 15;
264 };
265
266 # Visuals
267 gaps_in = 3;
268 gaps_out = 3;
269 float_gaps = 3;
270 border_size = 2;
271 col.active_border = gradient base0D base05;
272 };
273
274 group = {
275 auto_group = true;
276 insert_after_current = true;
277 drag_into_group = 2;
278 merge_groups_on_drag = true;
279 merge_groups_on_groupbar = true;
280 merge_floated_into_tiled_on_groupbar = false;
281 group_on_movetoworkspace = false;
282 col = {
283 border_active = gradient base05 base0D;
284 border_inactive = gradient base05 base03;
285 };
286
287 groupbar = {
288 enabled = true;
289 scrolling = true;
290 gradients = true;
291 blur = true;
292 height = 15;
293 render_titles = true;
294 font_size = 10;
295 font_weight_active = "bold";
296 keep_upper_gap = false;
297 middle_click_close = true;
298 indicator_height = 0;
299 gradient_rounding = 5;
300 gradient_round_only_edges = false;
301 col = {
302 active = "rgba(${base0D}99)";
303 inactive = "rgb(${base03})";
304 };
305 };
306 };
307
308 debug = {
309 disable_logs = false;
310 error_position = 1;
311 };
312
313 ecosystem = {
314 no_update_news = true;
315 no_donation_nag = true;
316 };
317 }
318 // lib.optionalAttrs fancy {
319 decoration = {
320 rounding = 10;
321 rounding_power = 3.0;
322 dim_special = 0.3;
323
324 shadow = {
325 enabled = true;
326 offset = "0 2";
327 range = 20;
328 };
329
330 blur = {
331 enabled = true;
332 brightness = 1.0;
333 contrast = 1.0;
334 passes = 2;
335 input_methods = true;
336 };
337 };
338 };
339 };
340 };
341 }
342)