Kieran's opinionated (and probably slightly dumb) nix config
1# <https://wiki.hyprland.org/Configuring/Window-Rules/#window-rules-v2>
2{ lib, ... }:
3let
4 # I recommend using this factory function for creating window rules.
5 rule = rules: attrs: attrs // { inherit rules; };
6in {
7 wayland.windowManager.hyprland.layerRules = [{
8 namespace = [ "rofi" "notification" ];
9 rules = [ "blur" "ignorezero" ];
10 }];
11
12 wayland.windowManager.hyprland.windowRules = let
13 ### SYSTEM CONTROL ###
14 printerConfig.class = [ "system-config-printer" ];
15 audioControl.class = [ "pavucontrol-qt" ];
16 wifiControl.class = [ "org.twosheds.iwgtk" "iwgtk" ];
17 bluetoothControl = {
18 class = [ ".*blueman-manager.*" ];
19 title = [ "Bluetooth Devices" ];
20 };
21 kvantumConfig.class = [ "kvantummanager" ];
22
23 ### SYSTEM MODALS ###
24 filePickerPortal = {
25 # I'm guessing that almost all portal interfaces are going to be modals
26 class =
27 [ "xdg-desktop-portal-gtk" "org.freedesktop.impl.portal.desktop.kde" ];
28 # title = ["Open Files.+Portal"];
29 };
30 polkitAgent.class = [ "lxqt-policykit-agent" ];
31 mountDialog.class = [ "udiskie" ];
32
33 ### DESKTOP APPLICATIONS ###
34 vscode = {
35 title = [ ".*Visual Studio Code" ];
36 # class = ["code-url-handler"];
37 };
38 discord = {
39 class = [ "vesktop" "ArmCord" "WebCord" "discord" ];
40 title = [
41 "(\\[\\d+\\] )?Discord |.*"
42 ".*ArmCord"
43 "(\\[\\d+\\] )?WebCord.*"
44 ".*Discord"
45 ];
46 };
47 tidal.class = [ "tidal-hifi" ];
48 calculator.class = [ "qalculate-gtk" ];
49 # obsStudio = {
50 # class = [ "com.obsproject.Studio" ];
51 # title = [ "OBS\\s[\\d\\.]+.*" ];
52 # };
53 steam = {
54 class = [ "Steam" ];
55 # title = ["Steam"];
56 };
57 minecraft = {
58 class = [ "Minecraft.+" ];
59 title = [ "Minecraft.+" ];
60 };
61 virtManagerConsole = {
62 class = [ "virt-manager" ];
63 title = [ ".+on.+" ];
64 };
65
66 ### DESKTOP APPLICATION MODALS ###
67 discordModal = {
68 class = [ "WebCord" ];
69 title = [ "WebCord.+Settings" ];
70 };
71 tidalModal = {
72 class = [ "tidal-hifi" ];
73 title = [ "Tidal Hi-Fi settings" ];
74 };
75 keePassModal = {
76 class = [ "org.keepassxc.KeePassXC" ];
77 title = [
78 "Unlock Database.+KeePassXC"
79 "Generate Password"
80 "KeePassXC.+Browser Access Request"
81 ];
82 };
83 firefoxModal = {
84 class = [ "firefox" ];
85 title = [ "Extension.+Mozilla Firefox.*" "Picture-in-Picture" ];
86 };
87 lxImageModal = {
88 class = [ "lximage-qt" ];
89 title = [ "Print" ];
90 };
91 fileZillaModal = {
92 class = [ "filezilla" ];
93 title = [ "Site Manager" ];
94 };
95 in lib.concatLists [
96 [
97 (rule [ "size 740 460" ] filePickerPortal)
98 (rule [ "size 950 700" ] kvantumConfig)
99 ]
100 # Because it can be shown and hidden with a systray icon.
101 (map (rule [ "float" "pin" "move 10% 10%" "size 80% 80%" ]) [ tidal ])
102 #
103 (map (rule [ "idleinhibit focus" ]) [ minecraft virtManagerConsole ])
104 (map (rule [ "float" ]) [
105 kvantumConfig
106 keePassModal
107 lxImageModal
108 firefoxModal
109 fileZillaModal
110 discordModal
111 tidalModal
112 ])
113 # Barely translucent
114 (map (rule [ "opacity 0.97 0.97" ]) [ ])
115 (map (rule [ "opacity 0.97 0.97" "float" ]) [
116 printerConfig
117 audioControl
118 bluetoothControl
119 polkitAgent
120 mountDialog
121 ])
122 # More translucent
123 (map (rule [ "opacity 0.92 0.92" ]) [ vscode steam tidal discord ])
124 (map (rule [ "opacity 0.92 0.92" "float" ]) [
125 filePickerPortal
126 wifiControl
127 ])
128 # Super translucent
129 (map (rule [ "opacity 0.87 0.87" ]) [ ])
130 (map (rule [ "opacity 0.87 0.87" "float" ]) [ calculator ])
131 ];
132}