28 lines
1.0 KiB
Bash
Executable File
28 lines
1.0 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# blob:summary=Install a packaged app and launch it once it finishes
|
|
# blob:args=<display-name> <packages> <desktop-id>
|
|
# blob:examples=blob install and launch Cursor cursor-bin cursor
|
|
|
|
name="${1-}"
|
|
packages="${2-}"
|
|
desktop_id="${3-}"
|
|
|
|
if [[ -z $name || -z $packages || -z $desktop_id ]]; then
|
|
echo "Usage: blob-install-launch <display-name> <packages> <desktop-id>" >&2
|
|
exit 1
|
|
fi
|
|
|
|
printf -v install_message '%q' "Installing ${name}..."
|
|
printf -v desktop_id_arg '%q' "$desktop_id"
|
|
|
|
# The list has to reach blob-pkg-add as several words, so each word is quoted
|
|
# rather than the whole string; -d '' reads past newlines and always ends at EOF.
|
|
read -r -d '' -a package_list <<<"$packages" || true
|
|
printf -v packages_arg '%q ' "${package_list[@]}"
|
|
packages_arg="${packages_arg% }"
|
|
|
|
# The subshell keeps & from backgrounding the package installation too.
|
|
exec blob-launch-floating \
|
|
"echo ${install_message}; blob-pkg-add ${packages_arg} && (setsid uwsm-app -- gtk-launch ${desktop_id_arg} >/dev/null 2>&1 &)"
|