mirror of
https://github.com/arthur-pbty/arthur-os.git
synced 2026-08-02 04:37:49 +02:00
Remove legacy online installer entrypoints, collapse migrations for 4.0, and move setup responsibilities into target-side system, hardware, and user commands.
42 lines
1.3 KiB
Bash
Executable File
42 lines
1.3 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# omarchy:summary=Remove a web app desktop launcher
|
|
# omarchy:args=[name]
|
|
|
|
set -e
|
|
|
|
ICON_DIR="$HOME/.local/share/icons/hicolor/256x256/apps"
|
|
OLD_ICON_DIR="$HOME/.local/share/applications/icons"
|
|
DESKTOP_DIR="$HOME/.local/share/applications/"
|
|
|
|
if (( $# == 0 )); then
|
|
# Find all web apps
|
|
while IFS= read -r -d '' file; do
|
|
if grep -q '^Exec=.*\(omarchy-launch-webapp\|omarchy-webapp-handler\).*' "$file"; then
|
|
WEB_APPS+=("$(basename "${file%.desktop}")")
|
|
fi
|
|
done < <(find "$DESKTOP_DIR" -name '*.desktop' -print0)
|
|
|
|
if ((${#WEB_APPS[@]})); then
|
|
mapfile -t SORTED_WEB_APPS < <(printf '%s\n' "${WEB_APPS[@]}" | sort)
|
|
APP_NAME=$(omarchy-menu-select "Select web app to remove" "${SORTED_WEB_APPS[@]}" -- --width 520 --maxheight 520)
|
|
else
|
|
echo "No web apps to remove."
|
|
exit 1
|
|
fi
|
|
else
|
|
APP_NAME="$*"
|
|
fi
|
|
|
|
if [[ -z $APP_NAME ]]; then
|
|
echo "You must select a web app to remove."
|
|
exit 1
|
|
fi
|
|
|
|
icon_name=$(printf '%s\n' "$APP_NAME" | tr '[:upper:]' '[:lower:]' | sed 's/[^[:alnum:]]\+/-/g; s/^-//; s/-$//')
|
|
rm -f "$DESKTOP_DIR/$APP_NAME.desktop"
|
|
rm -f "$ICON_DIR/$icon_name.png" "$ICON_DIR/$APP_NAME.png" "$OLD_ICON_DIR/$APP_NAME.png"
|
|
|
|
omarchy-notification-send -g "Web app removed" "$APP_NAME"
|
|
update-desktop-database "$DESKTOP_DIR" &>/dev/null
|