add(bitwarden): added window rule for bitwarden extension via socket listening
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
./hypr/rules.nix
|
||||
|
||||
./scripts/movement.nix
|
||||
./scripts/window-rules.nix
|
||||
./scripts/workspace-toggle.nix
|
||||
];
|
||||
wayland.windowManager.hyprland.enable = true;
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
windowrule = [
|
||||
# Make all inactive windows transparent
|
||||
"match:class .*, opacity 1 0.8"
|
||||
# But make Firefox windows opaque again (last rule wins)
|
||||
"match:title (?i)bitwarden, float on"
|
||||
"match:class firefox, match:title (?i).*bitwarden.*, no_screen_share on"
|
||||
];
|
||||
workspace = [
|
||||
];
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
{pkgs, ...}: let
|
||||
hyprctl = "${pkgs.hyprland}/bin/hyprctl";
|
||||
jq = "${pkgs.jq}/bin/jq";
|
||||
socat = "${pkgs.socat}/bin/socat";
|
||||
|
||||
hypr-window-rules = pkgs.writeShellScriptBin "hypr-window-rules" ''
|
||||
handle() {
|
||||
local event="$1"
|
||||
case "$event" in
|
||||
windowtitlev2*)
|
||||
local data="''${event#windowtitlev2>>}"
|
||||
local addr="0x''${data%%,*}"
|
||||
local title="''${data#*,}"
|
||||
|
||||
if echo "$title" | grep -qi "bitwarden"; then
|
||||
local info
|
||||
info=$(${hyprctl} clients -j | ${jq} -r --arg addr "$addr" \
|
||||
'.[] | select(.address == $addr) | "\(.class)|\(.floating)"')
|
||||
local class="''${info%|*}"
|
||||
local floating="''${info#*|}"
|
||||
|
||||
if [[ "$class" == "firefox" && "$floating" == "false" ]]; then
|
||||
${hyprctl} dispatch togglefloating "address:$addr"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
${socat} - \
|
||||
"UNIX-CONNECT:$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock" \
|
||||
| while IFS= read -r line; do handle "$line"; done
|
||||
'';
|
||||
in {
|
||||
home.packages = [hypr-window-rules];
|
||||
|
||||
wayland.windowManager.hyprland.settings.exec-once = [
|
||||
"hypr-window-rules"
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user