From e78e1a69d7200da8012d9ef3a3b8fb25796d498e Mon Sep 17 00:00:00 2001 From: Nathan Reiner Date: Fri, 14 Feb 2025 23:35:25 +0100 Subject: webtrayctl: add show --- webtrayctl | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) (limited to 'webtrayctl') 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 -- cgit v1.2.3-70-g09d2