-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Questions about the keyboard overlay #267
Comments
I saw your comment on the other bug, but was waiting for @drinkcat to chime in, since he masterminded it. It was indeed implemented as a model overlay for xkbmap. As far as I can tell, Search was remapped to Mode_switch as it is one of the intrinsic modifiers for the keyboard mapping (along with ALT). That means you can add a keycode to xmodmap and specify the standard, +alt, +mode_switch, +alt+mode_switch and some others, without needing to deal with key combinations. There's some relation between mode_switch and AltGr, but I'm way out of my expertise here. The setxkbmap was necessary for non-xfce chroots because gnome-session was broken and didn't support configuration and autostart programs. Xfce didn't need setxkbmap because its keyboard config works just fine. With @smibarber's gnome-session fixes, I believe the built-in keyboard config should just work in those environments as well, eliminating the need to manually call setxkbmap. @drinkcat will need to comment on your caps lock issue and shortcut questions. |
Why? Well, Mode_switch is indeed similar to AltGr (ISO_Level3_Switch), but not the same, so that the Search key would not conflict with an eventual AltGr on the keyboard (http://www.linuxquestions.org/questions/linux-software-2/what-is-the-difference-between-mode_switch-and-iso_level3_switch-4175465999/ gives a good insight on what is going on). How? One of the main reason for going from xmodmap to xkb is this:
(the other is that mappings are not lost if you reload the keyboard configuration or change the layout) With the xkb overlay, it is easy to add Search+. mapping to Insert, regardless of what the "." key is mapped to (on an US keyboard its period, greater, but on my keyboard it's period, colon, etc...)
Well, even in XFCE, it still needs to be set if you leave the xfce setting as "Use system defaults" (if you set it manually, it should be fine). I'm trying to work on something that would synchronize the keyboard layouts between Chromium OS and the chroot display, but my code still has some issues.
The only reason I see is that you may be accidentally pressing Search+Alt (which maps to Caps Lock). Note that you need to Hold Search, Press Alt, then release Search (Alt+Search will not work).
That's the tricky part. I don't know how to do it. I have some ideas though, I'll do some experiments and get back to you. |
Many thanks to both of you for the quick and detailed answers ! |
Nothing much is obvious with xkb, xmodmap, xkbcomp, xbindkeys, etc. There are 3-4 ways of accomplishing the same stuff, none of them being perfect in all aspects. The overlay thing was very clean until now, but getting those Search+letter shortcuts is a little messy... Anyway, I hacked something to get Search+key to generate Super(mod4)+key events, for normal keys (letters, symbols, Tab, Esc...). You can try it out by replacing This works by bouncing Search+key to keycodes 208-253, then mapping those keycodes to send Super+key. Now, strange things could happen if the keyboard natively generates keycodes 208 and above (nothing awfully bad, just that the key would map to Super+X instead of a XF86XX key). In particular, I'm wondering about the Fn+key combinations on the Acer C7 and HP Pavilion: for example, on Dell keyboard, the Fn key press is not passed on to the OS, but Fn+key produces another code. Anyone around with one of those (@dnschneid maybe?), could you run this:
And check that nothing >= 208 is generated no matter which key you press? (all single key, + fn+key combinations). If there is no conflict, I'll put together a pull request. |
|
OK, status report... |
This might or might not be relevant for the topic. On my previous machines, I configured some keyboard-specific remappings via udev's Sadly, Anybody got an idea what's going on here? |
Try deleting the contents of /var/lib/xkb to force a re-compilation of the keyboard map: |
@akobel: On ARM, it's Chromium OS that's accessing the hardware keyboard and passing the keycodes down to the chroot. The udev approach may work on x86-based Chromebooks, but udev isn't involved on ARM. |
@david : on my machine there is nothing in that folder, except for a README file... |
After your reply to akobel I thought maybe you meant that folder in Chrome and not chroot. |
Ah, so there is no equivalent for setting device-specific scancode-to-keycode-mappings on ARM? What a pity... Thanks anyway, that lets me stay away from burning more time on that problem. |
Since Chromium OS processes the hardware on ARM (or on x86 if you use the Xephyr target), the chroot doesn't get low enough access to do such processing. You could probably make the Chromium OS rootfs writable (which disables auto updating) and then tweak udev on the Chromium OS side, but I doubt that's something you want to do. |
@fpp-gh: Sorry maybe I wasn't clear, the keycodes >208 are not sent out to xev, they are used by the overlay to generate Super+key events: In xev, just an 'a' outputs:
Search+'a' now outputs:
As you can see, the state is different: the second one corresponds to Super+a. When you type it in most applications, you will still get an 'a', but you use it for shortcuts in |
Ouch, that mail above came out really messed up ! Rsposting it here : Aha, my bad, thanks for spelling it out ! This setup is becoming really slick and usable, thanks to you ! A few more questions, if I may ?
|
@drinkcat the HP Pavilion generates keycode 246 for Fn + F13, used for toggling wifi in Chromium OS. I wasn't able to get a hold of an Acer C7 but it looks like it also has a wifi toggle (Fn + F11). As far as I can tell that's the only keycode >= 208 on either machine. |
Okay, so it seems that "killall -HUP xbindkeys" (AND then moving the mouse around :-) reloads my own bindings without disturbing those loaded in /etc/crouton. |
Your mileage may vary with
(you can add
The power button does not show any event in
They are probably caught by the DE. I know that XFCE binds Search+P by default. |
@smibarber: Thanks for trying it out. I will skip that code. |
drinkcat, thanks much for the reloading method, it seems to work better indeed. Now even Search+M is responding, go figure :-) As for the power button, for now I solved it by setting the action to "None" in the XFCE settings, to avoid accidents.
|
Nope, that's not usable, unfortunately. |
The keyboard is the biggest issue I have with my Samsung chromebook. I need a Supr_L key for my window manager, but I also need Delete/End/Start/AvPag/RePag to edit text without going mad. I don't really need the brightness/volume combinations: how can I get that part of the keyboard target functionality without loosing Super_L? Thanks for any tip PD: Not sure if it is good etiquette to reuse this question for this; please tell me so if not and I'll open a new one. |
@jesusiniesta : What you are looking for is mentionned in #362. This is a quite common question so I wrote a paragraph in the wiki (https://github.com/dnschneid/crouton/wiki/Keyboard#super_l-key). Feel free to modify/expand it. |
@drinkcat it sounds familiar to me, I probably did try something similar last time. i'll give it a try again, thanks a lot! |
note to self: stop closing this until @drinkcat says so |
In short, there are still 3 outstanding issues with the keyboard map:
Solutions:
|
I can't get the keyboard target to work on my chroot (saucy, KDE, samsung arm). When I try to upgrade the chroot with this target (using the command: sudo sh -e ~/Downloads/crouton -n saucy -t keyboard -u), it fails and ends with the following: W: Failed to fetch http://dl.google.com/linux/chrome/deb/dists/stable/Release Unable to find expected entry 'main/binary-armhf/Packages' in Release file (Wrong sources.list entry or malformed file). Anybody know what this means/why this might happen/how to fix it? Thanks! |
@infamouswhiteknight This has nothing to do with the keyboard target: It looks like you managed to install some Chrome repositories. Could you open another issue so that we can keep track of your problem better? |
Oops, sorry. I could open the other issue, but now that you point out that it's about a chrome repository, I just removed it, and now updating the chroot works, as does the keyboard. Don't I feel silly. Thanks! |
What should we do about this? |
I should at least fix point 3 above. And leave the rest as wiki entries. |
I found this very useful. It is also possible to change Mod4 to Control (https://pastebin.com/e68xg2mG). Very useful for Emacs users ^_^ |
[ In retrospect it was probably a mistake to post these in a closed issue (#138), although its topic was appropriate, so I'm adding them here in full view :-) ]
Since I upgraded to the "keyboard" target, my ARM Chromebook has become a lot more comfortable to use (I had tried to hack some Search key shortcuts with xmodmap myself, with little success).
I do have some follow-up questions about how this is done :
At first I thought this was because I left "save session" checked by default in the logout panel, but it works just the same with that unchecked.
What would the simplest way to go about this without breaking anything else ? xmodmap ? .xbindkeys.scm ?
Most user-level utilities (like xfce's shortcut manager) don't recognize the Search key (Overlay1_Enable in xev) as a modifier, and by tinkering with .xbindkeys.scm I even managed to disable the functionality on F6/F7 :-)
Thanks for any tips,
fp
The text was updated successfully, but these errors were encountered: