Moved web app functions to full omarchy TUI commands

This commit is contained in:
David Heinemeier Hansson 2025-08-05 11:40:35 +02:00
parent 08ed9a5dff
commit 678882810e

View File

@ -35,54 +35,3 @@ format-drive() {
fi
fi
}
# Create a desktop launcher for a web app
web2app() {
if [ "$#" -ne 3 ]; then
echo "Usage: web2app <AppName> <AppURL> <IconURL> (IconURL must be in PNG -- use https://dashboardicons.com)"
return 1
fi
local APP_NAME="$1"
local APP_URL="$2"
local ICON_URL="$3"
local ICON_DIR="$HOME/.local/share/applications/icons"
local DESKTOP_FILE="$HOME/.local/share/applications/${APP_NAME}.desktop"
local 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=chromium --new-window --ozone-platform=wayland --app="$APP_URL" --name="$APP_NAME" --class="$APP_NAME"
Terminal=false
Type=Application
Icon=$ICON_PATH
StartupNotify=true
EOF
chmod +x "$DESKTOP_FILE"
}
web2app-remove() {
if [ "$#" -ne 1 ]; then
echo "Usage: web2app-remove <AppName>"
return 1
fi
local APP_NAME="$1"
local ICON_DIR="$HOME/.local/share/applications/icons"
local DESKTOP_FILE="$HOME/.local/share/applications/${APP_NAME}.desktop"
local ICON_PATH="${ICON_DIR}/${APP_NAME}.png"
rm "$DESKTOP_FILE"
rm "$ICON_PATH"
}