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 tmux
binding.sh: bind commands to keys and sent to the named pipe between with tmux-rime.sh
client.py: called by tmux_rime.sh to request the server for current rime state and text that will be inserted
server.py: interact with low-level rime library and send the results to client.py via 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 tmux
binding.sh: bind commands to keys and call client.py with arguments
client.py: called by binding.sh and 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.sh
server.py: interact with low-level rime library and send the results to client.py via 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, and modifier
- ...
In the next week, I wish I can implement all necessary commands in both client and server and the socket part between them.