Skip to content

Commit

Permalink
refactor(hyprland): extract class/title names in window rules into va…
Browse files Browse the repository at this point in the history
…riables
  • Loading branch information
zakuciael committed Jun 19, 2024
1 parent 9d0c521 commit 98a1a9e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
21 changes: 11 additions & 10 deletions modules/desktop/apps/_1password.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ with lib.my;
with lib.my.utils; let
layout = findLayoutConfig config ({index, ...}: index == 1); # Main monitor
monitor = getLayoutMonitor layout "wayland";
class = "1Password";
in {
programs = {
_1password.enable = true;
Expand Down Expand Up @@ -56,15 +57,15 @@ in {
];

windowrulev2 = [
"float, class:(1Password)"
"center, class:(1Password)"
"monitor ${monitor}, class:(1Password)"
# "stayfocused,class:^(1Password)$"
"forceinput,class:^(1Password)$"
"windowdance,class:^(1Password)$"
"noblur,class:^(1Password)$"
"noinitialfocus,class:^(1Password)$"
"dimaround,class:^(1Password)$"
"float, class:(${class})"
"center, class:(${class})"
"monitor ${monitor}, class:(${class})"
# "stayfocused,class:^(${class})$"
"forceinput,class:^(${class})$"
"windowdance,class:^(${class})$"
"noblur,class:^(${class})$"
"noinitialfocus,class:^(${class})$"
"dimaround,class:^(${class})$"
];
};

Expand All @@ -73,7 +74,7 @@ in {
bind = Ctrl Shift, P, submap, 1pass
submap = 1pass
bind = Ctrl Shift, P, closewindow, class:^(1Password)$
bind = Ctrl Shift, P, closewindow, class:^(${class})$
bind = Ctrl Shift, P, submap, reset
submap = reset
Expand Down
5 changes: 3 additions & 2 deletions modules/desktop/apps/vesktop.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ with lib.my.utils; let
vesktop = unstable.vesktop;
layout = findLayoutConfig config ({index, ...}: index == 0); # Left monitor
workspace = findLayoutWorkspace layout ({default, ...}: default); # Default workspace
class = "^(vesktop)$";
in {
modules.desktop.wm.${desktop}.autostartPrograms = [
"${vesktop}/bin/vesktop"
Expand All @@ -22,8 +23,8 @@ in {

wayland.windowManager.hyprland.settings = mkIf (config.modules.desktop.wm.hyprland.enable) {
windowrulev2 = [
"workspace ${workspace.name}, class:^(vesktop)$"
"noinitialfocus, class:^(vesktop)$"
"workspace ${workspace.name}, class:${class}"
"noinitialfocus, class:${class}"
];
};
};
Expand Down

0 comments on commit 98a1a9e

Please sign in to comment.