#!/bin/bash # omarchy:summary=Install a packaged app and launch it once it finishes # omarchy:args= # omarchy:examples=omarchy 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: omarchy-install-and-launch " >&2 exit 1 fi printf -v install_message '%q' "Installing ${name}..." printf -v desktop_id_arg '%q' "$desktop_id" # The list has to reach omarchy-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 omarchy-launch-floating-terminal-with-presentation \ "echo ${install_message}; omarchy-pkg-add ${packages_arg} && (setsid uwsm-app -- gtk-launch ${desktop_id_arg} >/dev/null 2>&1 &)"