From 6721b2a8c56bc4ec7110ec1bb5d2f596502d4502 Mon Sep 17 00:00:00 2001 From: Michael Housh Date: Mon, 6 Oct 2025 08:29:01 -0400 Subject: [PATCH] fix: Fixes launch script to have a --new-instance flag to force launching a new instance of an application. --- env/.config/hypr/keybinds.conf | 2 +- env/.local/scripts/hypr/launch | 8 +++++++- env/.local/scripts/hypr/launch-webapp | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/env/.config/hypr/keybinds.conf b/env/.config/hypr/keybinds.conf index b168028..d4dd3f9 100644 --- a/env/.config/hypr/keybinds.conf +++ b/env/.config/hypr/keybinds.conf @@ -43,7 +43,7 @@ bindd = $mainMod SHIFT, B, New private [b]rowser, exec, bindd = $mainMod, C, [C]alendar, exec, $pwa --or-focus "https://www.icloud.com/calendar" bindd = $mainMod SHIFT, C, [C]onfig folder in tmux session, exec, $terminal -e $tmuxSessionator ~/.config bindd = $mainMod, D, [D]ispatch app - special workspace, exec, $pwa --special dispatch $housecallPro -bindd = $mainMod SHIFT, D, [D]ispatch app - new window, exec, $pwa $housecallPro +bindd = $mainMod SHIFT, D, [D]ispatch app - new window, exec, $pwa --new-instance $housecallPro bindd = $mainMod, E, [E]mail - personal, exec, $pwa --or-focus "https://mail.proton.me" bindd = $mainMod SHIFT, E, [E]mail - work, exec, $scripts/launch --or-focus thunderbird uwsm app -- thunderbird bindd = $mainMod, F, [F]ile manager - terminal, exec, $fileManager diff --git a/env/.local/scripts/hypr/launch b/env/.local/scripts/hypr/launch index 59ee750..1321f8e 100755 --- a/env/.local/scripts/hypr/launch +++ b/env/.local/scripts/hypr/launch @@ -23,6 +23,7 @@ OPTIONS: instance. -x | --close-active-only: Close only windows on active workspace matching the pattern. -s | --special : Launch or toggle a special workspace. + -n | --new-instance: Launch a new instance of an application. -h | --help: Show this help page. NOTES: @@ -46,6 +47,7 @@ close_flag="0" close_active_only_flag="0" focus_flag="0" focus_active_only_flag="0" +new_instance_flag="0" launch_cmd=() pattern="" special_flag="0" @@ -71,6 +73,8 @@ while [[ $# -gt 0 ]]; do close_flag="1" close_active_only_flag="1" action="closewindow" + elif [[ $1 == "-n" ]] || [[ $1 == "--new-instance" ]]; then + new_instance_flag="1" elif [[ $1 == "-h" ]] || [[ $1 == "--help" ]]; then usage && exit 0 elif [[ -z $pattern ]]; then @@ -124,9 +128,11 @@ log "Pattern: $pattern" addresses=$(hyprctl clients -j | jq ".[] | select(.class | contains(\"$pattern\")) | .address") # If no addresses, then launch the application. -if [[ -z $addresses ]]; then +if [[ -z $addresses ]] || [[ $new_instance_flag == "1" ]]; then + log "No addresses found or new instance flag set." # Toggle special workspace if applicable. if [[ $special_flag == "1" ]]; then + log "Toggling special workspace." toggle_special fi launch_application && exit 0 diff --git a/env/.local/scripts/hypr/launch-webapp b/env/.local/scripts/hypr/launch-webapp index 94d2eb7..212d568 100755 --- a/env/.local/scripts/hypr/launch-webapp +++ b/env/.local/scripts/hypr/launch-webapp @@ -28,7 +28,7 @@ Any extra arguments after '--' get passed directly to the browser invocation. $ launch-webapp https://example.com -- --some-random-flag-for-browser=1 -Any options passed in prior to the '--' get sent to the 'launch-or' script, so you can pass +Any options passed in prior to the '--' get sent to the 'launch' script, so you can pass options that are not specifically shown here, but the ones shown would be the most commonly used, so they are documented here.