mirror of
https://github.com/arthur-pbty/arthur-os.git
synced 2026-08-01 20:28:16 +02:00
39 lines
863 B
Bash
Executable File
39 lines
863 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# omarchy:summary=Pick one option with Walker
|
|
# omarchy:group=menu
|
|
# omarchy:name=select
|
|
# omarchy:args=prompt option... [-- walker args...]
|
|
# omarchy:examples=omarchy menu select Format jpg png|omarchy-menu-select Resolution 4k 1080p 720p -- --width 400
|
|
|
|
set -euo pipefail
|
|
|
|
if (( $# < 2 )); then
|
|
echo "Usage: omarchy-menu-select <prompt> <option>... [-- walker args...]" >&2
|
|
exit 1
|
|
fi
|
|
|
|
prompt="$1"
|
|
shift
|
|
|
|
options=()
|
|
walker_args=()
|
|
|
|
while (( $# > 0 )); do
|
|
if [[ $1 == "--" ]]; then
|
|
shift
|
|
walker_args=("$@")
|
|
break
|
|
fi
|
|
|
|
options+=("$1")
|
|
shift
|
|
done
|
|
|
|
if (( ${#options[@]} == 0 )); then
|
|
echo "Usage: omarchy-menu-select <prompt> <option>... [-- walker args...]" >&2
|
|
exit 1
|
|
fi
|
|
|
|
printf '%s\n' "${options[@]}" | omarchy-launch-walker --dmenu --width 295 --minheight 1 --maxheight 300 -p "$prompt…" "${walker_args[@]}" 2>/dev/null
|