unimatrix icon indicating copy to clipboard operation
unimatrix copied to clipboard

Setting background colors using non-QWERTY keyboard

Open pylipp opened this issue 7 years ago • 4 comments

The keys for switching background color are based on the QWERTY-layout: https://github.com/will8211/unimatrix/blob/cd04928ac94301d27ea1ca5613e7774dcb83f8f7/unimatrix.py#L508-L525

For me (QWERTZ-user), the corresponding row is !"§$%&/(). Is it easy to detect the actual ID of the key being pressed rather than the symbol mapped to it? Expanding the current mapping does not make sense because f.i. ( is on the German 8 but on the English 9.

Anyways, not a big deal because I probably won't be switching colors all day long.

pylipp avatar Jan 26 '18 13:01 pylipp

Interesting, hadn't thought about that. Let me look into it!

will8211 avatar Jan 27 '18 05:01 will8211

~~Well, looks like an easy fix would be to add the three characters " § / as alternatives, since they're not used anyway. This would help for French Canadian keyboards as well!~~ Looking at the differences more closely, this won't work. Also, it seems that curses can only see the final output of SHIFT combinations. How about 'g' to cycle though background colors (and 'f' for foreground colors.) Then people around the word can switch background colors all day long!

will8211 avatar Jan 27 '18 06:01 will8211

OR... the ALT key would work.

For example, Alt-1 and Alt-2 look like '1[' and '2[' to the curses 'get character' function. These would map correctly on any keyboard. The only problem is that people might have these combinations already set to do something in their window manager or terminal...

will8211 avatar Jan 27 '18 07:01 will8211

These are some valuable thoughts! I like the g/f cycling option very much (I think few remember what key maps to whichever color anyways). And using the Alt key might indeed interfer with some peoples workflow (I think gnome-terminal uses Alt-; people could have it as their WM modifier etc...)

Maybe use c/C key for cycling however, because f toggles flashers? Do you want me to do a PR?

pylipp avatar Jan 27 '18 09:01 pylipp