Try to rely less on hardcoded paths

This commit is contained in:
2022-05-12 17:51:55 +02:00
parent 6ca24383f0
commit 71eb05c09a
8 changed files with 34 additions and 18 deletions

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/run/current-system/sw/bin/bash
if [ $# -ne 1 ]; then
echo "Usage: $0 <target_dir>"
@@ -12,15 +12,18 @@ check_dir() {
for application in "$dir/"*; do
file="$(basename "$application")"
sed "s/^Exec=/Exec=bwshell --name '$file' --profile gui /gi" "$application" > "$target/$file"
sed "s/^Exec=/Exec=bwbox --name '$file' --profile wayland /gi" "$application" > "$target/$file"
done
}
dirs=("/usr/share/applications" "$HOME/.local/share/applications")
dirs=($(echo "$XDG_DATA_DIRS" | tr ':' '\n'))
dirs+=("$HOME/.local/share")
target="$1"
mkdir -p "$target"
for dir in "${dirs[@]}"; do
check_dir "$dir"
if [ -d "$dir/applications" ]; then
check_dir "$dir/applications"
fi
done