Add cmd: app-unexport
This commit is contained in:
parent
232df03088
commit
d0677d0f05
|
@ -22,3 +22,6 @@ Start a program within a prefix. If PROOTH_ROOT is set to 1, it will use setting
|
||||||
|
|
||||||
* app-export </path/to/prefix> <application or /path/to/application.desktop> <name-suffix>
|
* app-export </path/to/prefix> <application or /path/to/application.desktop> <name-suffix>
|
||||||
Add a desktop launcher from the prefix to the host.
|
Add a desktop launcher from the prefix to the host.
|
||||||
|
|
||||||
|
* app-unexport </path/to/prefix> <application>
|
||||||
|
Remove a desktop launcher of a prefix from the host.
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -e
|
||||||
|
FULL_PREFIX="$(realpath -s "$1")"
|
||||||
|
HASH_PREFIX=($(echo "$FULL_PREFIX" | md5sum))
|
||||||
|
DESKTOP_FILE="$2"
|
||||||
|
|
||||||
|
if ! [ -f "$DESKTOP_FILE" ]; then
|
||||||
|
if [ -f "$HOME/.local/share/applications/$HASH_PREFIX-$2.desktop" ]; then
|
||||||
|
DESKTOP_FILE="$HOME/.local/share/applications/$HASH_PREFIX-$2.desktop"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
while IFS="" read -r p || [ -n "$p" ]
|
||||||
|
do
|
||||||
|
shopt -s nullglob
|
||||||
|
if [[ "$p" == "Icon="* ]]; then
|
||||||
|
ICON="${p/Icon=/}"
|
||||||
|
for ICON_FILE in "$HOME/.icons/hicolor/"*"/"*"/$ICON."*; do
|
||||||
|
rm -f "$ICON_FILE"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
shopt -u nullglob
|
||||||
|
done < "$DESKTOP_FILE"
|
||||||
|
rm -f "$DESKTOP_FILE"
|
|
@ -8,5 +8,8 @@ Show this help.
|
||||||
Start a program within a prefix. If PROOTH_ROOT is set to 1, it will use settings that emulate root rights.
|
Start a program within a prefix. If PROOTH_ROOT is set to 1, it will use settings that emulate root rights.
|
||||||
|
|
||||||
* app-export </path/to/prefix> <application or /path/to/application.desktop> <name-suffix>
|
* app-export </path/to/prefix> <application or /path/to/application.desktop> <name-suffix>
|
||||||
Add a desktop launcher from the prefix to the host.\
|
Add a desktop launcher from the prefix to the host.
|
||||||
|
|
||||||
|
* app-unexport </path/to/prefix> <application>
|
||||||
|
Remove a desktop launcher of a prefix from the host.\
|
||||||
"
|
"
|
||||||
|
|
Loading…
Reference in New Issue