Incorrect Keymapping on Pi400 - keyboard

I have loaded the latest version of Raspberry Pi OS (32-bit) to a pi400, but the keymapping is odd. For instance, my backslash '\' Key types the pound sign '#'. Other keys are also mapped oddly too.
I first checked the keyboard-mapping via
sudo raspi-config
and then from the prompt selected Localization Options > Keyboard > Configuring keyboard-configuration
For Keyboard Model, I selected 'Generic 101-key PC' as per this pihut article suggestion.
I saved and rebooted; no luck.
I found a tutorial on remapping keys, but requires some bash scripting to run on start, which seems messy.
Maybe choosing a different Keyboard model in keyboard-configuration would solve the issue instead?

Turns out my locale was set to UK.
I used the following command to change my keyboard region and it fixed the issue
setxkbmap us

Related

Manjaro linux compose key gives incorrect behavior

I installed Cinnamon Manjaro linux on my 2017 QWERTY Macbook Air. Kernel: 5.4.27-1-MANJARO.
I've tried changing my keyboard languages, but my compose key always produces the same behavior -- that of a US (intl) keyboard. I don't know why.
I've tried setting my compose key to different things, like LWin or RAlt, no luck.
Ideally, I want the same key behavior as that on Mac. My current keyboard layout is English (Macintosh). Everything works, except for all of the compose key combos / accents, which all seem to produce US(intl) dead key outputs.
Things I've tried:
changing my keyboard layouts, from GUI to setxkbmap.
changing my compose key
manually setting the value of Option "Xkblayout" "mac" in /etc/X11/xorg.conf.d/00-keyboard.conf
Failing to understand how to manually force set the accent keys I want via xmodmap :(
Thanks for the help.
Solved: I realized that there was another keyboard which Xorg was somehow (I don't know how) set to, other than English (Macbook). I ran setxbmap -option which had the effect of "resetting" my keyboard to the layout I'd correctly chosen via the GUI.
I don't much understand how / why Xorg persisted in using another keyboard layout despite what I had entered in the GUI keyboard settings -- somehow it survived a reset through multiple computer restarts throughout these past days. But it works.

Cygwin non-US or indirect characters don't work in xterm on extra monitor

I have run into this freaky thing in two places now, on a Windows 7 and an XP machine.
I have a laptop with an extra monitor connected. I start up cygwin's x-server, using the start menu shortcut (Cygwin-X/XWin Server). I then start an xterm by right-click the X icon in the icon tray at the bottom right, and selecting Applications/xterm.
I get an xterm. In it I can type text, but depending on which monitor the xterm window resides, all characters that require two keypresses on my swedish keyboard (example: "~" requires me to first press alt+the key marked "^ ¨ ~" and then press space, rendering a single ~ on the screen) result in a space being printed.
If I move the xterm to the other monitor, I am suddenly able to type a ~ in the xterm. Move it back to the previous monitor, and I can't type ~ anymore.
Weird or what? This is the problem I have now, on my XP laptop. On my Windows7 laptop (same basic setup) I had the problem that I could only type stuff like åäö (not indirect/combined characters - I have keys marked å, ä and ö respectively on my keyboard) on one monitor, not the other.
I have messed around with different ways to start up the X Server, I think I am doing it the right way as I describe here.
My cygwin installation is maybe a year old on both machines. I would like to be able to find whatever setting causes this behaviour, so I can handle it should I come across similar problems in the future.
Any ideas?
Edit: some stuff that looked like html tags got mangled.
Since this seems to be a problem only with xterm, as a simple workaround I would suggest using some other terminal emulator instead of xterm. On Cygwin, a really nice substitute is mintty (available as a Cygwin package from within Cygwin setup). I stopped using xterm in favor of mintty some time ago because I found it to simply be an all-around more useful terminal emulator.
As a possible side benefit of using mintty, if xterm is the only X application you typically use, then you don't even need to run an X server any more because mintty is not an X application.

Solaris 10 keyboard problem

Im runing Solaris 10 - but im having problems with the keyboard.
Instead of - i get /, and instead of y i get z, etc. I tried changing every option in the menu "Keyboard Behaviour". I also tried changing kmdconfig from xorg to xsun, but then the graphics goes all wild and ugly - although the keyboard works fine then. Also cant change resolution in xsun mode.
By the way, im runing Solaris from Vmware, but i doubt this has anything to do with this.
Leave the graphic environment to the console:
dtconfig -d
dtconfig -reset
Select the correct keyboard layout you use:
kbd -s
Load it:
loadkeys
Check the keys are working properly. If okay, enable the graphical environment again:
dtconfig -e
If that still works, make that choice persistent after a reboot by updating your eeprom. eg:
eeprom kbd-type=Spanish
This should be migrated to superuser.com
It seems that you are expecting a german keyboard layout but are getting a US layout - at least the differences you are seeing are differences between those layouts. I don't know where to change that in openSolaris, but maybe it helps you find the correct place to look. Whatever desktop environment that you are using, it should have a tool to change the keyboard layout, probably somewhere with the other internationalization settings.

Making Mac shortcuts (e.g. Cmd-C) work on linux

Is there a way to map Cmd+C to Copy in linux? (instead of Ctrl+C)
Would be nice if I could also have the emacs style ones, like Ctrl+B to move left by one character.
Is there a way, on Linux/X, to map certain key combos to other key combos?
In the tradition of all open source projects, there's not a way, there are several. At the lowest level you've got kernel keybindings, which is probably not what you want. At the X server level you've got xkb with its myriad utilities. And then it seems that every window manager - gnome, kde, xfce or other - also has a keymapping utility. xkb seems to have lots of utils and such around it, and is likely more complete than any random window manager's keymapping utils, so I'd look at that first.
KDE 3 is probably the most flexible here; there's a pre-defined keyboard shortcut scheme named "Mac Scheme". You can set it through KControl Control Center > Regional & Accessibility > Keyboard Shortcuts or kcmshell keys and it will have effect on almost all KDE applications immediately. You might miss some of those Emacs-like "Ctrl-*" shortcuts that OS X has, but that aside, it works well (as long as your X modifiers are mapped correctly). And if it's not to your liking, it's easily customizable.
You can also set Control Center > Desktop > Behavior to enable a Mac OS-like menubar; all KDE applications will then share a menubar at the top of the screen instead of being individually attached to each window.
Update 02/03/2020
Kinto has now been rewritten in C for Ubuntu/Debian systems using x11. It also uses json config files, making it easier to manage and extend to other applications than just terminals. The app no longer maps to Super in the Terminal apps, it will now properly map to Ctrl+Shift to create the exact same feel as having a Cmd key.
Please checkout the latest release.
https://github.com/rbreaves/kinto
The main change to allow for the Super = Ctrl+Shift change is in this symbols file.
default partial xkb_symbols "mac_levelssym" {
key <LWIN> {
repeat= no,
type= "ONE_LEVEL",
symbols[Group1]= [ Hyper_L ],
actions[group1]=[ SetMods(modifiers=Shift+Control) ]
};
key <RWIN> {
repeat= no,
type= "ONE_LEVEL",
symbols[Group1]= [ Hyper_R ],
actions[group1]=[ SetMods(modifiers=Shift+Control) ]
};
};
Pjz's answer is correct in saying that an xkb solution would be ideal, sadly few have taken that route, most likely due to the difficulty of learning xkb and it seems many have gone the route of using Xmodmap files which is being deprecated while we are on our way to Wayland.
This answer may be several years too late, but here it is any ways.
Kinto is a tool I recently created that will address this problem and does so by using xkb and by listening to what app you are currently using, as it also changes the keymap while using terminals so the mac like experience can be consistent.
https://github.com/rbreaves/kinto
https://medium.com/#benreaves/kinto-a-mac-inspired-keyboard-mapping-for-linux-58f731817c0
Here's a Gist as well, if you just want to see what is at the heart of it all, it will not alternate your keymap when needed though. The Gist also does not include custom xkb keymap files that setup macOS style cursors/word-wise manipulations that use Cmd and the arrow keys.
https://gist.github.com/rbreaves/f4cf8a991eaeea893999964f5e83eebb
Edit: Posting the contents of the gist as well. I cannot realistically post the contents of Kinto.
# permanent apple keyboard keyswap
echo "options hid_apple swap_opt_cmd=1" | sudo tee -a /etc/modprobe.d/hid_apple.conf
update-initramfs -u -k all
# Temporary & instant apple keyboard keyswap
echo '1' | sudo tee -a /sys/module/hid_apple/parameters/swap_opt_cmd
# Windows and Mac keyboards - GUI (Physical Alt is Ctrl, Physical Super is Alt, Physical Ctrl is Super)
setxkbmap -option;setxkbmap -option altwin:ctrl_alt_win
# Windows and Mac keyboards - Terminal Apps (Physical Alt is Super, Physical Super is Alt, Physical Ctrl is Ctrl)
setxkbmap -option;setxkbmap -option altwin:swap_alt_win
#
# If you want a systemd service and bash script to help toggle between
# GUI and Terminal applications then look at project Kinto.
# https://github.com/rbreaves/kinto
#
# Note: The above may not work for Chromebooks running Linux, please look
# at project Kinto for that.
#
# If anyone would like to contribute to the project then please do!
#
You'll get almost all of the way there if you switch Cmd and Ctrl
xmodmap -e "keycode 63 = Control_L"
That way Cmd will be Control. No other keys will be swapped
Edited: I forgot the "-e"

Mapping my custom keys in Debian

I have a Microsoft keyboard with a series of non-standard buttons such as "Mail", "Search" , "Web/Home" etc.
It would be nice to be able to bind these keys so they execute arbitrary programs.
Does anybody know how to do this in Debian Etch?
I can't say for certain because I'm not using Debian but if you're using Gnome the easiest way is to run gnome-keybinding-properties (System > Preferences > Keyboard Shortcuts)
Instead of typing a shortcut such as Ctrl+M, hit the button on your keyboard.
If you would prefer to do this via command line or with a different desktop environment, this may help: Unusual keys and keyboards
Running Debian, I had the same issue. What I did is run xev and see what keycode those keys return. Microsoft likes to break standards a little, so some of the multimedia keys just won't work. But the ones that do will return a keycode. Then write a script with xmodmap to map those keys properly.
The Gentoo Wiki has excellent documentation on how to do these things.
I put my xmodmap script in ~/.kde/Autostart/ because I use kde, but you could just as easily put it in your home folder and have your .bashrc or .profile source it.
Once you've mapped the keycodes, you can assign those keys to specific actions in your desktop environment.
I used Gizmo Daemon for my PowerMate under Debian - it supports fancy keyboard keys as well (although I haven't tried it for those keys). Hacking on gizmod to get it to do what I wanted was pretty easy.
Gizmo Daemon
There's a few different ways to do so, the easiest generally being keytouch, which is probably available in the Debian repositories. The user manual is here. There is a chance that your keyboard won't work with it though.
If you want to do it manualy you can edit ~/.xmodmap
and use xmodmap ~/.xmodmap to apply the modifications

Resources