Convert tui and web app remove to QS menus
This commit is contained in:
+10
-19
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
# omarchy:summary=Remove terminal UI desktop launchers
|
||||
# omarchy:args=[name...]
|
||||
# omarchy:summary=Remove a terminal UI desktop launcher
|
||||
# omarchy:args=[name]
|
||||
|
||||
set -e
|
||||
|
||||
@@ -17,30 +17,21 @@ if (( $# == 0 )); then
|
||||
done < <(find "$DESKTOP_DIR" -name '*.desktop' -print0)
|
||||
|
||||
if ((${#TUIS[@]})); then
|
||||
IFS=$'\n' SORTED_TUIS=($(sort <<<"${TUIS[*]}"))
|
||||
unset IFS
|
||||
APP_NAMES_STRING=$(gum choose --no-limit --header "Select TUI to remove..." --selected-prefix="✗ " "${SORTED_TUIS[@]}")
|
||||
# Convert newline-separated string to array
|
||||
APP_NAMES=()
|
||||
while IFS= read -r line; do
|
||||
[[ -n $line ]] && APP_NAMES+=("$line")
|
||||
done <<< "$APP_NAMES_STRING"
|
||||
mapfile -t SORTED_TUIS < <(printf '%s\n' "${TUIS[@]}" | sort)
|
||||
APP_NAME=$(omarchy-menu-select "Select TUI to remove" "${SORTED_TUIS[@]}" -- --width 520 --maxheight 520)
|
||||
else
|
||||
echo "No TUIs to remove."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
# Use array to preserve spaces in app names
|
||||
APP_NAMES=("$@")
|
||||
APP_NAME="$*"
|
||||
fi
|
||||
|
||||
if (( ${#APP_NAMES[@]} == 0 )); then
|
||||
echo "You must provide TUI names."
|
||||
if [[ -z $APP_NAME ]]; then
|
||||
echo "You must select a TUI to remove."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for APP_NAME in "${APP_NAMES[@]}"; do
|
||||
rm -f "$DESKTOP_DIR/$APP_NAME.desktop"
|
||||
rm -f "$ICON_DIR/$APP_NAME.png"
|
||||
echo "Removed $APP_NAME"
|
||||
done
|
||||
rm -f "$DESKTOP_DIR/$APP_NAME.desktop"
|
||||
rm -f "$ICON_DIR/$APP_NAME.png"
|
||||
omarchy-notification-send "TUI removed" "$APP_NAME"
|
||||
|
||||
+11
-22
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
# omarchy:summary=Remove web app desktop launchers
|
||||
# omarchy:args=[name...]
|
||||
# omarchy:summary=Remove a web app desktop launcher
|
||||
# omarchy:args=[name]
|
||||
|
||||
set -e
|
||||
|
||||
@@ -17,34 +17,23 @@ if (( $# == 0 )); then
|
||||
done < <(find "$DESKTOP_DIR" -name '*.desktop' -print0)
|
||||
|
||||
if ((${#WEB_APPS[@]})); then
|
||||
IFS=$'\n' SORTED_WEB_APPS=($(sort <<<"${WEB_APPS[*]}"))
|
||||
unset IFS
|
||||
APP_NAMES_STRING=$(gum choose --no-limit --header "Select web app to remove..." --selected-prefix="✗ " "${SORTED_WEB_APPS[@]}")
|
||||
# Convert newline-separated string to array
|
||||
APP_NAMES=()
|
||||
while IFS= read -r line; do
|
||||
[[ -n $line ]] && APP_NAMES+=("$line")
|
||||
done <<< "$APP_NAMES_STRING"
|
||||
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
|
||||
# Use array to preserve spaces in app names
|
||||
APP_NAMES=("$@")
|
||||
APP_NAME="$*"
|
||||
fi
|
||||
|
||||
if (( ${#APP_NAMES[@]} == 0 )); then
|
||||
echo "You must select at least one web app to remove."
|
||||
if [[ -z $APP_NAME ]]; then
|
||||
echo "You must select a web app to remove."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for APP_NAME in "${APP_NAMES[@]}"; do
|
||||
rm -f "$DESKTOP_DIR/$APP_NAME.desktop"
|
||||
rm -f "$ICON_DIR/$APP_NAME.png"
|
||||
echo "Removed $APP_NAME"
|
||||
done
|
||||
rm -f "$DESKTOP_DIR/$APP_NAME.desktop"
|
||||
rm -f "$ICON_DIR/$APP_NAME.png"
|
||||
|
||||
if command -v update-desktop-database &>/dev/null; then
|
||||
update-desktop-database "$DESKTOP_DIR" &>/dev/null || true
|
||||
fi
|
||||
omarchy-notification-send "Web app removed" "$APP_NAME"
|
||||
update-desktop-database "$DESKTOP_DIR" &>/dev/null
|
||||
|
||||
@@ -227,8 +227,8 @@
|
||||
|
||||
// Remove
|
||||
"remove.package": {"icon":"","label":"Package","keywords":"uninstall","action":"xdg-terminal-exec --app-id=org.omarchy.terminal omarchy-pkg-remove"},
|
||||
"remove.webapp": {"icon":"","label":"Web App","keywords":"uninstall","action":"omarchy-launch-floating-terminal-with-presentation omarchy-webapp-remove"},
|
||||
"remove.tui": {"icon":"","label":"TUI","keywords":"uninstall terminal app","action":"omarchy-launch-floating-terminal-with-presentation omarchy-tui-remove"},
|
||||
"remove.webapp": {"icon":"","label":"Web App","keywords":"uninstall","action":"omarchy-webapp-remove"},
|
||||
"remove.tui": {"icon":"","label":"TUI","keywords":"uninstall terminal app","action":"omarchy-tui-remove"},
|
||||
"remove.development": {"icon":"","label":"Development","keywords":"uninstall languages"},
|
||||
"remove.theme": {"icon":"","label":"Theme","keywords":"uninstall","action":"omarchy-theme-remove"},
|
||||
"remove.browser": {"icon":"","label":"Browser","keywords":"uninstall"},
|
||||
|
||||
@@ -1187,7 +1187,7 @@ Item {
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onContainsMouseChanged: if (containsMouse) {
|
||||
onPositionChanged: {
|
||||
root.cursorActive = true
|
||||
root.selectedIndex = row.index
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user