fix: Fixes launch script to have a --new-instance flag to force launching a new instance of an application.

This commit is contained in:
2025-10-06 08:29:01 -04:00
parent a4a560eb3d
commit 6721b2a8c5
3 changed files with 9 additions and 3 deletions

View File

@@ -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

View File

@@ -23,6 +23,7 @@ OPTIONS:
instance.
-x | --close-active-only: Close only windows on active workspace matching the pattern.
-s | --special <name>: 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

View File

@@ -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.