From 13349180b60a29f791062c9cc24d99ddb6441b05 Mon Sep 17 00:00:00 2001 From: Alex R Teal <5629145+ATeal@users.noreply.github.com> Date: Sun, 14 Sep 2025 10:20:08 -0400 Subject: [PATCH] Better Zoom Webapp Support for meeting links (#1542) * Support for exec and mime types. Zoom integration In order to better support webapp zoom: - Added optional params for omarchy-webapp-install - exec, defaults to omarchy-launch-webapp - mimetypes, defaults blank - added zoom webapp launcher that parses meeting links and transforms them and calls launch webapp to join meeting links - migration to convert existing zoom installs to the new custom handler - updated the base installer to call new zoom handler and set mimetypes * default should be in the else * Add new line at end of file * Missed new line on migration * Updated conditionals to be a little more clean * This is a rare setup so let's just save it for the direct CLI * Use new bash conditionals * Rename to fit under the existing namespace of cmds * Fix after merge * Use new syntax and add missing segment comments * Cleanup a bit * Use local icon for zoom with migration * Fix regexp * Refer to raw local icon references --------- Co-authored-by: David Heinemeier Hansson --- bin/omarchy-webapp-handler-zoom | 20 +++++++++++++ bin/omarchy-webapp-install | 50 +++++++++++++++++++++++---------- install/packaging/webapps.sh | 28 +++++++++--------- migrations/1757435811.sh | 3 ++ migrations/1757435812.sh | 6 ++++ 5 files changed, 77 insertions(+), 30 deletions(-) create mode 100755 bin/omarchy-webapp-handler-zoom create mode 100644 migrations/1757435811.sh create mode 100644 migrations/1757435812.sh diff --git a/bin/omarchy-webapp-handler-zoom b/bin/omarchy-webapp-handler-zoom new file mode 100755 index 0000000..a27411e --- /dev/null +++ b/bin/omarchy-webapp-handler-zoom @@ -0,0 +1,20 @@ +#!/bin/bash + +url="$1" +web_url="https://app.zoom.us/wc/home" + +if [[ $url =~ ^zoom(mtg|us):// ]]; then + confno=$(echo "$url" | sed -n 's/.*[?&]confno=\([^&]*\).*/\1/p') + + if [[ -n $confno ]]; then + pwd=$(echo "$url" | sed -n 's/.*[?&]pwd=\([^&]*\).*/\1/p') + + if [[ -n $pwd ]]; then + web_url="https://app.zoom.us/wc/join/$confno?pwd=$pwd" + else + web_url="https://app.zoom.us/wc/join/$confno" + fi + fi +fi + +exec omarchy-launch-webapp "$web_url" diff --git a/bin/omarchy-webapp-install b/bin/omarchy-webapp-install index 0d25319..83d08c4 100755 --- a/bin/omarchy-webapp-install +++ b/bin/omarchy-webapp-install @@ -1,49 +1,69 @@ #!/bin/bash -if [ "$#" -ne 3 ]; then +if [ "$#" -lt 3 ]; then echo -e "\e[32mLet's create a new web app you can start with the app launcher.\n\e[0m" APP_NAME=$(gum input --prompt "Name> " --placeholder "My favorite web app") APP_URL=$(gum input --prompt "URL> " --placeholder "https://example.com") - ICON_URL=$(gum input --prompt "Icon URL> " --placeholder "See https://dashboardicons.com (must use PNG!)") + ICON_REF=$(gum input --prompt "Icon URL> " --placeholder "See https://dashboardicons.com (must use PNG!)") + CUSTOM_EXEC="" + MIME_TYPES="" + INTERACTIVE_MODE=true else APP_NAME="$1" APP_URL="$2" - ICON_URL="$3" + ICON_REF="$3" + CUSTOM_EXEC="$4" # Optional custom exec command + MIME_TYPES="$5" # Optional mime types + INTERACTIVE_MODE=false fi -if [[ -z "$APP_NAME" || -z "$APP_URL" || -z "$ICON_URL" ]]; then +# Ensure valid execution +if [[ -z "$APP_NAME" || -z "$APP_URL" || -z "$ICON_REF" ]]; then echo "You must set app name, app URL, and icon URL!" exit 1 fi -ICON_DIR="$HOME/.local/share/applications/icons" -DESKTOP_FILE="$HOME/.local/share/applications/$APP_NAME.desktop" - -if [[ ! "$ICON_URL" =~ ^https?:// ]] && [ -f "$ICON_URL" ]; then - ICON_PATH="$ICON_URL" -else - ICON_PATH="$ICON_DIR/$APP_NAME.png" - mkdir -p "$ICON_DIR" - if ! curl -sL -o "$ICON_PATH" "$ICON_URL"; then +# Refer to local icon or fetch remotely from URL +if [[ $ICON_REF =~ ^https?:// ]]; then + if curl -sL -o "$ICON_PATH" "$ICON_REF"; then + ICON_PATH="$ICON_DIR/$APP_NAME.png" + else echo "Error: Failed to download icon." exit 1 fi +else + ICON_PATH="$HOME/.local/share/applications/icons/$ICON_REF" fi +# Use custom exec if provided, otherwise default behavior +if [[ -n $CUSTOM_EXEC ]]; then + EXEC_COMMAND="$CUSTOM_EXEC" +else + EXEC_COMMAND="omarchy-launch-webapp $APP_URL" +fi + +# Create application .desktop file +DESKTOP_FILE="$HOME/.local/share/applications/$APP_NAME.desktop" + cat >"$DESKTOP_FILE" <>"$DESKTOP_FILE" +fi + chmod +x "$DESKTOP_FILE" -if [ "$#" -ne 3 ]; then +if [[ $INTERACTIVE_MODE == true ]]; then echo -e "You can now find $APP_NAME using the app launcher (SUPER + SPACE)\n" fi diff --git a/install/packaging/webapps.sh b/install/packaging/webapps.sh index d1e223b..df20bd3 100644 --- a/install/packaging/webapps.sh +++ b/install/packaging/webapps.sh @@ -1,15 +1,13 @@ -ICON_DIR="$HOME/.local/share/applications/icons" - -omarchy-webapp-install "HEY" https://app.hey.com "$ICON_DIR/HEY.png" -omarchy-webapp-install "Basecamp" https://launchpad.37signals.com "$ICON_DIR/Basecamp.png" -omarchy-webapp-install "WhatsApp" https://web.whatsapp.com/ "$ICON_DIR/WhatsApp.png" -omarchy-webapp-install "Google Photos" https://photos.google.com/ "$ICON_DIR/Google Photos.png" -omarchy-webapp-install "Google Contacts" https://contacts.google.com/ "$ICON_DIR/Google Contacts.png" -omarchy-webapp-install "Google Messages" https://messages.google.com/web/conversations "$ICON_DIR/Google Messages.png" -omarchy-webapp-install "ChatGPT" https://chatgpt.com/ "$ICON_DIR/ChatGPT.png" -omarchy-webapp-install "YouTube" https://youtube.com/ "$ICON_DIR/YouTube.png" -omarchy-webapp-install "GitHub" https://github.com/ "$ICON_DIR/GitHub.png" -omarchy-webapp-install "X" https://x.com/ "$ICON_DIR/X.png" -omarchy-webapp-install "Figma" https://figma.com/ "$ICON_DIR/Figma.png" -omarchy-webapp-install "Discord" https://discord.com/channels/@me "$ICON_DIR/Discord.png" -omarchy-webapp-install "Zoom" https://app.zoom.us/wc/home "$ICON_DIR/Zoom.png" +omarchy-webapp-install "HEY" https://app.hey.com HEY.png +omarchy-webapp-install "Basecamp" https://launchpad.37signals.com Basecamp.png +omarchy-webapp-install "WhatsApp" https://web.whatsapp.com/ WhatsApp.png +omarchy-webapp-install "Google Photos" https://photos.google.com/ "Google Photos.png" +omarchy-webapp-install "Google Contacts" https://contacts.google.com/ "Google Contacts.png" +omarchy-webapp-install "Google Messages" https://messages.google.com/web/conversations "Google Messages.png" +omarchy-webapp-install "ChatGPT" https://chatgpt.com/ ChatGPT.png +omarchy-webapp-install "YouTube" https://youtube.com/ YouTube.png +omarchy-webapp-install "GitHub" https://github.com/ GitHub.png +omarchy-webapp-install "X" https://x.com/ X.png +omarchy-webapp-install "Figma" https://figma.com/ Figma.png +omarchy-webapp-install "Discord" https://discord.com/channels/@me Discord.png +omarchy-webapp-install "Zoom" https://app.zoom.us/wc/home Zoom.png "omarchy-webapp-handler-zoom %u" "x-scheme-handler/zoommtg;x-scheme-handler/zoomus" diff --git a/migrations/1757435811.sh b/migrations/1757435811.sh new file mode 100644 index 0000000..8961559 --- /dev/null +++ b/migrations/1757435811.sh @@ -0,0 +1,3 @@ +echo "Copy Omarchy default app icons to .local/share/icons" + +source $OMARCHY_PATH/install/packaging/icons.sh diff --git a/migrations/1757435812.sh b/migrations/1757435812.sh new file mode 100644 index 0000000..14b308a --- /dev/null +++ b/migrations/1757435812.sh @@ -0,0 +1,6 @@ +echo "Update Zoom webapp to handle zoommtg:// and zoomus:// protocol links" + +if [[ -f ~/.local/share/applications/Zoom.desktop ]]; then + omarchy-webapp-remove Zoom + omarchy-webapp-install Zoom https://app.zoom.us/wc/home Zoom.png "omarchy-webapp-handler-zoom %u" "x-scheme-handler/zoommtg;x-scheme-handler/zoomus" +fi