* Alternative settings for g910-gkeys This document will explain how to setup g910-gkeys by limiting as much as possible the usage of a global config, the idea being to setup global mapping in a static manner, and let the user set the actions in his/her own environment. ** Preamble ~g910-gkeys~ allows different actions : `typeout`, `shortcut` and `run`. All of these actions will be performed on the process environment, that is `root`. Also, these actions will be *global*. ** g910-gkeys The configuration chosen will ba basic: assign each ~g-key~ to a key which does not exist on physical keyboard. Any key could be used, like specific localized keys which do not exist on your keyboard (example: Japanese keys for an English keyboard), or function keys above F12. We will choose to map them to Function keys `F13` to `F21`. It is possible that some of these F-keys are already used on your system (example: some media keys may be assigned to `F20`). In this case, simply use another F-key. The ~g910-gkeys~ will be (skipping ~F20~ on my system): #+begin_src json { "__comment": "I was unable to use F20, even xev does not show the keycode. It just mutes/unmutes sound, same as the G910's button", "keyboard_mapping": "en", "g1": { "hotkey_type": "shortcut", "do": "F13" }, "g2": { "hotkey_type": "shortcut", "do": "F14" }, "g3": { "hotkey_type": "shortcut", "do": "F15" }, "g4": { "hotkey_type": "shortcut", "do": "F16" }, "g5": { "hotkey_type": "shortcut", "do": "F17" }, "g6": { "hotkey_type": "shortcut", "do": "F18" }, "g7": { "hotkey_type": "shortcut", "do": "F19" }, "g8": { "hotkey_type": "shortcut", "do": "F21" }, "g9": { "hotkey_type": "shortcut", "do": "F22" } } #end_src ** User configuration *Note*: Configuration below will make the ~G-keys~ active only when user is logged-on, as any other key. We will assign the F-keys we defined in `config.json` to any program (this includes graphical programs), or to send a string to active window (using *xvkbd*[fn:1]). *xvkbd* not only allows to send strings ("hello, World!"), but also modifiers (as ~Control-A~, ~Alt-B~, ~Control-Left~), mouse events (motion, buttons), etc... This is a subset of the *typeout* option of config.json. See ~xbkbd man page~ for more details. Below are some examples (screenshots from ~Xubuntu 22.10~). We will define the following actions : - ~G1~ will make the *Emacs* main window (whose title is always "*GNU Emacs*") active. - ~G2~ will launch a *Gnome Terminal*. - ~G3~ will send the string "Hello, World !" to active window. - ~G4~ will send the current date to active window. - ~G5~ will be assigned to a ~Hyper~ modifier: `G5 + a` will be `Hyper-a`, as `Control + a` is `Control-a`. All settings below (except for ~G5~) are configurable in `Settings/keyboard`, `Application Shortcuts` tab : #+CAPTION: This is the caption for the next figure link (or table) #+NAME: fig:SED-HR4049 ./img/g910-keyboard-settings.png [fn:1] *xvkbd* is in package of same name on ~debian~ and derivatives. If your distribution does not have this package, you can download it at : [[http://t-sato.in.coocan.jp/xvkbd/]].