Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

GNOME 3 startup setxkbmap

Graphical Environments, Managers, Multimedia & Desktop questions.
Post Reply
Message
Author
hajder
Posts: 19
Joined: 2009-10-10 09:02

GNOME 3 startup setxkbmap

#1 Post by hajder »

I'm trying to execute a custom setxkbmap command upon startup so that I have the correcty layout when logging in.

I have tried placing the command in different files after reading through the man pages for Xsession, Xsession.options, xinitrc etc.

~/.gnomerc
~/.xsession
~/.xinitrc

but to no avail. Anything I'm missing here?

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: GNOME 3 startup setxkbmap

#2 Post by Head_on_a_Stick »

GNOME doesn't parse those files.

Try creating a .desktop file in /usr/share/gnome/autostart

By way of an example, here is the one I use(d to use) to start an rxvt-unicode daemon:

Code: Select all

# /usr/share/gnome/autostart/rxvt-unicode-daemon.desktop
[Desktop Entry]
Type=Application
Name=rxvt-unicode-daemon
Exec=urxvtd -q -f -o
EDIT: Actually this is an XY problem...

Use this instead:

Code: Select all

# dpkg-reconfigure keyboard-configuration
https://wiki.debian.org/Keyboard
deadbang

hajder
Posts: 19
Joined: 2009-10-10 09:02

Re: GNOME 3 startup setxkbmap

#3 Post by hajder »

Thanks, it's certainly some variant of the XY-problem. See, I tried to use localectl command, but it didn't list my custom layout. - not sure if it would achieve the same result.

Now in

Code: Select all

 dpkg-reconfigure keyboard-configuration
I don't get the new variant listed have included in the

Code: Select all

/usr/share/X11/xkb/symbols/se
file.

However doing, setxkbmap se -variant <mycustomlayout> is fine. But I want it listed
in those configuration tools.

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: GNOME 3 startup setxkbmap

#4 Post by Head_on_a_Stick »

Have you tried editing /etc/default/keyboard directly?

(As suggested in the Debian wiki page I linked)
deadbang

hajder
Posts: 19
Joined: 2009-10-10 09:02

Re: GNOME 3 startup setxkbmap

#5 Post by hajder »

I tried that, but I cannot get my custom layout to be displayed in the list even for the
dpkg-reconfigure script. Also I would assume that /etc/default/keyboard would read the values in
/usr/share/X11/xkb/symbols/se ?

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: GNOME 3 startup setxkbmap

#6 Post by Head_on_a_Stick »

OK, make the .desktop file then.

Code: Select all

# cat > /usr/share/gnome/autostart/keyboard.desktop << "EOF"
[Desktop Entry]
Type=Application
Name=setxkbmap
Exec=setxkbmap se -variant <your custom layout>
EOF
Inelegant and hacky as hell, but it should work.

Is your layout listed in the output of:

Code: Select all

localectl list-keymaps|grep se
deadbang

hajder
Posts: 19
Joined: 2009-10-10 09:02

Re: GNOME 3 startup setxkbmap

#7 Post by hajder »

Sorry if I wasn't clear about the .desktop. I'd already configured that. But since I want to move away
from any ugly hacks I tried the localectl approach.

First of all,

Code: Select all

localectl list-keymaps
yields an error about

"Couldn't find any console keymaps". So I searched for this error and installed the console-data package, but still same message.

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: GNOME 3 startup setxkbmap

#8 Post by Head_on_a_Stick »

hajder wrote:

Code: Select all

localectl list-keymaps
yields an error about

"Couldn't find any console keymaps".
Please post error messages verbatim (using code tags) rather than paraphrasing them.

https://bugs.debian.org/cgi-bin/bugrepo ... bug=790955

The `localectl` command just creates a keyboard configuration file in /etc/X11/xorg.conf.d/00-keyboard.conf -- you can create such a file manually.

Code: Select all

# cat > /etc/X11/xorg.conf.d/00-keyboard.conf << "EOF"
Section "InputClass"
        Identifier "system-keyboard"
        MatchIsKeyboard "on"
        Option "XkbLayout" "se"
        Option "Xkbvariant" "<your custom layout>"
EndSection
EOF
Was your edit of /etc/default/keyboard successful?

AFAIUI, `dpkg-reconfigue keyboard-configuration` just edits that file.
deadbang

hajder
Posts: 19
Joined: 2009-10-10 09:02

Re: GNOME 3 startup setxkbmap

#9 Post by hajder »

1. I didn't have a /etc/X11/xorg.conf.d/ directory, so I created it with that 00-keyboard.conf file. Still not activated upon login.

2. So it seems that ugly-hack is the only thing working?

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: GNOME 3 startup setxkbmap

#10 Post by Head_on_a_Stick »

hajder wrote:I created it with that 00-keyboard.conf file. Still not activated upon login.
GNOME must be over-riding it (bad GNOME!).

What is the content of your /etc/default/keyboard?
deadbang

hajder
Posts: 19
Joined: 2009-10-10 09:02

Re: GNOME 3 startup setxkbmap

#11 Post by hajder »

➜ ~ cat /etc/default/keyboard
# KEYBOARD CONFIGURATION FILE

# Consult the keyboard(5) manual page.

XKBMODEL="pc105"
XKBLAYOUT="se"
XKBVARIANT="svorak"
XKBOPTIONS=""

BACKSPACE="guess"
➜ ~
From terminal, this cmd works
setxkbmap se -variant svorak

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: GNOME 3 startup setxkbmap

#12 Post by Head_on_a_Stick »

Well I have no idea why that's not working as it should :?

Looks like you'll just have to use the dirty hack...
deadbang

ildgz
Posts: 3
Joined: 2018-01-27 15:37
Contact:

Re: GNOME 3 startup setxkbmap

#13 Post by ildgz »

hajder wrote:I'm trying to execute a custom setxkbmap command upon startup so that I have the correcty layout when logging in.

I have tried placing the command in different files after reading through the man pages for Xsession, Xsession.options, xinitrc etc.

~/.gnomerc
~/.xsession
~/.xinitrc

but to no avail. Anything I'm missing here?
The same problem on Debian 9. I'm going to try the .desktop solution.

Post Reply