GNOME 3 startup setxkbmap

Everything about X, Gnome, KDE, ... and everything running on it

GNOME 3 startup setxkbmap

Postby hajder » 2015-07-19 23:48

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?
hajder
 
Posts: 19
Joined: 2009-10-10 09:02

Re: GNOME 3 startup setxkbmap

Postby Head_on_a_Stick » 2015-07-20 08:28

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
"Il semble que la perfection soit atteinte non quand il n'y a plus rien à ajouter, mais quand il n'y a plus rien à retrancher."
— Antoine de Saint Exupéry, Terre des Hommes (1939).
User avatar
Head_on_a_Stick
 
Posts: 7571
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: GNOME 3 startup setxkbmap

Postby hajder » 2015-07-21 01:44

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.
hajder
 
Posts: 19
Joined: 2009-10-10 09:02

Re: GNOME 3 startup setxkbmap

Postby Head_on_a_Stick » 2015-07-21 08:19

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

(As suggested in the Debian wiki page I linked)
"Il semble que la perfection soit atteinte non quand il n'y a plus rien à ajouter, mais quand il n'y a plus rien à retrancher."
— Antoine de Saint Exupéry, Terre des Hommes (1939).
User avatar
Head_on_a_Stick
 
Posts: 7571
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: GNOME 3 startup setxkbmap

Postby hajder » 2015-07-24 21:29

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 ?
hajder
 
Posts: 19
Joined: 2009-10-10 09:02

Re: GNOME 3 startup setxkbmap

Postby Head_on_a_Stick » 2015-07-24 21:38

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
"Il semble que la perfection soit atteinte non quand il n'y a plus rien à ajouter, mais quand il n'y a plus rien à retrancher."
— Antoine de Saint Exupéry, Terre des Hommes (1939).
User avatar
Head_on_a_Stick
 
Posts: 7571
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: GNOME 3 startup setxkbmap

Postby hajder » 2015-07-24 22:00

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.
hajder
 
Posts: 19
Joined: 2009-10-10 09:02

Re: GNOME 3 startup setxkbmap

Postby Head_on_a_Stick » 2015-07-24 22:15

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.
"Il semble que la perfection soit atteinte non quand il n'y a plus rien à ajouter, mais quand il n'y a plus rien à retrancher."
— Antoine de Saint Exupéry, Terre des Hommes (1939).
User avatar
Head_on_a_Stick
 
Posts: 7571
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: GNOME 3 startup setxkbmap

Postby hajder » 2015-07-29 04:59

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?
hajder
 
Posts: 19
Joined: 2009-10-10 09:02

Re: GNOME 3 startup setxkbmap

Postby Head_on_a_Stick » 2015-07-29 10:39

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?
"Il semble que la perfection soit atteinte non quand il n'y a plus rien à ajouter, mais quand il n'y a plus rien à retrancher."
— Antoine de Saint Exupéry, Terre des Hommes (1939).
User avatar
Head_on_a_Stick
 
Posts: 7571
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: GNOME 3 startup setxkbmap

Postby hajder » 2015-07-29 22:31

➜ ~ 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
hajder
 
Posts: 19
Joined: 2009-10-10 09:02

Re: GNOME 3 startup setxkbmap

Postby Head_on_a_Stick » 2015-07-30 07:47

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

Looks like you'll just have to use the dirty hack...
"Il semble que la perfection soit atteinte non quand il n'y a plus rien à ajouter, mais quand il n'y a plus rien à retrancher."
— Antoine de Saint Exupéry, Terre des Hommes (1939).
User avatar
Head_on_a_Stick
 
Posts: 7571
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: GNOME 3 startup setxkbmap

Postby ildgz » 2018-02-24 13:49

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.
ildgz
 
Posts: 3
Joined: 2018-01-27 15:37


Return to Desktop & Multimedia

Who is online

Users browsing this forum: No registered users and 8 guests

fashionable