Input method in FreeBSD virtual terminal (Week3)
Date: 06/20-06/26
Tmux
In this week, I continued to read the source code of tmux-fingers to see how it initializes the finger-mode, then I could utilize the code to implement my rime mode.
My origin idea was:
tmux_rime.sh: rime mode script, responsible for initializing rime mode, drawing status bar, inserting text in tmuxbinding.sh: bind commands to keys and sent to the named pipe between withtmux-rime.shclient.py: called bytmux_rime.shto request the server for current rime state and text that will be insertedserver.py: interact with low-level rime library and send the results toclient.pyvia socket
But later I found it's inefficient since almost all of keys must to process by the low-level rime library, that is, librime. However, they must be passed to tmux_rime.sh first, and client.py next. So, why do not send to client.py directly?
Here is my new idea:
tmux_rime.sh: rime mode script, responsible for initializing rime mode, drawing status bar, inserting text in tmuxbinding.sh: bind commands to keys and callclient.pywith argumentsclient.py: called bybinding.shand request the server for the current rime state and text that will be inserted, and send back the data via named pipe between with `tmux_rime.shserver.py: interact with low-level rime library and send the results toclient.pyvia socket
I had set up the basic skeleton of client.py, it has a Argparser to parse arguments as commands like:
- start: start a session with given
session_id - exit: exit a session with given
session_id - key: input a key with given
session_id,keycode, andmodifier - …
In the next week, I wish I can implement all necessary commands in both client and server and the socket part between them.