summaryrefslogtreecommitdiff
path: root/accounts/gkleen@sif/hyprland.nix
diff options
context:
space:
mode:
Diffstat (limited to 'accounts/gkleen@sif/hyprland.nix')
-rw-r--r--accounts/gkleen@sif/hyprland.nix425
1 files changed, 0 insertions, 425 deletions
diff --git a/accounts/gkleen@sif/hyprland.nix b/accounts/gkleen@sif/hyprland.nix
deleted file mode 100644
index 90ae689a..00000000
--- a/accounts/gkleen@sif/hyprland.nix
+++ /dev/null
@@ -1,425 +0,0 @@
1{ pkgs, lib, config, userName, ... }:
2let
3 cfg = config.home-manager.users.${userName};
4in {
5 monitor = [
6 ",preferred,auto,auto,bitdepth,8"
7 "eDP-1,3840x2160@60,auto,1.5,bitdepth,8"
8 ];
9
10 "$terminal" = "kitty";
11 "$menu" = "fuzzel";
12
13 env = [
14 "NIXOS_OZONE_WL,1"
15 "QT_QPA_PLATFORM,wayland"
16 "QT_WAYLAND_DISABLE_WINDOWDECORATION,1"
17 "GDK_BACKEND,wayland"
18 "GDK_SCALE,0.66"
19 "QT_AUTO_SCREEN_SCALE_FACTOR,1"
20 "SDL_VIDEODRIVER,wayland"
21 # "AQ_DRM_DEVICES,/dev/dri/by-path/pci-0000:01:00.0-card"
22 "__NV_PRIME_RENDER_OFFLOAD,1"
23 "__NV_PRIME_RENDER_OFFLOAD_PROVIDER,NVIDIA-G0"
24 "__GLX_VENDOR_LIBRARY_NAME,nvidia"
25 "__VK_LAYER_NV_optimus,NVIDIA_only"
26 ];
27
28 xwayland.force_zero_scaling = true;
29
30 general = {
31 gaps_in = 3;
32 gaps_out = 9;
33 "col.active_border" = "rgba(33ccffee) rgba(00ff95ee) 45deg";
34 "col.inactive_border" = "rgba(595959aa)";
35
36 resize_on_border = false;
37
38 allow_tearing = false;
39
40 layout = "dwindle";
41 };
42
43 decoration = {
44 rounding = 5;
45 dim_special = 0.0;
46 };
47
48 animations = {
49 enabled = true;
50 bezier = "myBezier, 0.05, 0.9, 0.1, 1.05";
51 animation = [
52 "windows, 1, 1, default, popin 80%"
53 "windowsMove, 0"
54 # "windows, 1, 7, myBezier"
55 # "windowsOut, 1, 7, myBezier, popin 80%"
56 "border, 1, 10, default"
57 "borderangle, 1, 8, default"
58 "fade, 1, 1, default"
59 "workspaces, 1, 1, default, fade"
60 # "workspaces, 1, 6, default"
61 ];
62 };
63
64 dwindle = {
65 pseudotile = false;
66 preserve_split = true;
67 };
68
69 master = {
70 new_status = "master";
71 };
72
73 misc = {
74 disable_hyprland_logo = true;
75 disable_splash_rendering = true;
76 # focus_on_activate = true;
77 mouse_move_enables_dpms = true;
78 key_press_enables_dpms = true;
79 new_window_takes_over_fullscreen = 1;
80 exit_window_retains_fullscreen = true;
81 };
82
83 cursor = {
84 use_cpu_buffer = true;
85 hide_on_key_press = true;
86 # no_hardware_cursors = 0;
87 };
88
89 input = {
90 kb_layout = "us,us";
91 kb_variant = "dvp,";
92 kb_model = "";
93 kb_options = "compose:caps,grp:win_space_toggle";
94 kb_rules = "";
95
96 follow_mouse = 1;
97
98 sensitivity = 0;
99
100 touchpad = {
101 natural_scroll = false;
102 };
103 };
104
105 device = [
106 { name = "synaptics-tm3512-010";
107 sensitivity = 0.4;
108 }
109 { name = "tpps/2-elan-trackpoint";
110 sensitivity = 0.2;
111 }
112 { name = "logitech-ergo-m575";
113 sensitivity = 1.333;
114 }
115 ];
116
117 gestures = {
118 workspace_swipe = false;
119 };
120
121 dwindle = {
122 # no_gaps_when_only = 1;
123 };
124
125 "$mainMod" = "SUPER";
126
127 bind = [
128 "$mainMod, return, exec, $terminal"
129 "$mainMod, Q, killactive"
130 "$mainMod SHIFT, Q, exec, hyprctl kill"
131 "$mainMod, V, togglefloating"
132 "$mainMod, D, exec, $menu"
133 "$mainMod SHIFT, D, exec, $menu --list-executables-in-path"
134 # "$mainMod, J, togglesplit,"
135
136 "$mainMod SHIFT, L, exec, loginctl lock-session"
137 "$mainMod SHIFT, E, exit"
138
139 "$mainMod, left, movefocus, l"
140 "$mainMod, right, movefocus, r"
141 "$mainMod, up, movefocus, u"
142 "$mainMod, down, movefocus, d"
143 "$mainMod SHIFT, left, swapwindow, l"
144 "$mainMod SHIFT, right, swapwindow, r"
145 "$mainMod SHIFT, up, swapwindow, u"
146 "$mainMod SHIFT, down, swapwindow, d"
147
148 "$mainMod, N, cyclenext, tiled"
149 "$mainMod, T, cyclenext, prev tiled"
150 "$mainMod SHIFT, N, swapnext"
151 "$mainMod SHIFT, T, swapnext, prev"
152
153 "$mainMod, G, focusmonitor, 0"
154 "$mainMod, C, focusmonitor, 1"
155 "$mainMod, R, focusmonitor, 2"
156 "$mainMod, L, focusmonitor, 3"
157
158 "$mainMod CTRL, G, movecurrentworkspacetomonitor, 0"
159 "$mainMod CTRL, C, movecurrentworkspacetomonitor, 1"
160 "$mainMod CTRL, R, movecurrentworkspacetomonitor, 2"
161 "$mainMod CTRL, L, movecurrentworkspacetomonitor, 3"
162
163 "$mainMod, F, fullscreen, 1"
164 "$mainMod SHIFT, F, fullscreen, 0"
165 "$mainMod CTRL SHIFT, F, fullscreenstate, 1, 2"
166
167 "$mainMod, code:14, workspace, 1"
168 "$mainMod, code:17, workspace, 2"
169 "$mainMod, code:13, workspace, 3"
170 "$mainMod, code:18, workspace, 4"
171 "$mainMod, code:12, workspace, 5"
172 "$mainMod, code:19, workspace, 6"
173 "$mainMod, code:11, workspace, 7"
174 "$mainMod, code:20, workspace, 8"
175 "$mainMod, code:15, workspace, 9"
176 "$mainMod, code:16, workspace, 10"
177
178 "$mainMod SHIFT, code:14, movetoworkspacesilent, 1"
179 "$mainMod SHIFT, code:17, movetoworkspacesilent, 2"
180 "$mainMod SHIFT, code:13, movetoworkspacesilent, 3"
181 "$mainMod SHIFT, code:18, movetoworkspacesilent, 4"
182 "$mainMod SHIFT, code:12, movetoworkspacesilent, 5"
183 "$mainMod SHIFT, code:19, movetoworkspacesilent, 6"
184 "$mainMod SHIFT, code:11, movetoworkspacesilent, 7"
185 "$mainMod SHIFT, code:20, movetoworkspacesilent, 8"
186 "$mainMod SHIFT, code:15, movetoworkspacesilent, 9"
187 "$mainMod SHIFT, code:16, movetoworkspacesilent, 10"
188
189 "$mainMod, semicolon, exec, dunstctl close"
190 "$mainMod SHIFT, semicolon, exec, dunstctl close-all"
191 "$mainMod, period, exec, dunstctl context"
192 "$mainMod, comma, exec, dunstctl history-pop"
193
194 "$mainMod ALT, E, exec, emacsclient -c"
195 "$mainMod ALT, Y, exec, ${pkgs.writeShellScript "yt-dlp" ''
196 export PATH="${lib.makeBinPath (with pkgs; [ wl-clipboard-rs socat ])}:$PATH"
197 socat STDIO UNIX-CONNECT:"$XDG_RUNTIME_DIR"/yt-dlp.sock <<<$'{ "urls": ["'"$(wl-paste)"$'"] }'
198 ''}"
199 "$mainMod ALT, L, exec, ${pkgs.writeShellScript "mpv" ''
200 export PATH="${lib.makeBinPath (with pkgs; [ wl-clipboard-rs ])}:$PATH"
201 exec mpv "$(wl-paste)"
202 ''}"
203
204 ", Print, exec, ${pkgs.writeShellScript "screenshot" ''
205 export PATH="${lib.makeBinPath (with pkgs; [ grim slurp wl-clipboard-rs coreutils ])}:$PATH"
206
207 outFile="$HOME/screenshots/$(date +"%Y-%m-%dT%H:%M:%S").png"
208 grim -g "$(slurp -b 00000080 -c FFFFFFFF -s 00000000 -w 1)" "$outFile"
209 wl-copy --type image/png <"$outFile"
210 ''}"
211 "SHIFT, Print, exec, ${pkgs.writeShellScript "screenshot" ''
212 export PATH="${lib.makeBinPath (with pkgs; [ grim jq wl-clipboard-rs coreutils ])}:$PATH"
213
214 outFile="$HOME/screenshots/$(date +"%Y-%m-%dT%H:%M:%S").png"
215 grim -o "$(hyprctl monitors -j | jq -r '.[] | select(.focused) | .name')" "$outFile"
216 wl-copy --type image/png <"$outFile"
217 ''}"
218 "CTRL SHIFT, Print, exec, ${pkgs.runCommand "picker" {
219 buildInputs = [ pkgs.makeWrapper ];
220 } ''
221 makeWrapper ${lib.getExe pkgs.hyprpicker} $out \
222 --prefix PATH : ${lib.makeBinPath [pkgs.wl-clipboard-rs]}
223 ''} -a"
224 "$mainMod, M, exec, ${pkgs.writeShellScript "qalc-fuzzel" ''
225 export PATH="${lib.makeBinPath (with pkgs; [ wl-clipboard-rs libqalculate cfg.programs.fuzzel.package coreutils findutils libnotify gnugrep ])}:$PATH"
226
227 RESULTS_DIR="$HOME/.cache/qalc-fuzzel"
228 prev() {
229 FOUND=false
230 while IFS= read -r line; do
231 [[ -n "$line" ]] || continue
232 FOUND=true
233 echo $line
234 done < <(export LC_ALL=C.UTF-8; echo; find "$RESULTS_DIR" -type f -printf $'%T@ %p\n' | sort -n | cut -d' ' -f2- | xargs -r cat)
235 $FOUND || echo
236 }
237 FUZZEL_RES=$(prev | fuzzel --dmenu --prompt "qalc> ") || exit $?
238 if [[ "$FUZZEL_RES" =~ .*\ =\ .* ]]; then
239 QALC_RES="$FUZZEL_RES"
240 QALC_RET=0
241 else
242 QALC_RES=$(qalc "$FUZZEL_RES" 2>&1)
243 QALC_RET=$?
244 fi
245 [[ -n "$QALC_RES" ]] || exit 1
246 EXISTING=false
247 fgrep -xrl "$QALC_RES" "$RESULTS_DIR" | xargs -r touch
248 [[ ''${PIPESTATUS[0]} -eq 0 ]] && EXISTING=true
249 if [[ $QALC_RET -eq 0 ]] && ! $EXISTING; then
250 RES_FILE="$RESULTS_DIR"/$(date -uIs).$(tr -Cd 'a-zA-Z0-9' </dev/random | head -c 10)
251 cat >"$RES_FILE" <<<"$QALC_RES"
252 fi
253 [[ "$QALC_RES" =~ .*\ =\ (.*) ]] && QALC_RES="''${BASH_REMATCH[1]}"
254 [[ $QALC_RET -eq 0 ]] && wl-copy "$QALC_RES"
255 notify-send "$QALC_RES"
256 ''}"
257 "$mainMod, E, exec, ${pkgs.writeShellScript "emoji-fuzzel" ''
258 export PATH="${lib.makeBinPath (with pkgs; [ cfg.programs.fuzzel.package wtype wl-clipboard-rs ])}:$PATH"
259
260 FUZZEL_RES=$(fuzzel --dmenu --prompt "emoji> " <$HOME/.local/share/emoji-data/list.txt) || exit $?
261 [[ -n "$FUZZEL_RES" ]] || exit 1
262 wl-copy "$(cut -d ':' -f 1 <<<"$FUZZEL_RES" | tr -d '\n')" && wtype -k XF86Paste
263 ''}"
264 "$mainMod, B, exec, ${pkgs.writeShellScript "bring" ''
265 export PATH="${lib.makeBinPath (with pkgs; [ cfg.programs.fuzzel.package gawk gojq cfg.wayland.windowManager.hyprland.package ])}:$PATH"
266
267 state="$(hyprctl -j clients)"
268 active_window="$(hyprctl -j activewindow)"
269 active_workspace="$(hyprctl -j activeworkspace | gojq -r '.id')"
270
271 current_addr="$(echo "$active_window" | gojq -r '.address')"
272
273 window="$(echo "$state" |
274 gojq -r '.[] | select(.workspace.id == '"$active_workspace"') | select(.monitor != -1 ) | "\(.title)\t\(.address)"' |
275 fuzzel --log-level=warning --dmenu)"
276
277 addr="$(echo "$window" | awk -F $'\t' '{print $2}')"
278
279 if [[ "$addr" = "$current_addr" ]]; then
280 exit 0
281 fi
282
283 fullscreen_on_same_ws="$(echo "$state" | gojq -r '.[] | select(.fullscreen == true) | select(.workspace.id == '"$active_workspace"') | .address')"
284
285 if [[ "$window" != "" ]]; then
286 if [[ "$fullscreen_on_same_ws" == "" ]]; then
287 hyprctl dispatch focuswindow address:"''${addr}"
288 else
289 # If we want to focus app_A and app_B is fullscreen on the same workspace,
290 # app_A will get focus, but app_B will remain on top.
291 # This monstrosity is to make sure app_A will end up on top instead.
292 # XXX: doesn't handle fullscreen 0, but I don't care.
293 hyprctl --batch "dispatch focuswindow address:''${fullscreen_on_same_ws}; dispatch fullscreen 1; dispatch focuswindow address:''${addr}; dispatch fullscreen 1"
294 fi
295 fi
296 ''}"
297 "$mainMod SHIFT, B, exec, ${pkgs.writeShellScript "bring" ''
298 export PATH="${lib.makeBinPath (with pkgs; [ cfg.programs.fuzzel.package gawk gojq cfg.wayland.windowManager.hyprland.package ])}:$PATH"
299
300 state="$(hyprctl -j clients)"
301 active_window="$(hyprctl -j activewindow)"
302
303 current_addr="$(echo "$active_window" | gojq -r '.address')"
304
305 window="$(echo "$state" |
306 gojq -r '.[] | select(.monitor != -1 ) | "\(.title)\t\(.workspace.name)\t\(.address)"' |
307 fuzzel --log-level=warning --dmenu)"
308
309 addr="$(echo "$window" | awk -F $'\t' '{print $3}')"
310 ws="$(echo "$window" | awk -F $'\t' '{print $2}')"
311
312 if [[ "$addr" = "$current_addr" ]]; then
313 exit 0
314 fi
315
316 fullscreen_on_same_ws="$(echo "$state" | gojq -r ".[] | select(.fullscreen == true) | select(.workspace.name == \"$ws\") | .address")"
317
318 if [[ "$window" != "" ]]; then
319 if [[ "$fullscreen_on_same_ws" == "" ]]; then
320 hyprctl dispatch focuswindow address:"''${addr}"
321 else
322 # If we want to focus app_A and app_B is fullscreen on the same workspace,
323 # app_A will get focus, but app_B will remain on top.
324 # This monstrosity is to make sure app_A will end up on top instead.
325 # XXX: doesn't handle fullscreen 0, but I don't care.
326 hyprctl --batch "dispatch focuswindow address:''${fullscreen_on_same_ws}; dispatch fullscreen 1; dispatch focuswindow address:''${addr}; dispatch fullscreen 1"
327 fi
328 fi
329 ''}"
330
331 "$mainMod CTRL, return, togglespecialworkspace, term"
332 "$mainMod CTRL, e, togglespecialworkspace, edit"
333 "$mainMod CTRL, a, togglespecialworkspace, pwvucontrol"
334 "$mainMod CTRL, o, togglespecialworkspace, easyeffects"
335 "$mainMod CTRL, b, togglespecialworkspace, blueman"
336 "$mainMod CTRL, p, togglespecialworkspace, keepass"
337 ];
338 bindm = [
339 "$mainMod, mouse:272, movewindow"
340 "$mainMod, mouse:273, resizewindow"
341 ];
342 bindel = [
343 ", XF86MonBrightnessUp, exec, lightctl -d -e4 -n1 up"
344 ", XF86MonBrightnessDown, exec, lightctl -d -e4 -n1 down"
345 ", XF86AudioRaiseVolume, exec, volumectl -d -u up"
346 ", XF86AudioLowerVolume, exec, volumectl -d -u down"
347 ];
348 bindl = [
349 ", XF86AudioMute, exec, volumectl -d toggle-mute"
350 ", XF86AudioMicMute, exec, volumectl -d -m toggle-mute"
351 "$mainMod SHIFT, S, exec, systemctl suspend"
352
353 ", switch:off:Lid Switch,exec,hyprctl dispatch dpms on eDP-1"
354 ", switch:on:Lid Switch,exec,hyprctl dispatch dpms off eDP-1"
355
356 ", switch:off:Lid Switch,exec,${pkgs.writeShellScript "clamshell-off" ''
357 export PATH="${lib.makeBinPath (with pkgs; [ jq ])}:$PATH"
358 [[ $(hyprctl monitors -j | jq '.[] | select(.name == "eDP-1") | .disabled') = "true" ]] || exit 0
359
360 hyprctl keyword monitor "eDP-1,3840x2160@60,auto,1.5"
361 ''}"
362 ", switch:on:Lid Switch,exec,${pkgs.writeShellScript "clamshell-on" ''
363 export PATH="${lib.makeBinPath (with pkgs; [ jq ])}:$PATH"
364
365 [[ $(hyprctl monitors -j | jq 'reduce (.[] | select(.disabled == false)) as $_ (0; .+1)') -gt 1 ]] || exit 0
366
367 hyprctl keyword monitor "eDP-1,disable"
368 ''}"
369 ];
370
371 windowrulev2 = [
372 "suppressevent maximize fullscreen, class:.*"
373
374 # "maximize, class:^(Element|thunderbird)$"
375 "workspace special:pwvucontrol, class:^com\.saivert\.pwvucontrol$"
376 "workspace special:easyeffects, class:^com\.github\.wwmm\.easyeffects$"
377 "workspace special:blueman, class:^\.blueman-manager-wrapped$"
378 "workspace special:keepass silent, class:^org\.keepassxc\.KeePassXC$, title:^(?!Unlock Database.*)(?!.*(Access Request|Passkey credentials)).*$"
379 # "group set always lock invade, class:^Element$"
380 "workspace 2, class:^firefox$"
381 "workspace 4, class:^evince$"
382 "workspace 4, class:^imv$"
383 "workspace 4, class:^org\.pwmt\.zathura$"
384 "workspace 10, class:^mpv$"
385 "workspace 1, class:^Element$"
386 "workspace 1, class:^thunderbird$"
387 "workspace 5, class:^virt-manager$"
388 "workspace 5, class:^qemu$"
389 "float, class:^org\.keepassxc\.KeePassXC$, title:^.*Access Request$"
390 "center, class:^org\.keepassxc\.KeePassXC$, title:^.*Access Request$"
391 "float, class:^org\.keepassxc\.KeePassXC$, title:^.*Passkey credentials$"
392 "center, class:^org\.keepassxc\.KeePassXC$, title:^.*Passkey credentials$"
393 "float, class:^org\.keepassxc\.KeePassXC$, title:^Unlock Database.*$"
394 "center, class:^org\.keepassxc\.KeePassXC$, title:^Unlock Database.*$"
395 "float, class:^xdg-desktop-portal-gtk$"
396 "center, class:^xdg-desktop-portal-gtk$"
397
398 "bordercolor rgba(ffaa33ee) rgba(bfff00ee) 45deg, fullscreen:1"
399 "bordercolor rgba(3366ffee) rgba(6a00ffee) 45deg, xwayland:1"
400 "bordercolor rgba(6633ffee) rgba(ea00ffee) 45deg, xwayland:1, fullscreen:1"
401 ];
402
403 workspace = [
404 "s[true], gapsout:100"
405
406 "special:term, on-created-empty:kitty"
407 "special:edit, on-created-empty:emacsclient -c"
408 "special:pwvucontrol, on-created-empty:pwvucontrol"
409 "special:easyeffects, on-created-empty:easyeffects"
410 "special:blueman, on-created-empty:blueman-manager"
411 "special:keepass, on-created-empty:keepassxc"
412
413 "1, defaultName:comm"
414 "2, defaultName:web"
415 "3, defaultName:work"
416 "4, defaultName:read"
417 ];
418
419 layerrule = [
420 "blur, waybar"
421 "blur, launcher"
422 "noanim, notifications"
423 "blur, notifications"
424 ];
425}