5

I'm trying to imitate the setup I had on OS X (via Karabiner): Pressing the left Shift on its own key inserts a left (, but holding it down and pressing another key acts as a normal Shift key (and similarly with the right Shift & right )). Is this possible with xkb?

5
  • 1
    That sounds like a cool feature. Won't be easy to do though. The first thing I thought of was xbindkeys. But that won't work because this doesn't allow passing on the keyevent or reacting only to keydown/keyup etc. So basically, I guess what you'd need is essentially a keylogger that reacts reacts to e.g. a keyup-LShift event and inserts a ( if no other key pressed.
    – kba
    Feb 16, 2016 at 22:42
  • You could use xcape, also as package in some distros, and do xcape -e 'Shift_L=parenleft' and xcape -e 'Shift_R=parenright' , but not sure it meets your needs / restrictions etc.
    – Runium
    Feb 16, 2016 at 23:22
  • And that should likely be xcape -e 'Shift_L=parenleft;Shift_R=parenright' ...
    – Runium
    Feb 16, 2016 at 23:41
  • @Sukminder xcape looks like exactly what I want, I will give that a try
    – jamesnvc
    Feb 17, 2016 at 0:48
  • @Sukminder just tried it, and it works exactly. Want to make that comment a response & I'll accept it?
    – jamesnvc
    Feb 17, 2016 at 0:56

1 Answer 1

2

One way is to use xcape.

xcape [-d] [-t timeout] [-e map-expression]

This should do the trick:

xcape -e 'Shift_L=parenleft;Shift_R=parenright'

xcape is included as a package for some distributions.

Notes:

It has a default delay of 500ms after which the mapped key will not be emitted. It can be set by the -t option.

Each map-expression run as a daemon and has it's own PID.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .