1

I'd like to use keys from a second keyboard to create custom shortcuts that are useful to me. For example, having to write a lot of math formulas, I'd like to press a key from the second keyboard, let's say the a key, for writing "\nabla" in a LaTeX editor.


At the moment, I'm following this answer, that exploits the actkbd daemon - http://users.softlab.ntua.gr/~thkala/projects/actkbd/. The answer suggests to use actkbd for copying the character(s) I'm interested in to the clipboard, and this solution works nicely. (So far I've just tried with the keyboard of my laptop, since I do not have a second keyboard yet, but I assume I can use actkbd only on the second keyboard just by changing the input device in the actkbd command, as described in the answer).

Unfortunately, there is one drawback: the key that I'm binding is still doing its old job (so after pressing a, the "a" character will be written in the editor), while I'd like to completely overwrite the action of that key. Therefore, at the moment I could only use those keys that do not affect the writing flow (for example, ctrl, shift, alt, and so on).

Do you have any suggestions on how to adjust this solution in order to "overwrite" the action of those keys?

OS: Ubuntu 20.04 LTS

1
  • If get yourself a keyboard with QMK, the problem just goes away.
    – Raphael
    May 20, 2021 at 23:02

2 Answers 2

1

For this I would use kmonad although it is probably overkill. It allows you to redefine every key differently on every connected keyboard. These keys can be traditional keyboard macros, or can act as new modifiers. This allows you to define new "layers" so you can type say Greek or maths. For the specific case of nabla, you can either get the system to type \ n a b l a or ctrlshiftu2207space depending on your OS to enter the Unicode character directly.

2
  • Thanks @icarus. kmonad seems to be such a great solution, it is very structured and in future I could even do more complicated customization, so I'm trying to use it. However, I'm having some difficulties when running it, since some keys are exchanged (for example, kmonad types grv instead of ` when I write\` in my layer). Do you have any experience with it?
    – kekolo
    Apr 6, 2021 at 7:05
  • Only now I noticed the bad formatting of my comment... I meant that when I use 'ḱmonad' it is like the slash is exchanged with some other keys, maybe because I'm using an Italian keyboard layout... however, I will try to deal with that, maybe I'm going to ask directly to the developers.
    – kekolo
    Apr 6, 2021 at 15:13
0

I was able to figure out how to disable the keys, I followed the instructions on this post on Reddit.

Long story short: the only thing to do is xinput list and then xinput --disable [id] with the id of your second keyboard. The best thing now would be to figure out how to directly paste without copying to the clipboard, but at the moment I will just stick with this good solution.

You must log in to answer this question.

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