From 8c96c502e16471b564a727c0ebb3b21c92e844ad Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Tue, 14 Jan 2025 17:11:24 +0100 Subject: ... --- accounts/gkleen@sif/niri/default.nix | 71 ++++++++++++++++++++++++++++++++---- 1 file changed, 63 insertions(+), 8 deletions(-) (limited to 'accounts/gkleen@sif/niri') diff --git a/accounts/gkleen@sif/niri/default.nix b/accounts/gkleen@sif/niri/default.nix index b6165487..6aa4391c 100644 --- a/accounts/gkleen@sif/niri/default.nix +++ b/accounts/gkleen@sif/niri/default.nix @@ -10,14 +10,19 @@ let focus-or-spawn = pkgs.writeShellApplication { name = "focus-or-spawn"; - runtimeInputs = [ niri pkgs.gojq pkgs.gnugrep ]; + runtimeInputs = [ niri pkgs.gojq pkgs.gnugrep pkgs.socat ]; text = '' app_id="$1" shift workspace_name="$1" shift - niri msg action move-workspace-to-monitor --output "$(niri msg -j workspaces | jq -r '.[] | select(.is_focused) | .output')" "$workspace_name" + workspaces_json="$(niri msg -j workspaces)" + workspace_output="$(jq -r --arg workspace_name "$workspace_name" '.[] | select(.name == $workspace_name) | .output' <<<"$workspaces_json")" + active_workspace="$(jq -r --arg workspace_output "$workspace_output" '.[] | select(.output == $workspace_output and .is_active) | .id' <<<"$workspaces_json")" + niri msg action move-workspace-to-monitor --output "$(jq -r '.[] | select(.is_focused) | .output' <<<"$workspaces_json")" "$workspace_name" + socat STDIO "$NIRI_SOCKET" <<<'{"Action":{"FocusWorkspace":{"reference":{"Id":'"''${active_workspace}"'}}}}' + niri msg action move-workspace-to-index --index 1 "$workspace_name" while IFS=$'\n' read -r window_json; do if jq -r '.app_id' <<<"$window_json" | grep -q "$app_id"; then @@ -109,13 +114,19 @@ in { focus-ring = { width = 2; }; - empty-workspace-above-first = true; }; cursor.hide-when-typing = true; workspaces = { - "01".name = "pwctl"; + "001".name = "pwctl"; + "002".name = "kpxc"; + "003".name = "bmgr"; + "101".name = "comm"; + "102".name = "web"; + "104".name = "read"; + "105".name = "mon"; + "110".name = "vid"; }; window-rules = [ @@ -125,12 +136,54 @@ in { allCorners = r: { bottom-left = r; bottom-right = r; top-left = r; top-right = r; }; in allCorners 8.; clip-to-geometry = true; - open-focused = false; } { matches = [ { app-id = "^com\.saivert\.pwvucontrol$"; } ]; open-on-workspace = "pwctl"; - open-focused = true; + } + { + matches = [ { app-id = "^\.blueman-manager-wrapped$"; } ]; + open-on-workspace = "bmgr"; + } + { + matches = [ { app-id = "^org\.keepassxc\.KeePassXC$"; } ]; + excludes = [ + { title = "^Unlock Database"; } + { title = "^Access Request"; } + { title = "^Passkey credentials"; } + ]; + open-on-workspace = "kpxc"; + open-focused = false; + } + { + matches = [ + { app-id = "^thunderbird$"; } + { app-id = "^Element$"; } + ]; + open-on-workspace = "comm"; + } + { + matches = [ { app-id = "^firefox$"; } ]; + open-on-workspace = "web"; + } + { + matches = [ + { app-id = "^evince$"; } + { app-id = "^imv$"; } + { app-id = "^org\.pwmt\.zathura$"; } + ]; + open-on-workspace = "read"; + } + { + matches = [ { app-id = "^mpv$"; } ]; + open-on-workspace = "vid"; + } + { + matches = [ + { app-id = "^qemu$"; } + { app-id = "^virt-manager$"; } + ]; + open-on-workspace = "mon"; } ]; @@ -180,8 +233,8 @@ in { "Mod+Shift+F".action = maximize-column; "Mod+Shift+Ctrl+F".action = fullscreen-window; - "Mod+Space".action = switch-focus-between-floating-and-tiling; - "Mod+Shift+Space".action = toggle-window-floating; + "Mod+B".action = switch-focus-between-floating-and-tiling; + "Mod+Shift+B".action = toggle-window-floating; "Mod+Left".action = set-column-width "-10%"; "Mod+Down".action = set-window-height "-10%"; @@ -228,6 +281,8 @@ in { "Mod+Comma".action = spawn dunstctl "history-pop"; "Mod+Alt+A".action = focus-or-spawn-action "^com\.saivert\.pwvucontrol$" "pwctl" "pwvucontrol"; + "Mod+Alt+P".action = focus-or-spawn-action "^org\.keepassxc\.KeePassXC$" "kpxc" "keepassxc"; + "Mod+Alt+B".action = focus-or-spawn-action "^\.blueman-manager-wrapped$" "bmgr" "blueman-manager"; }; }; }; -- cgit v1.2.3