Skip to content

Commit

Permalink
Implement next_engine() in ibus-agent
Browse files Browse the repository at this point in the history
  • Loading branch information
lewtds committed May 5, 2013
1 parent 120c3cf commit 2e75a9e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions sublimeibus/sublime-ibus-agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,16 @@ def stop_focus_observation():
def list_active_engines():
print_command('ibus_list_active_engines_cb', [i.name for i in bus.list_active_engines()])

def next_engine(id_no):
current_engine_name = imcontexts[id_no].get_engine().name
all_engine_names = [i.name for i in bus.list_active_engines()]
current_engine_index = all_engine_names.index(current_engine_name)
try:
next_engine_name = all_engine_names[current_engine_index + 1]
except IndexError:
next_engine_name = all_engine_names[0]
set_engine(id_no, next_engine_name)

########################################################################
# Main loop
########################################################################
Expand Down

0 comments on commit 2e75a9e

Please sign in to comment.