mirror of
https://github.com/LukeHagar/omarchy.git
synced 2025-12-10 12:37:45 +00:00
* 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 <david@hey.com>
70 lines
1.8 KiB
Bash
Executable File
70 lines
1.8 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
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_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_REF="$3"
|
|
CUSTOM_EXEC="$4" # Optional custom exec command
|
|
MIME_TYPES="$5" # Optional mime types
|
|
INTERACTIVE_MODE=false
|
|
fi
|
|
|
|
# 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
|
|
|
|
# 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" <<EOF
|
|
[Desktop Entry]
|
|
Version=1.0
|
|
Name=$APP_NAME
|
|
Comment=$APP_NAME
|
|
Exec=$EXEC_COMMAND
|
|
Terminal=false
|
|
Type=Application
|
|
Icon=$ICON_PATH
|
|
StartupNotify=true
|
|
EOF
|
|
|
|
# Add mime types if provided
|
|
if [[ -n $MIME_TYPES ]]; then
|
|
echo "MimeType=$MIME_TYPES" >>"$DESKTOP_FILE"
|
|
fi
|
|
|
|
chmod +x "$DESKTOP_FILE"
|
|
|
|
if [[ $INTERACTIVE_MODE == true ]]; then
|
|
echo -e "You can now find $APP_NAME using the app launcher (SUPER + SPACE)\n"
|
|
fi
|