Skip to content

Instantly share code, notes, and snippets.

@ndgnuh
Created February 22, 2021 14:13
Show Gist options
  • Select an option

  • Save ndgnuh/114988c522b4e5a3a1d205c43e4c55dd to your computer and use it in GitHub Desktop.

Select an option

Save ndgnuh/114988c522b4e5a3a1d205c43e4c55dd to your computer and use it in GitHub Desktop.
IBus engine cycling
#!/bin/sh
# chỉnh bộ gõ ở đây {{{ #
engines="xkb:us::eng, Bamboo"
# }}} chỉnh bộ gõ ở đây #
engines=$(echo $engines | sed s'/\s//g')
first_engine=$(echo $engines | cut -d ',' -f 1)
cur_next_engines=$(echo $engines \
| tr ',' '\n' \
| grep $(ibus engine) -A 1 \
)
# echo $cur_next_engines
next_engine=$(echo $cur_next_engines \
| tr ' ' '\n' \
| tail -n 1 \
)
if [ "$cur_next_engines" = "$next_engine" ]; then
next_engine=$first_engine
fi
# echo $next_engine
ibus engine $next_engine
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment