diff options
| author | Lukasz Kasprzak <lukasz.kasprzak@pm.me> | 2026-01-29 01:27:17 +0100 |
|---|---|---|
| committer | Lukasz Kasprzak <lukasz.kasprzak@pm.me> | 2026-01-29 01:27:17 +0100 |
| commit | 70e6d80c2d367480478eacf46363ee88a0e994ff (patch) | |
| tree | 3585660271002a776a8756994c92f8e546f98044 /dmenu-scripts | |
| parent | 646bb0d8df0e720c966dc2992dcf7fe1154d17cf (diff) | |
| download | bin-70e6d80c2d367480478eacf46363ee88a0e994ff.tar.gz bin-70e6d80c2d367480478eacf46363ee88a0e994ff.zip | |
added lots of new dmenu scripts
Diffstat (limited to 'dmenu-scripts')
| -rwxr-xr-x | dmenu-scripts | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/dmenu-scripts b/dmenu-scripts new file mode 100755 index 0000000..6d9c9db --- /dev/null +++ b/dmenu-scripts @@ -0,0 +1,38 @@ +#!/usr/bin/env bash +set -euo pipefail + +script_path="${HOME}/.local/bin" + +# Optional dmenu theming +# shellcheck disable=SC1090 +[[ -r "${HOME}/.local/bin/dmenu-theming" ]] && . "${HOME}/.local/bin/dmenu-theming" + +DMENU_CMD="${DMENU_CMD:-dmenu}" +PROMPT="${PROMPT:-Run: }" + +# List only executable non-binary files in ~/.local/bin +choices="$( + find "${script_path}" -maxdepth 1 -type f -executable -print0 \ + | xargs -0 -I{} sh -c 'grep -Iq . "$1" && printf "%s\n" "$(basename "$1")"' _ {} \ + | sort -u +)" + +picked="$( + printf "%s\n" "$choices" \ + | ${DMENU_CMD} -i -l 20 -p "${PROMPT}" ${lines:-} ${colors:-} ${font:-} \ + || true +)" + +[[ -n "${picked}" ]] || exit 0 + +# Safety: only allow basenames (no slashes) +case "$picked" in + */*|"") exit 0 ;; +esac + +target="${script_path}/${picked}" + +[[ -x "$target" ]] || { printf "ERROR: not executable: %s\n" "$target" >&2; exit 1; } + +exec "$target" + |
