feat(cli): add omarchy-launch-browser and projects-sync scripts, update cycle launcher and monitor handling

This commit is contained in:
Prad Nukala committed 2026-10-15 14:26:14 -04:00
1 parent aa1dc10f93
commit cf1c0e2e3e
4 files changed
+73 -10

No files matched your search

+1 -1
View File
@@ -126,7 +126,7 @@ elif [[ $APP == "brave" ]]; then
# real browser (class brave-origin) and the SSAs (class brave-<host>)
# share the brave- prefix, so one regex catches them all.
INSTANCES=($(addresses_matching '^brave'))
DEFAULT_SPAWN="brave-origin"
DEFAULT_LAUNCHER="omarchy-launch-browser"
elif [[ $APP == "terminal" ]]; then
# Cycle all terminals. Tern (so.stencil.tern) is the SUPER + A scratch
+19
View File
@@ -0,0 +1,19 @@
#!/bin/bash
# omarchy:summary=Launch the default browser; a cold Brave Origin start reopens the last session without the "Restore pages?" prompt.
# omarchy:args=[url]
# Shadows /usr/bin/omarchy-launch-browser (~/.local/bin is earlier on PATH)
# and hands off to it. A reboot or power-off kills Brave uncleanly, so the
# next start counts as post-crash: Chromium then skips session restore and
# shows the "Restore pages?" bubble instead. --hide-crash-restore-bubble
# clears that post-crash state, and --restore-last-session reopens every
# window. Added only on a cold, non-private start: a running browser ignores
# both, and Omarchy's launcher would read the first flag as the URL to focus.
if [[ " $* " != *" --private "* ]] &&
[[ $(env -u BROWSER xdg-settings get default-web-browser) == brave-origin.desktop ]] &&
! pgrep -f '^/opt/brave-origin-bin/brave( |$)' >/dev/null; then
set -- --restore-last-session --hide-crash-restore-bubble "$@"
fi
exec /usr/bin/omarchy-launch-browser "$@"
@@ -15,28 +15,33 @@ set -uo pipefail
# web apps) from piling up duplicates. The scrolling layout gives each
# resident its own column, in the order they appear.
#
# HOME_MONITOR is a connector name or an EDID description (the latter, as in
# the workspace rules, survives a different DP connector after re-docking).
# When it is empty or that monitor is absent, the workspace opens on the
# focused one.
# HOME_MONITOR lists connector names or EDID descriptions, separated by |;
# the first one connected wins (descriptions, as in the workspace rules,
# survive a different DP connector after re-docking). When it is empty or
# none is connected, the workspace opens on the focused monitor. EXTERNAL is
# the main external display: the Studio Display, else the Samsung ultrawide
# (same order as hypr/monitors.lua).
EXTERNAL="Apple Computer Inc StudioDisplay 0x984262A7|Samsung Electric Company S34CG50 HNTY501103"
HOME_MONITOR=""
case ${1:-scratchpad} in
scratchpad)
NAME="scratchpad"
HOME_MONITOR="Apple Computer Inc StudioDisplay 0x984262A7"
HOME_MONITOR=$EXTERNAL
MEMBERS=("so.stencil.tern|tern")
;;
claude)
NAME="claude"
HOME_MONITOR="Apple Computer Inc StudioDisplay 0x984262A7"
HOME_MONITOR=$EXTERNAL
MEMBERS=("com.anthropic.Claude|claude-desktop")
;;
fastmail)
NAME="fastmail"
HOME_MONITOR="eDP-1"
MEMBERS=("com.fastmail.Fastmail|gtk-launch com.fastmail.Fastmail")
;;
beeper)
NAME="beeper"
HOME_MONITOR="eDP-1"
MEMBERS=("Beeper|gtk-launch beeper")
;;
home)
@@ -87,10 +92,13 @@ toggle_on() {
hyprctl dispatch togglespecialworkspace "$NAME" >/dev/null
}
# The profile's home monitor when connected, else whatever is focused.
# The first connected home monitor, else whatever is focused.
target_monitor() {
hyprctl monitors -j | jq -r --arg m "$HOME_MONITOR" \
'first(.[] | select(.name == $m or .description == $m)) // first(.[] | select(.focused)) | .name'
hyprctl monitors -j | jq -r --arg m "$HOME_MONITOR" '
. as $monitors
| first(($m | split("|"))[] as $want | $monitors[] | select(.name == $want or .description == $want))
// first($monitors[] | select(.focused))
| .name'
}
# Showing: just hide, even if a member is gone. Missing members come back on
+36
View File
@@ -0,0 +1,36 @@
#!/bin/bash
# Mirror every repo under the ghq root (~/Code/<host>/<owner>/<repo>) as a
# symlink ~/Projects/<repo>. Repos sharing a name across owners get
# <owner>-<repo>. Links into ~/Code whose repo is gone are removed; anything
# in ~/Projects that is not such a link is never touched. Run by
# projects-sync.timer (systemd user).
set -euo pipefail
code=${GHQ_ROOT:-$HOME/Code}
projects=$HOME/Projects
mkdir -p "$projects"
mapfile -t repos < <(find "$code" -mindepth 4 -maxdepth 4 -name .git -printf '%h\n' 2>/dev/null | sort)
declare -A count keep
for repo in "${repos[@]}"; do
name=${repo##*/}
count[$name]=$((${count[$name]:-0} + 1))
done
for repo in "${repos[@]}"; do
name=${repo##*/}
if ((count[$name] > 1)); then
owner=${repo%/*}
name=${owner##*/}-$name
fi
link=$projects/$name
keep[$name]=1
[[ -e $link && ! -L $link ]] && continue
[[ $(readlink "$link") == "$repo" ]] || ln -sfn "$repo" "$link"
done
for link in "$projects"/*; do
[[ -L $link && $(readlink "$link") == "$code"/* && -z ${keep[${link##*/}]:-} ]] && rm "$link"
done
exit 0