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