Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting background colors using non-QWERTY keyboard #21

Open
pylipp opened this issue Jan 26, 2018 · 4 comments
Open

Setting background colors using non-QWERTY keyboard #21

pylipp opened this issue Jan 26, 2018 · 4 comments

Comments

@pylipp
Copy link
Contributor

pylipp commented Jan 26, 2018

The keys for switching background color are based on the QWERTY-layout:

unimatrix/unimatrix.py

Lines 508 to 525 in cd04928

elif kp == ord('!'):
self.set_bg_color('Green')
elif kp == ord('@'):
self.set_bg_color('Red')
elif kp == ord('#'):
self.set_bg_color('Blue')
elif kp == ord('$'):
self.set_bg_color('White')
elif kp == ord('%'):
self.set_bg_color('Yellow')
elif kp == ord('^'):
self.set_bg_color('Cyan')
elif kp == ord('&'):
self.set_bg_color('Magenta')
elif kp == ord('*'):
self.set_bg_color('Black')
elif kp == ord('('):
self.set_bg_color('default')

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.

@will8211
Copy link
Owner

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

@will8211
Copy link
Owner

will8211 commented Jan 27, 2018

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
Copy link
Owner

will8211 commented Jan 27, 2018

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...

@pylipp
Copy link
Contributor Author

pylipp commented Jan 27, 2018

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants