jmozz92
Posts: 2
Joined: Sun Apr 07, 2013 8:38 pm

Keybaord layout issues in X

Sun Apr 07, 2013 8:51 pm

I started up my Raspberry Pi for the first time the other day and set it all up correctly, including the keyboard layout for the UK. When in the console, it stays as the UK layout. However, when I run X, it changes back to the US layout. I've been back to the LX Launcher whilst in X to check the settings haven't reverted back to US and they haven't. I have restarted it every time I have tried this and I'm still having the problem. I know it's supposed to be configured to the UK as standard, so am I being stupid and missing something here or is there a code needed whilst running X to change it?

Thanks!

Bare with me, I'm new to this! :D

jmozz92
Posts: 2
Joined: Sun Apr 07, 2013 8:38 pm

Re: Keybaord layout issues in X

Mon Apr 08, 2013 10:30 am

I know I'm replying to my own message but I've solved it from rummaging through the forums and piecing together different bits of advice.

Anyone who has this problem, it's:

Open file manager to your home directory and right-click to create a blank document (this should be in /home/pi ) and call it

Code: Select all

.xsessionrc
When you create it, it might not come up. Right-click anywhere in the area you are in and make hidden files seen and the file you made should pop up. When you find it, open the file and enter

Code: Select all

setxkbmap gb
Save this file and then re-boot your Pi and it should all be fine!

Hope this helps anyone who stumbles upon it! :)

yottskry
Posts: 73
Joined: Wed Mar 06, 2013 10:11 pm

Re: Keybaord layout issues in X

Mon Apr 08, 2013 2:25 pm

jmozz92 wrote: Bare with me, I'm new to this! :D
Just so you know, that should be "bear" not "bare" :)

User avatar
Burngate
Posts: 5510
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK
Contact: Website

Re: Keybaord layout issues in X

Mon Apr 08, 2013 4:30 pm

yottskry wrote:
jmozz92 wrote: Bare with me, I'm new to this! :D
Just so you know, that should be "bear" not "bare" :)
I know "bare" means naked, but what's this got to do with cuddly toys?

User avatar
jojopi
Posts: 3042
Joined: Tue Oct 11, 2011 8:38 pm

Re: Keybaord layout issues in X

Mon Apr 08, 2013 8:58 pm

jmozz92 wrote:setxkbmap gb
This has been a surprisingly persistent problem. The thing is that "dpkg-reconfigure keyboard-configuration", as used by raspi-config, is supposed to change the layout both on console and in X. It has always seemed to work for me. But from the very beginning there have been dozens of posts from people who find it only affects the console.

To the best of my knowledge, none of the people who have had this problem have found the underlying cause. They either change layout repeatedly until it "takes", or force it with setxkbmap.

Perhaps someone whose Pi has a different keyboard layout in and out of X (even after a reboot) could try the commands below, and if they still have the problem then please post the contents of /etc/default/keyboard.

Code: Select all

sudo setupcon
sudo udevadm trigger --subsystem-match=input --action=change

Zoandar
Posts: 55
Joined: Sat Apr 06, 2013 9:41 pm

Re: Keybaord layout issues in X

Mon Apr 15, 2013 4:03 am

I was having no luck whatsoever with my Rev2 Pi 512MB running Wheezy 7, trying to get any keyboard to create the correct symbols for all the keys. I first noticed this when I wanted to make the # symbol and SHIFT+3 was making the currency symbol for the UK pound. I then found the key that should make the \ and | symbols is making #. It doesn't matter what keyboard I use, or whether I use a powered USB hub or plug it directly into the Pi.

I can make the keyboard work properly by executing

Code: Select all

sudo setxkbmap -layout us
but only during the CURRENT X GUI session. It loses this setting if I close and restart X. And it has no effect on the key symbols produced at the console, which are always like mentioned above.

I had tried

Code: Select all

sudo setupcon 
but it had not helped. So I decided to try the following from within Terminal in X, after reading this post you had made:

Code: Select all

    sudo setxkbmap -layout us
    sudo udevadm trigger --subsystem-match=input --action=change
and then I rebooted. I now have the CORRECT symbols both from the console AND in the X GUI !! :)

THANK YOU !!!!! I had been working on this and Googling it for HOURS and nothing was working until I found this.

My current content of /etc/default/keyboard is now
  • XKBMODEL=”pc105”
    XKBLAYOUT=”us”
    XKBVARIANT=””
    XKBOPTIONS=””

    BACKSPACE=”guess”
The first 2 lines' settings I had edited manually just before executing the above code. Previously they were set to pc101 and gb, respectively.
- Zoandar -
Current:
Pi-Top Notebook with Pi 3 B v. 1.2
Older hardware:
Rpi Rev B - 512 MB with Rev 2 GertBoard

cdrobsonjr
Posts: 5
Joined: Tue Jun 11, 2013 1:13 am

Re: Keybaord layout issues in X

Tue May 03, 2016 9:53 pm

Those Brits! Drive on the wrong side and layout keyboards wrong too! :lol:

DirkS
Posts: 9460
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Keybaord layout issues in X

Tue May 03, 2016 9:57 pm

cdrobsonjr wrote:Those Brits! Drive on the wrong side and layout keyboards wrong too! :lol:
Yes, and I have to deal with that every day :roll:

Sirfamol85
Posts: 1
Joined: Sun May 21, 2017 2:50 am

Re: Keybaord layout issues in X

Sun May 21, 2017 2:52 am

Thank you you saved the day

sloclone100
Posts: 1
Joined: Wed Nov 29, 2017 3:03 am

Re: Keybaord layout issues in X

Wed Nov 29, 2017 3:11 am

THANK YOU!!!

I resorted to trying to type ASCII characters! After searching this forum so many people still have the 'temporary' solution. Those two commands fixed it for good. I read somewhere else that there is a file you can edit. I tried several keyboards before realizing it was in UK mode. I should have looked here first! :roll:

-Dave

spencerspear
Posts: 1
Joined: Thu Feb 15, 2018 8:13 pm

Re: Keybaord layout issues in X

Thu Feb 15, 2018 8:15 pm

Simplest solution which worked for me:

1. Edit /etc/default/keyboard file
2. Change XKBLAYOUT=”gb” to XKBLAYOUT=”us”
3. Reboot


Code:

Code: Select all

sudo nano /etc/default/keyboard

Code: Select all

XKBLAYOUT=”us”

Code: Select all

sudo reboot
Voila!

Return to “Beginners”