Allow multi select to remove webapps

Closes #1052
This commit is contained in:
David Heinemeier Hansson 2025-08-25 13:33:39 +02:00
parent dcfbd7a2e5
commit c48f370924

View File

@ -3,7 +3,7 @@
ICON_DIR="$HOME/.local/share/applications/icons" ICON_DIR="$HOME/.local/share/applications/icons"
DESKTOP_DIR="$HOME/.local/share/applications/" DESKTOP_DIR="$HOME/.local/share/applications/"
if [ "$#" -ne 1 ]; then if [ "$#" -eq 0 ]; then
# Find all web apps # Find all web apps
while IFS= read -r -d '' file; do while IFS= read -r -d '' file; do
if grep -q '^Exec=.*omarchy-launch-webapp.*' "$file"; then if grep -q '^Exec=.*omarchy-launch-webapp.*' "$file"; then
@ -14,23 +14,22 @@ if [ "$#" -ne 1 ]; then
if ((${#WEB_APPS[@]})); then if ((${#WEB_APPS[@]})); then
IFS=$'\n' SORTED_WEB_APPS=($(sort <<<"${WEB_APPS[*]}")) IFS=$'\n' SORTED_WEB_APPS=($(sort <<<"${WEB_APPS[*]}"))
unset IFS unset IFS
APP_NAME=$(gum choose --header "Select web app to remove..." "${SORTED_WEB_APPS[@]}") APP_NAMES=$(gum choose --no-limit --header "Select web app to remove..." "${SORTED_WEB_APPS[@]}")
else else
echo "No web apps to remove." echo "No web apps to remove."
exit 1 exit 1
fi fi
else else
APP_NAME="$1" APP_NAMES="$*"
fi fi
if [[ -z "$APP_NAME" ]]; then if [[ -z "$APP_NAMES" ]]; then
echo "You must provide web app name." echo "You must provide web app names."
exit 1 exit 1
fi fi
rm "$DESKTOP_DIR/$APP_NAME.desktop" for APP_NAME in $APP_NAMES; do
rm "$ICON_DIR/$APP_NAME.png" rm -f "$DESKTOP_DIR/$APP_NAME.desktop"
rm -f "$ICON_DIR/$APP_NAME.png"
if [ "$#" -ne 1 ]; then echo "Removed $APP_NAME"
echo -e "Removed $APP_NAME\n" done
fi