[openbox] activate/deactive shortcuts on the fly

Dana Jansens danakj at orodu.net
Sun Oct 18 20:06:26 EDT 2020


This doesnt deal with the blank lines but perhaps sed/grep could help there.

With regard to the file becoming corrupted, does obhotkey let you control the path to the file it is editing? If so, make a random tempfile (https://unix.stackexchange.com/questions/181937/how-create-a-temporary-file-in-shell-script) and cat the current config into it. Then have obhotkey modify that file. When done, mv the temp file back over your working rc.xml file. This way at least the update will be atomic.

Cheers,
Dana

> On Oct 18, 2020, at 5:25 PM, Łukasz Grabowski <graboluk at gmail.com> wrote:
> 
> 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
> 
> 
> 
> 
> _______________________________________________
> openbox mailing list
> openbox at icculus.org
> http://icculus.org/mailman/listinfo/openbox
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://icculus.org/pipermail/openbox/attachments/20201018/43f68c94/attachment.htm>


More information about the openbox mailing list