* Unify input methods with the installer keyboard selection * Preserve inherited input keys and later keyboard changes * Exercise input engines across desktop toolkits * Show input modes in the keyboard indicator * Keep Pinyin setup prompts visible * Remember input selections before an app gains focus * Remove the Japanese input welcome notification * Show explicit choices on notification cards * Suppress the Cloudpinyin first-use prompt * Show the input switching shortcut in keyboard hints * Verify input setup and composition stay quiet * Use Super+I for input switching independently of Fcitx keys * Restore linked input settings and attribute test notifications to Fcitx * Correct the input setup shortcut hint * Keep input tooltips to the name and switching shortcut * Place the input language selector with the right bar widgets * Show input switching only for multiple layouts or methods * Unify input method and keyboard layout switching * Select keyboard layouts and input methods in the Typing menu * Apply typing selections immediately from the menu * Use installer keyboard choices and keep typing selections accurate * Queue typing changes and wait for saved selections * Keep queued typing selections when reopening the menu * Cycle keyboard layouts alongside composition engines * Avoid shadowing Python typing and retain pending mixed input selections * Keep input clicks working through controller and compositor failures * Move the keyboard layout widget to the right side of existing bars Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Map keyboard choices to the layouts the installer sets Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Keep the switching order when changing input methods Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Set input method fonts only after the selection saves Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Restore confirmed picker checks when an immediate change fails Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Route Super+I through the shell's input reader so unfocused choices stick Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Restore the input group when the font preference cannot be written Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Drop the azerty conversion now that the installer no longer offers it Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Apply the owner's keyboard layout once before persisting the input choice A quattro merge kept a second apply_keyboard after the retry loop, which re-ran loadkeys and firstboot, ignored their failure, and overwrote the XKB layout setup supplies for keymaps kbd-model-map lacks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Give the Lao keyboard choice a Lao desktop layout The row used la-latin1, kbd's Latin American Spanish keymap, so Lao installs typed Spanish. There is no Lao console keymap; like Korean, the console stays US and the desktop gets la, which Omarchy keeps behind US as a non-Latin layout. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Load engines installed after Fcitx started when they are selected The Typing menu refused an engine whose package an update had installed, since Fcitx discovers engines only at startup. Restart input once and wait for the engine; name the package when it really is not installed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Cycle input methods back with Super+Shift+I Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Drop notification action buttons now that the Pinyin prompt is suppressed Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Cycle input only through the shell's reader Without the shell there is no bar or menu either, so the one-shot cycling path only duplicated the reader's logic. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Add engines from the command line through the Typing menu's path omarchy setup input <engine> had its own restart, append, select and live-rollback code in configure.py, parallel to the menu's. It now installs the packages and appends through typing_setup, leaving configure.py with install-time seeding and update defaults. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Keep Ctrl+Space out of Fcitx's toggles instead of probing for it The terminal prefix bind read the Fcitx config and profile on every press to avoid fighting a Ctrl+Space toggle. configure --defaults now removes that key from every trigger list, so the bind only checks for a terminal. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Run the input-method scripts with the system Python A bare python resolves through PATH, so a mise, pyenv or venv interpreter could run them without the system's PyGObject. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
142 lines
4.2 KiB
Bash
Executable File
142 lines
4.2 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# omarchy:summary=Pick one or multiple options from a menu
|
|
# omarchy:group=menu
|
|
# omarchy:name=select
|
|
# omarchy:args=prompt [option...] [-- --multiple --selected <value> --on-change <command-json> --change-key <key> --width <pixels> --maxheight <pixels>]
|
|
# omarchy:examples=omarchy menu select Format jpg png|omarchy-menu-select Resolution 4k 1080p 720p -- --width 400
|
|
|
|
# An option may lead with an icon, as "<glyph><TAB><label>", and may trail a
|
|
# subtext shown under the label, as "<glyph><TAB><label><TAB><subtext>". The
|
|
# menu shows the glyph but never returns it. A plain option returns the label
|
|
# alone; an option with a subtext returns "<label><TAB><subtext>", so callers
|
|
# with same-named rows get the subtext back as the stable key.
|
|
|
|
# With --multiple, clicking/Enter toggles rows and Apply returns a JSON array.
|
|
# --on-change takes a JSON command array; each toggle runs it with the selection
|
|
# JSON appended, applies immediately, and needs no Apply row. A successful
|
|
# command may print a JSON array of actual selections to update the checkmarks.
|
|
# --selected takes a returned value (label plus any subtext), and can be repeated.
|
|
|
|
set -euo pipefail
|
|
|
|
if (( $# < 1 )); then
|
|
echo "Usage: omarchy-menu-select <prompt> [option...] [-- menu args...]" >&2
|
|
exit 1
|
|
fi
|
|
|
|
prompt="$1"
|
|
shift
|
|
|
|
options=()
|
|
menu_width=""
|
|
menu_maxheight=""
|
|
multiple=0
|
|
on_change="[]"
|
|
change_key=""
|
|
selected=()
|
|
|
|
while (( $# > 0 )); do
|
|
if [[ $1 == "--" ]]; then
|
|
shift
|
|
while (( $# > 0 )); do
|
|
case "$1" in
|
|
--on-change)
|
|
shift
|
|
if (( $# == 0 )); then
|
|
echo "omarchy-menu-select: --on-change requires a JSON command array" >&2
|
|
exit 1
|
|
fi
|
|
on_change="$1"
|
|
;;
|
|
--change-key)
|
|
shift
|
|
if (( $# == 0 )); then
|
|
echo "omarchy-menu-select: --change-key requires a value" >&2
|
|
exit 1
|
|
fi
|
|
change_key="$1"
|
|
;;
|
|
--multiple)
|
|
multiple=1
|
|
;;
|
|
--selected)
|
|
shift
|
|
if (( $# == 0 )); then
|
|
echo "omarchy-menu-select: --selected requires a value" >&2
|
|
exit 1
|
|
fi
|
|
selected+=("$1")
|
|
;;
|
|
--width)
|
|
shift
|
|
if (( $# == 0 )); then
|
|
echo "omarchy-menu-select: --width requires a value" >&2
|
|
exit 1
|
|
fi
|
|
menu_width="$1"
|
|
;;
|
|
--height|--maxheight)
|
|
arg="$1"
|
|
shift
|
|
if (( $# == 0 )); then
|
|
echo "omarchy-menu-select: $arg requires a value" >&2
|
|
exit 1
|
|
fi
|
|
menu_maxheight="$1"
|
|
;;
|
|
esac
|
|
shift
|
|
done
|
|
break
|
|
fi
|
|
|
|
options+=("$1")
|
|
shift
|
|
done
|
|
|
|
if (( ${#options[@]} == 0 )) && [[ ! -t 0 ]]; then
|
|
mapfile -t options
|
|
fi
|
|
|
|
if (( ${#options[@]} == 0 )); then
|
|
echo "Usage: omarchy-menu-select <prompt> [option...] [-- menu args...]" >&2
|
|
exit 1
|
|
fi
|
|
|
|
selection_file=$(mktemp)
|
|
done_file=$(mktemp)
|
|
rm -f "$done_file"
|
|
trap 'rm -f "$selection_file" "$done_file"' EXIT
|
|
|
|
options_json=$(perl -MEncode=decode -MJSON::PP=encode_json -e 'print encode_json([map { decode("UTF-8", $_) } @ARGV])' "${options[@]}")
|
|
selected_json=$(perl -MEncode=decode -MJSON::PP=encode_json -e 'print encode_json([map { decode("UTF-8", $_) } @ARGV])' "${selected[@]}")
|
|
payload=$(perl -MEncode=decode -MJSON::PP=encode_json,decode_json -e '
|
|
my $payload = {
|
|
mode => "select",
|
|
prompt => decode("UTF-8", $ARGV[0]),
|
|
options => decode_json($ARGV[1]),
|
|
multiple => $ARGV[6] ? JSON::PP::true : JSON::PP::false,
|
|
selected => decode_json($ARGV[7]),
|
|
onChange => decode_json($ARGV[8]),
|
|
changeKey => $ARGV[9],
|
|
selectionFile => decode("UTF-8", $ARGV[2]),
|
|
doneFile => decode("UTF-8", $ARGV[3])
|
|
};
|
|
$payload->{width} = int($ARGV[4]) if length($ARGV[4] // "");
|
|
$payload->{maxHeight} = int($ARGV[5]) if length($ARGV[5] // "");
|
|
print encode_json($payload)
|
|
' "$prompt" "$options_json" "$selection_file" "$done_file" "$menu_width" "$menu_maxheight" "$multiple" "$selected_json" "$on_change" "$change_key")
|
|
|
|
omarchy-shell shell summon omarchy.menu "$payload" >/dev/null || exit 2
|
|
|
|
while [[ ! -e $done_file ]]; do
|
|
sleep 0.05
|
|
done
|
|
|
|
if [[ -s $selection_file ]]; then
|
|
cat "$selection_file"
|
|
else
|
|
exit 1
|
|
fi
|