[openbox] activate/deactive shortcuts on the fly

Ɓukasz Grabowski graboluk at gmail.com
Sun Oct 18 17:24:48 EDT 2020


Hello,

I use xournal for delivering online lectures with a wacom tablet. It
has quite bad shortcuts with no possibility of adjusting them without
recompiling.

Right now I use openbox/obhotkey/xdotool instead like so: in my rc.xml
I have

<keybind key="C-A-k">
 <action name="execute">
  <command>/home/luke/bin/xournal-mode.sh</command>
 </action>
</keybind>

<keybind key="C-A-l">
 <action name="execute"><command>/home/luke/bin/xournal-mode-off.sh
 </command></action>
</keybind>

xournal-mode.sh has a bunch of lines like

obhotkey 1  "xdotool key alt+t c b"

which means that changing pen colour to blue is done by pressing 1.

Similarly, xournal-mode-off.sh has lines like

obhotkey 1 ""

Mostly this works, but it just feels flimsy. For example, there seem to
be a bug in obhotkey: if I turn on xournal mode and then turn it off,
then there's one extra blank line in rc.xml. So right now I have 100s
or more blank lines in my rc.xml. Also once or twice I ended with more
severely damaged rc.xml where I had to edit it (I guess this happened
when I went into panic mode trying to switch-on switch off the xournal
mode several times in a row in a short amount of time, because I went to 
another widnow without deactivating xournal mode)

So I'm looking for a different, more robust solution. For example could
I turn caps lock into "xournal-mode activator", and additionally force
those shortcuts to be active only in xournal"? 

Other ideas welcome (however I really do want to use single stroke
keys, as this is for live lectures, so single stroke just makes it
smoother for me - I have only left hand at keyboard, and while, say
Left alt + key would work fine for left-hand side keys, I have too many
shortcuts, so need to use entire keyboard)

(recompiling xournal isn't really feasible: while changing shortcuts is
fairly easy, xournal has its own text tool, where, say, the key "1" is
supposed to be used for entering symbol "1", and I wouldn't know how to
achieve it)

Best,
Lukasz






More information about the openbox mailing list