Files
omarchy/bin/omarchy-input-method
T

23 lines
761 B
Bash
Executable File

#!/bin/bash
# omarchy:summary=Configure, inspect, or switch input methods
# omarchy:args=<status|cycle [back]|configure [--seed|--defaults] [none|mozc|hangul|pinyin|chewing]>
# omarchy:hidden=true
set -euo pipefail
if [[ ${1:-} == "cycle" ]]; then
direction=${2:-next}
if [[ $direction != "next" && $direction != "back" ]]; then
echo "Usage: omarchy-input-method cycle [back]" >&2
exit 1
fi
# The shell's reader retains a choice made while nothing has focus. Without
# the shell, switch directly.
if [[ $(omarchy-shell shell cycleInput "$direction" 2>/dev/null) != "ok" ]]; then
python "$OMARCHY_PATH/default/input-methods/indicator.py" cycle "$direction"
fi
else
python "$OMARCHY_PATH/default/input-methods/configure.py" "$@"
fi