From 08414045a56517d95e94f55c406ec8940336c6c7 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Thu, 23 Jan 2025 15:36:31 +0100 Subject: ... --- accounts/gkleen@sif/niri/default.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'accounts/gkleen@sif/niri') diff --git a/accounts/gkleen@sif/niri/default.nix b/accounts/gkleen@sif/niri/default.nix index 628a8161..2e9b6909 100644 --- a/accounts/gkleen@sif/niri/default.nix +++ b/accounts/gkleen@sif/niri/default.nix @@ -98,7 +98,7 @@ let with-unnamed-workspace-action = config.lib.niri.actions.spawn (lib.getExe with_unnamed_workspace); with_select_window = pkgs.writeShellApplication { - name = "with-unnamed-workspace"; + name = "with-select-window"; runtimeInputs = [ niri pkgs.gojq pkgs.socat config.programs.fuzzel.package pkgs.gawk ]; text = '' window_select="$1" @@ -108,9 +108,9 @@ let windows_json="$(niri msg -j windows)" active_workspace="$(jq -r '.[] | select(.is_focused) | .workspace_id' <<<"$windows_json")" - window="$(gojq -r --arg active_workspace "$active_workspace" '.[] | select('"$window_select"') | "\(.title)\t\(.id)"' <<<"$windows_json" | fuzzel --log-level=warning --dmenu)" - window_id="$(awk -F $'\t' '{print $2}' <<<"$window")" - window_json="$(jq -r --arg window_id "$window_id" '.[] | select(.id == ($window_id | tonumber))' <<<"$windows_json")" + window_ix="$(gojq -r --arg active_workspace "$active_workspace" '.[] | select('"$window_select"') | "\(.title)\u0000icon\u001f\(.app_id)"' <<<"$windows_json" | fuzzel --log-level=warning --dmenu --index)" + # shellcheck disable=SC2016 + window_json="$(gojq -rc --arg active_workspace "$active_workspace" --arg window_ix "$window_ix" 'map(select('"$window_select"')) | .[($window_ix | tonumber)]' <<<"$windows_json")" [[ -z "$window_json" ]] && exit 1 -- cgit v1.2.3