2

The danish keyboard layout is kind of stupid when it comes to programming. When I used a Macbook as my primary work laptop, I changed the layout, so a single tap of left shift would make an open parenthesis and right shift would make a closing parenthesis. In the same way left CTRL and right CTRL would make curly brackets.

How can I adopt the same keyboard behaviour in Ubuntu 16.04?

1
  • 2
    Changing modifier keys to non-modifier keys or dead keys is hard, if possible at all. I suggest mapping a particular modifier key together with normal keys to the brackets/parentheses with xmodmap. The reason is that the modifier keys were not intended as dead keys, and can also be used to modify mouse clicks.
    – dirkt
    Nov 1, 2016 at 11:55

1 Answer 1

0

There's a utility named xcape which can do this. https://github.com/alols/xcape

So the solution using xcape involves running the following command on startup:

xcape -e 'Control_L=ISO_Level3_Shift|7;Control_R=ISO_Level3_Shift|0;S‌​hift_L=Shift_L|8;Shi‌​ft_R=Shift_R|9' -t 200 on startup

If this is applied to a different keyboard layout, then the command needs to be different.

1
  • So the final solution I came up with using xcape was to run the command: xcape -e 'Control_L=ISO_Level3_Shift|7;Control_R=ISO_Level3_Shift|0;Shift_L=Shift_L|8;Shift_R=Shift_R|9' -t 200 on startup. If this is applied to a different keyboard layout, then of course the command needs to be different. If you add the command to the answer I can mark it as accepted. Nov 1, 2016 at 13:07

You must log in to answer this question.

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