diff --git a/bash/bin/launch-menu-apps b/bash/bin/launch-menu-apps new file mode 100755 index 00000000..19c3fb55 --- /dev/null +++ b/bash/bin/launch-menu-apps @@ -0,0 +1,41 @@ +#!/usr/bin/env bash +set -euo pipefail + +# Define associative array +declare -A apps=() + +[[ ! -d "${HOME:?}/.config/launch-menu-apps.d" ]] && ( + mkdir -p "${HOME}/.config/launch-menu-apps.d" + cat << EOF >> "${HOME}/.config/launch-menu-apps.d/template.sh.disabled" +#!/usr/bin/env bash +set -euo pipefail + +apps+=( + ["Example application"]="example-application" + ["Test script"]="${HOME}/.local/bin/test-script" +) +EOF +) +# shellcheck disable=SC2012 +[[ "$(ls -1 "${HOME}"/.config/launch-menu-apps.d/*.sh 2>/dev/null | wc -l)" == "0" ]] && exit 0 + +# Append entries +for script in "${HOME}"/.config/launch-menu-apps.d/*.sh; do + echo ":: Sourcing script ${script}" + # shellcheck disable=SC1090 + source "${script}" +done + +# Create new variables +apps_keys= +for app in "${!apps[@]}"; do + [[ -n "${apps_keys}" ]] && apps_keys="${apps_keys}\n" + apps_keys=${apps_keys}${app} +done + +# Make selection +selection=$(echo -e "${apps_keys}" | launch-menu) + +# Execute +# shellcheck disable=SC2086 +( eval ${apps[${selection}]} ) diff --git a/install.sh b/install.sh index 2199a9dd..1a754bfa 100755 --- a/install.sh +++ b/install.sh @@ -46,6 +46,7 @@ link "repositories/dracula-mc/skins/dracula256.ini" ".local/share/mc/skins/dracu link "bash/bashrc" ".bashrc" link "repositories/punktdateien-bashrc" ".bashrc.d" link "bash/bin/launch-menu" ".local/bin/launch-menu" +link "bash/bin/launch-menu-apps" ".local/bin/launch-menu-apps" link "bash/jobrunner/daemon.sh" ".local/bin/jobrunner" link "bash/jobrunner/runjob.sh" ".local/bin/jobrunner-runjob" link "bash/starship.toml" ".config/starship.toml" diff --git a/uninstall.sh b/uninstall.sh index dbe6d09c..7c067798 100755 --- a/uninstall.sh +++ b/uninstall.sh @@ -103,6 +103,7 @@ unlink ".local/share/mc/skins/dracula256.ini" # bash unlink ".bashrc" unlink ".local/bin/launch-menu" +unlink ".local/bin/launch-menu-apps" unlink ".local/bin/jobrunner" unlink ".local/bin/jobrunner-runjob" unlink ".config/jstmbash.env"