- Notifications
You must be signed in to change notification settings - Fork0
Toggle EXWM char-mode automatically in GTK 3 text fields
License
sinic/autocharmode
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This proof of concept is in an unpolished state,but turned out to be so useful in day-to-day usagethat I'm publishing it regardless.
In short:EXWM's simulation keyscan remap an X application's keybindings, so that it is possible to,for example, control Firefox using vi-like keybindings,purely through the window manager and without resorting to any add-ons.
One unfortunate drawback compared to browser add-ons, however, isthat state internal to applications is invisible to EXWM:with the cursor in the address bar or in a web page's text field,one would expect input to show up verbatim, but for that,one has to switch fromline-mode
(i.e., simulation keys) tochar-mode
manually!It's easy to imagine (and experience!) thatforgetting about toggling input modes wreaks havoc on a browsing session.
This program (ab)uses GTK's input method mechanism,which is normally used to open an on-screen keyboardwhen text is about to be entered anywhere in a GTK application,and to close it afterwards.Here, instead,emacs-client
is called to togglechar-mode
for the appropriate window.Now it is hardly ever necessary to toggle input modes manually!
Make sure that an Emacs server runsby executing the
server-start
command in your EXWM session.Build this project with
make
andstart Firefox (or any other GTK 3 application of your choice)so that it uses the new input method module, adapt the path as necessary:
GTK_IM_MODULE_FILE=$HOME/autocharmode/immodules.cache GTK_IM_MODULE=autocharmode firefox
- Confirm that the input mode toggles automatically,for example by selecting the address bar.