From c586bfbf957d0d9c7bbe53e6aa393bfdcfb0f08b Mon Sep 17 00:00:00 2001 From: Prad Nukala Date: Fri, 16 Oct 2026 14:23:31 -0400 Subject: [PATCH] feat(tools): add Umbriel window launcher toggle script --- dot_local/bin/executable_umbriel-launch | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 dot_local/bin/executable_umbriel-launch diff --git a/dot_local/bin/executable_umbriel-launch b/dot_local/bin/executable_umbriel-launch new file mode 100755 index 0000000..b719afa --- /dev/null +++ b/dot_local/bin/executable_umbriel-launch @@ -0,0 +1,25 @@ +#!/bin/sh +# umbriel-launch PATTERN COMMAND... +# Focus the next workspace window whose app id matches PATTERN (a +# case-insensitive jq regex), cycling through matches on repeated presses; +# with none open, spawn COMMAND. Scratchpad windows are skipped: they have +# their own toggles. Umbriel counterpart of niri-launch / omarchy-cycle. +set -eu + +[ $# -ge 2 ] || { echo "usage: umbriel-launch PATTERN COMMAND..." >&2; exit 2; } +pattern=$1 +shift + +# Matches in a stable order (window id); the one after the focused match, or +# the first when focus is elsewhere. +target=$(umbriel windows --json | jq -r --arg p "$pattern" ' + [.[] | select(.scratchpad == "" and (.app_id | test($p; "i")))] | sort_by(.id) + | if length == 0 then empty + else (map(.focused) | index(true)) as $i + | if $i == null then .[0].id else .[($i + 1) % length].id end + end') + +if [ -n "$target" ]; then + exec umbriel msg "window-focus:$target" +fi +exec umbriel msg spawn "$@"