aboutsummaryrefslogtreecommitdiff
path: root/webtrayctl
diff options
context:
space:
mode:
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