From fcce9177e356bb27283926451433130a8809fcb0 Mon Sep 17 00:00:00 2001 From: Sébastien Dailly Date: Sun, 27 Aug 2023 16:41:10 +0200 Subject: Send the whole keymap to the device --- readme.rst | 84 ++++++++++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 66 insertions(+), 18 deletions(-) (limited to 'readme.rst') diff --git a/readme.rst b/readme.rst index b8ffca2..f285538 100755 --- a/readme.rst +++ b/readme.rst @@ -1,12 +1,32 @@ +.. role:: json(code) + :language: json + +======================= +Smart Macropad with KMK +======================= + +.. contents:: + :depth: 2 + +------------- +The companion +------------- + +The companion is running in the PC connected with the macropad. The application +will control the keyboard and changes the keys depending of the application used. Requirements ============ -python3 -m pip install pystray pyserial zope.component +.. code:: bash + + python3 -m pip install pystray pyserial zope.component for debian you may need to install : -sudo apt install python3-pil.imagetk +.. code:: bash + + sudo apt install python3-pil.imagetk python3-serial python3-zope.component python3-pystray Configuration ============= @@ -53,9 +73,9 @@ The mapping .. code:: ini [mapping] - Mozilla Firefox = Firefox - Teams = Teams - irssi = Irssi + Mozilla Firefox = firefox.json + Teams = teams.json + irssi = irssi.json … Mapping list @@ -83,24 +103,48 @@ The application send a json string to the endpoint (network or serial connection .. code:: json - {"layout": "Firefox"} + {"layer_name": "keymap"} -This application does not handle the code in the keyboard. CircuitPython -provide a native library in order `to read or store json`_, and firmware build -upon it (like KMK) are easer to use with. +the keymap can be: -.. _`to read or store json`: https://docs.circuitpython.org/en/latest/docs/library/json.html +:a string: -Reading message ---------------- + The key name will be sent: :json:`"A"` + +:a list: -The endpoint can also send a message to the application. For now, the message -is a raw string with the name of the layer. + All the keys will be chained in a single stroke: :json:`["^", "A"]` -When the application receive such message, it will look for the active window -in the desktop, and register the application with this layer. If this -application is selected again, the application will ask the endpoint to switch -to the same layer again. +:a dictionnary: + + Used to create custom sequences: :json:`{"seq": ["/", "W", "C", "ENTER"]}` + +:null: + + The key will do nothing. + +.. code:: json + + { "Example": [ + {"seq": ["A", "B", "C"]}, ["^", "R"], ["^", "T"], ["^", "W"], + null, null, null, null + ]} + +CircuitPython provide a native library in order `to read or store json`_, and +firmware build upon it (like KMK) are easer to use with. + +.. _`to read or store json`: https://docs.circuitpython.org/en/latest/docs/library/json.html + +.. Reading message +.. --------------- +.. +.. The endpoint can also send a message to the application. For now, the message +.. is a raw string with the name of the layer. +.. +.. When the application receive such message, it will look for the active window +.. in the desktop, and register the application with this layer. If this +.. application is selected again, the application will ask the endpoint to switch +.. to the same layer again. Network connection ================== @@ -108,3 +152,7 @@ Network connection You can relay the events to another one instance using the network. I'm using this when I'm connected over VNC in order to use the keyboard as if it was plugged directly in the host. + +---------- +The device +---------- -- cgit v1.2.3