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