omarchy/bin/omarchy-webapp-install
Ankur Kotwal 5e3d0d89a5
Reflect default browser changes in bindings and webapps (#871)
* Abstract default browser to omarchy-browser (a wrapper)

* Fix the omarchy-browser command as it used to loop. Extract info from the browser .desktop files.

* Clean up and fix bugs

* Cleanup unused change

* Fix indentation

* Separate out omarchy-browser from omarchy-webapp so that we don't break webapps for browsers other than Chromium or Google Chrome.

* Fix incorrect function call

* Add a migration script

* Migration script fixes

* Simplify the browser and webapp commands. Rename commands to align with launch terminology.

* Add support for Microsoft Edge, Opera and Vivaldi

* Fix errors

* Remove --name and --class -- They're not respected when --app is defined

* We don't ship with Chrome

* Simplify launchers

* Use launch commands everywhere

---------

Co-authored-by: Ryan Hughes <ryan@heyoodle.com>
2025-08-23 17:28:45 +02:00

47 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
if [ "$#" -ne 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!)")
else
APP_NAME="$1"
APP_URL="$2"
ICON_URL="$3"
fi
if [[ -z "$APP_NAME" || -z "$APP_URL" || -z "$ICON_URL" ]]; 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"
ICON_PATH="$ICON_DIR/$APP_NAME.png"
mkdir -p "$ICON_DIR"
if ! curl -sL -o "$ICON_PATH" "$ICON_URL"; then
echo "Error: Failed to download icon."
return 1
fi
cat >"$DESKTOP_FILE" <<EOF
[Desktop Entry]
Version=1.0
Name=$APP_NAME
Comment=$APP_NAME
Exec=omarchy-launch-webapp $APP_URL
Terminal=false
Type=Application
Icon=$ICON_PATH
StartupNotify=true
EOF
chmod +x "$DESKTOP_FILE"
if [ "$#" -ne 3 ]; then
echo -e "You can now find $APP_NAME using the app launcher (SUPER + SPACE)\n"
fi