mirror of
https://github.com/m-housh/dotfiles.git
synced 2026-02-14 14:12:41 +00:00
fix: Fixes launch script to have a --new-instance flag to force launching a new instance of an application.
This commit is contained in:
8
env/.local/scripts/hypr/launch
vendored
8
env/.local/scripts/hypr/launch
vendored
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user