aboutsummaryrefslogtreecommitdiff
path: root/webtrayctl
diff options
context:
space:
mode:
authorNathan Reiner <nathan@nathanreiner.xyz>2025-02-14 23:35:25 +0100
committerNathan Reiner <nathan@nathanreiner.xyz>2025-02-14 23:35:25 +0100
commite78e1a69d7200da8012d9ef3a3b8fb25796d498e (patch)
treed7d544b7758bd3227b4683991a5f2c0a9f6cbac6 /webtrayctl
parent035ba2bd28eeca1b1658a1e69711842d3fbd152a (diff)
webtrayctl: add show
Diffstat (limited to 'webtrayctl')
-rwxr-xr-xwebtrayctl36
1 files changed, 28 insertions, 8 deletions
diff --git a/webtrayctl b/webtrayctl
index 3050a15..e20de40 100755
--- a/webtrayctl
+++ b/webtrayctl
@@ -65,38 +65,54 @@ remove_webapp() {
exit
}
+show() {
+ host=$(echo "$1" | sed 's/^https\?:\/\/\([^/]*\).*$/\1/')
+ dbus-send \
+ --dest="xyz.nathanreiner.WebTray.$host" \
+ --type=method_call \
+ --print-reply \
+ '/' \
+ local.webtray.DBusHandler.show > /dev/null \
+ || setsid webtray "$1" --open-at-startup &
+}
+
while true
do
case "$1" in
install)
action="install"
- shift
+ shift 2>/dev/null
url="$1"
name="$2"
- shift 2
+ shift 2 2>/dev/null
;;
uninstall)
action="uninstall"
- shift
+ shift 2>/dev/null
toRemove="$1"
- shift
+ shift 2>/dev/null
;;
"--open-at-startup")
open_at_startup="--open-at-startup"
- shift
+ shift 2>/dev/null
;;
"--icon")
- shift
+ shift 2>/dev/null
icon="$1"
[ -z "$1" ] && help
- shift
+ shift 2>/dev/null
+ ;;
+ show)
+ action="show"
+ shift 2>/dev/null
+ url="$1"
+ shift 2>/dev/null
;;
*)help;;
esac
if [ -z "$1" ]; then
break
fi
- #shift 1 || break
done
case "$action" in
@@ -108,5 +124,9 @@ case "$action" in
[ -z "$toRemove" ] && help
remove_webapp "$toRemove"
;;
+ show)
+ [ -z "$url" ] && help
+ show "$url"
+ ;;
*)help;;
esac