mirror of
https://github.com/m-housh/dotfiles.git
synced 2026-02-14 06:12:34 +00:00
feat: Adds proton pass manager script, updates keybinds and window rules for proton pass.
This commit is contained in:
34
env/.local/scripts/launch-or-focus-webapp
vendored
Executable file
34
env/.local/scripts/launch-or-focus-webapp
vendored
Executable file
@@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Launch a web app or focus if it's already open.
|
||||
|
||||
if [[ $# == 0 ]]; then
|
||||
echo "Usage: launch-or-focus-webapp <url>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SCRIPTS="${SCRIPTS}"
|
||||
|
||||
if [[ -z $SCRIPTS ]]; then
|
||||
echo "scripts directory not set"
|
||||
echo "using ~/.local/scripts"
|
||||
SCRIPTS=~/.local/scripts
|
||||
fi
|
||||
|
||||
url=$1
|
||||
|
||||
# parse domain pattern from the url
|
||||
pattern=${url#https:\/\/} # removing leading 'https://'
|
||||
pattern=${pattern#http:\/\/} # removing leading 'http://'
|
||||
pattern=${pattern%%/*} # removing everything after '/' that's left (which should leave us with the domain)
|
||||
|
||||
window=$(hyprctl clients -j | jq -r ".[] | select((.class | contains(\"$pattern\"))) | .address")
|
||||
|
||||
echo "Pattern: \"$pattern\""
|
||||
echo "Window: \"$window\""
|
||||
|
||||
if [[ -n $window ]]; then
|
||||
hyprctl dispatch focuswindow "address:$window"
|
||||
else
|
||||
eval exec "$SCRIPTS/launch-webapp $url"
|
||||
fi
|
||||
Reference in New Issue
Block a user