Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
How can I change keymap in OpenRC
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
Megver83
n00b
n00b


Joined: 24 Sep 2016
Posts: 5

PostPosted: Tue Nov 29, 2016 12:09 am    Post subject: How can I change keymap in OpenRC Reply with quote

Hi everybody, I'd like to know how to change the keymap but without rebooting. If possible, a command, because I wanna include it in a bash script.
Thanks!
Back to top
View user's profile Send private message
Juippisi
Developer
Developer


Joined: 30 Sep 2005
Posts: 723
Location: /home

PostPosted: Tue Nov 29, 2016 9:14 am    Post subject: Reply with quote

In X environment, setxkbmap xy and in console I think its loadkeys xy. With systemd I think its localectl xy.

Is this what you were looking for?
Back to top
View user's profile Send private message
charles17
Advocate
Advocate


Joined: 02 Mar 2008
Posts: 3664

PostPosted: Tue Nov 29, 2016 9:19 am    Post subject: Re: How can I change keymap in OpenRC Reply with quote

Megver83 wrote:
I'd like to know how to change the keymap but without rebooting. !

What about the rc service?
Code:
# /etc/init.d/keymaps stop
# /etc/init.d/keymaps start
Back to top
View user's profile Send private message
michi-monster
Apprentice
Apprentice


Joined: 16 Aug 2016
Posts: 175
Location: Germany

PostPosted: Tue Jan 03, 2017 8:43 am    Post subject: Reply with quote

I do not want to run the setxkbmap manually each time. In which file is this saved?
_________________
www.edv-bildung.de
Back to top
View user's profile Send private message
Juippisi
Developer
Developer


Joined: 30 Sep 2005
Posts: 723
Location: /home

PostPosted: Tue Jan 03, 2017 10:26 am    Post subject: Reply with quote

michi-monster wrote:
I do not want to run the setxkbmap manually each time. In which file is this saved?


Depends on what WM or DE you use. In KDE / Gnome / XFce the option should be saved automatically. In openbox / i3 / bspwm etc you usually have an autostart script, or you start somewhere in the config file.
Back to top
View user's profile Send private message
Apheus
Guru
Guru


Joined: 12 Jul 2008
Posts: 422

PostPosted: Tue Jan 03, 2017 11:04 am    Post subject: Reply with quote

For console: /etc/conf.d/keymaps.

For X11: In xorg.conf or xorg.conf.d:

# cat /etc/X11/xorg.conf.d/10-keyboard.conf
Code:
Section "InputClass"
        Identifier      "system-keyboard"
        MatchIsKeyboard "on"
        Option          "XkbModel"      "pc105"
        Option          "XkbLayout"     "de"
        Option          "XkbVariant"    ""
EndSection


WMs/DEs should stick with that if not otherwise configured.
_________________
My phrenologist says I'm stupid.
Back to top
View user's profile Send private message
charles17
Advocate
Advocate


Joined: 02 Mar 2008
Posts: 3664

PostPosted: Tue Jan 03, 2017 1:46 pm    Post subject: Reply with quote

Apheus wrote:
WMs/DEs should stick with that if not otherwise configured.
Or use a keyboard layout switcher.
Back to top
View user's profile Send private message
michi-monster
Apprentice
Apprentice


Joined: 16 Aug 2016
Posts: 175
Location: Germany

PostPosted: Thu Jan 05, 2017 1:47 pm    Post subject: Reply with quote

Unfortunately, it does not work yet. It also occurs that the manual temporary change over setxkbmap de is disabled again after some time. I have adapted the files. Please take a look.


Code:
# Use keymap to specify the default console keymap.  There is a complete tree
# of keymaps in /usr/share/keymaps to choose from.
keymap="de"

# Should we first load the 'windowkeys' console keymap?  Most x86 users will
# say "yes" here.  Note that non-x86 users should leave it as "no".
# Loading this keymap will enable VT switching (like ALT+Left/Right)
# using the special windows keys on the linux console.
windowkeys="YES"

# The maps to load for extended keyboards.  Most users will leave this as is.
extended_keymaps=""
#extended_keymaps="backspace keypad euro2"

# Tell dumpkeys(1) to interpret character action codes to be
# from the specified character set.
# This only matters if you set unicode="yes" in /etc/rc.conf.
# For a list of valid sets, run `dumpkeys --help`
dumpkeys_charset=""

# Some fonts map AltGr-E to the currency symbol instead of the Euro.
# To fix this, set to "yes"
fix_euro="NO"

Code:

less /etc/X11less /etc/X11/xorg.conf.d/10-keyboard.conf
Section "InputClass"
        Identifier      "system-keyboard"
        MatchIsKeyboard "on"
        Option          "XkbModel"      "pc105"
        Option          "XkbLayout"     "de"
        Option          "XkbVariant"    ""
EndSection

Code:

neueKiste michi # rc-update
               binfmt | boot                                   
             bootmisc | boot                                   
                devfs |                                 sysinit
                dmesg |                                 sysinit
                 fsck | boot                                   
             hostname | boot                                   
              hwclock | boot                                   
              keymaps | boot                                   
            killprocs |                        shutdown       
    kmod-static-nodes |                                 sysinit
                local |      default nonetwork                 
           localmount | boot                                   
             loopback | boot                                   
              modules | boot                                   
             mount-ro |                        shutdown       
                 mtab | boot                                   
             netmount |      default                           
               procfs | boot                                   
                 root | boot                                   
            savecache |                        shutdown       
                 swap | boot                                   
               sysctl | boot                                   
                sysfs |                                 sysinit
         termencoding | boot                                   
         tmpfiles.dev |                                 sysinit
       tmpfiles.setup | boot                                   
                 udev |                                 sysinit
              urandom | boot                                   

_________________
www.edv-bildung.de
Back to top
View user's profile Send private message
Apheus
Guru
Guru


Joined: 12 Jul 2008
Posts: 422

PostPosted: Thu Jan 05, 2017 2:07 pm    Post subject: Reply with quote

Does X11 actually load the layout? Please post the result of

Code:
grep -i xkb /var/log/Xorg.0.log

_________________
My phrenologist says I'm stupid.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54220
Location: 56N 3W

PostPosted: Thu Jan 05, 2017 2:20 pm    Post subject: Reply with quote

Megver83,

The console is controlled by /etc/conf.d/keymaps
Code:
# Use keymap to specify the default console keymap.  There is a complete tree
# of keymaps in /usr/share/keymaps to choose from.
# keymap="uk"

keymap="dvorak-uk"


The default when Xorg loads comes from /etc/X11/xorg.conf or a file in /etc/X11/xorg.conf.d/

Code:
Section "InputDevice"

    Identifier  "Keyboard"
    Driver      "evdev"
    Option      "Device"     "/dev/input/event1"

    Option "AutoRepeat" "500 30"
    Option "xkblayout" "gb"

# comment out the next line if you don't have a dvorak keyboard
    Option "xkbvariant" "dvorak"

    Option "XkbRules"  "xorg"
    Option "XkbModel"  "pc105"
# why "pc102"
    Option "XkbOptions"  "ctrl:swapcaps"

EndSection


Your DE/WM may change it when it loads too. The above works for Xfce4
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7470

PostPosted: Thu Jan 05, 2017 2:40 pm    Post subject: Reply with quote

InputDevice has been deprecated for InputClass (alas we have lost the excellent xorg upgrade guide while switching doc to wiki).
I'm also unsure if a keyboard will always get event1

Here's mine that do really work (it aim to match all keyboards connect), just change layout to your needs.
/etc/X11/xorg.conf.d/97evdev.conf
Code:
Section "InputClass"
        Identifier "keyboard-all"
        MatchIsKeyboard "on"
        MatchDevicePath "/dev/input/event*"
        Driver "evdev"
        Option "XkbLayout" "fr"
        Option "XkbRules"  "xorg"
        Option "XkbModel"  "pc105"
        Option "AutoServerLayout" "on"
EndSection
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54220
Location: 56N 3W

PostPosted: Thu Jan 05, 2017 3:06 pm    Post subject: Reply with quote

krinn'

Well caught.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
michi-monster
Apprentice
Apprentice


Joined: 16 Aug 2016
Posts: 175
Location: Germany

PostPosted: Thu Jan 05, 2017 3:08 pm    Post subject: Reply with quote

Apheus wrote:
Does X11 actually load the layout? Please post the result of

Code:
grep -i xkb /var/log/Xorg.0.log


Code:
michi@neueKiste ~ $ su
Passwort:
neueKiste michi # setxkbmap de
neueKiste michi # grep -i xkb /var/log/Xorg.0.log
[   175.156] (**) Option "xkb_rules" "evdev"
[   175.156] (**) Option "xkb_model" "pc105"
[   175.156] (**) Option "xkb_layout" "de"
[   175.192] (**) Option "xkb_rules" "evdev"
[   175.192] (**) Option "xkb_model" "pc105"
[   175.192] (**) Option "xkb_layout" "de"
[   175.192] (**) Option "xkb_rules" "evdev"
[   175.192] (**) Option "xkb_model" "pc105"
[   175.192] (**) Option "xkb_layout" "de"
[   175.333] (**) Option "xkb_rules" "evdev"
[   175.333] (**) Option "xkb_model" "pc105"
[   175.333] (**) Option "xkb_layout" "de"
[   175.334] (**) Option "xkb_rules" "evdev"
[   175.334] (**) Option "xkb_model" "pc105"
[   175.334] (**) Option "xkb_layout" "de"
[   175.335] (**) Option "xkb_rules" "evdev"
[   175.335] (**) Option "xkb_model" "pc105"
[   175.335] (**) Option "xkb_layout" "de"
[   175.337] (**) Option "xkb_rules" "evdev"
[   175.337] (**) Option "xkb_model" "pc105"
[   175.337] (**) Option "xkb_layout" "de"
[   175.338] (**) Option "xkb_rules" "evdev"
[   175.338] (**) Option "xkb_model" "pc105"
[   175.338] (**) Option "xkb_layout" "de"
[   175.340] (**) Option "xkb_rules" "evdev"
[   175.340] (**) Option "xkb_model" "pc105"
[   175.340] (**) Option "xkb_layout" "de"
[   175.340] (**) Option "xkb_rules" "evdev"
[   175.340] (**) Option "xkb_model" "pc105"
[   175.341] (**) Option "xkb_layout" "de"

_________________
www.edv-bildung.de
Back to top
View user's profile Send private message
Apheus
Guru
Guru


Joined: 12 Jul 2008
Posts: 422

PostPosted: Thu Jan 05, 2017 3:12 pm    Post subject: Reply with quote

That shows the layout is loaded at X11 start time. Something else is changing it back after that.
_________________
My phrenologist says I'm stupid.
Back to top
View user's profile Send private message
michi-monster
Apprentice
Apprentice


Joined: 16 Aug 2016
Posts: 175
Location: Germany

PostPosted: Sat Jan 07, 2017 5:50 pm    Post subject: Reply with quote

Apheus wrote:
That shows the layout is loaded at X11 start time. Something else is changing it back after that.

What can i do?
_________________
www.edv-bildung.de
Back to top
View user's profile Send private message
Roman_Gruber
Advocate
Advocate


Joined: 03 Oct 2006
Posts: 3846
Location: Austro Bavaria

PostPosted: Sat Jan 07, 2017 7:23 pm    Post subject: Reply with quote

For your bootloader use this:

Code:
    linux ... keymap=de ...



I use i3wm. In my config file i use => setxkbmap de

Code:
roman@ASUS-G75VW ~ $ grep de .i3/config
# Please see http://i3wm.org/docs/userguide.html for a complete reference!
exec setxkbmap de


That works with openrc + eudev + bare minimum components.
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6920

PostPosted: Sun Jan 08, 2017 1:33 am    Post subject: Reply with quote

michi-monster wrote:
Apheus wrote:
That shows the layout is loaded at X11 start time. Something else is changing it back after that.

What can i do?

Check your desktop environment's settings.
Back to top
View user's profile Send private message
michi-monster
Apprentice
Apprentice


Joined: 16 Aug 2016
Posts: 175
Location: Germany

PostPosted: Sun Jan 08, 2017 8:40 am    Post subject: Reply with quote

Ant P. wrote:
michi-monster wrote:
Apheus wrote:
That shows the layout is loaded at X11 start time. Something else is changing it back after that.

What can i do?

Check your desktop environment's settings.


Itś done. - In gnome its in the configmenu set.

But now i found an other information: the error only in gnome exist. In fluxbox itś all right. In .xinitrc i set "exec setxkbmap de" . Only in gnome - are you new idea?
EDIT: another error:

Code:
neueKiste ~ # localectl | grep "System Locale"
Could not get properties: Eingabe-/Ausgabefehler

_________________
www.edv-bildung.de
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum