You are not logged in.

#1 2010-06-12 12:36:51

leniviy
Member
Registered: 2009-05-23
Posts: 177

assign keyboard layout switch hotkey not listed in the keyboard applet

I found some old tutorial to assign left alt+shift to 1st layout and right alt+shift to 2nd layout. How to adapt it to the modern hal way?
Here it is:

create $XKBROOT/mysym :

partial modifier_keys xkb_symbols "shift_ctrl_1" {
  key <LFSH> {
    type="PC_BREAK",
    symbols[Group1]= [ Shift_L, ISO_First_Group ]
  };
  key <RTSH> {
    type ="PC_BREAK",
    symbols[Group1]= [ Shift_R, ISO_Last_Group ]
  };
  key <LCTL> { [ Control_L, ISO_First_Group ] };
  key <RCTL> { [ Control_R, ISO_Last_Group ] };
};

add 1 line to $XKBROOT/rules/xorg (after "! option    =    symbols"):

! option    =    symbols
    myshiftctrl1          =       +mysym(shift_ctrl_1)

add option to xorg.conf :

! option    =    symbols
Section "InputDevice"
    ...
    Option "XkbOptions" "myshiftctrl1"
EndSection

Arch 64, xfce4

Offline

#2 2010-07-05 14:23:16

leniviy
Member
Registered: 2009-05-23
Posts: 177

Re: assign keyboard layout switch hotkey not listed in the keyboard applet

Found a temporary solution. Unfortunately It resets other options set in the corresponding gnome applet;

Instead of alt+shift it sets shift+alt to change layout. I tried to swap the key names in 'mysym' file, but it has no effect.

#!/bin/sh

xkbdir="`mktemp -d`" || exit $?
mkdir "$xkbdir/symbols"

cat>"$xkbdir/symbols/mysym" <<EOF
partial modifier_keys xkb_symbols "alt_shift_1" {
  key <LALT> {
    type="PC_BREAK",
    symbols[Group1]= [ Alt_L, ISO_First_Group ]
  };
  key <RALT> {
    type ="PC_BREAK",
    symbols[Group1]= [ Alt_R, ISO_Last_Group ]
  };
  key <LFSH> { [ Shift_L, ISO_First_Group ] };
  key <RTSH> { [ Shift_R, ISO_Last_Group ] };
};
EOF

setxkbmap -symbols "pc+us+ru:2+inet(evdev)+mysym(alt_shift_1)" -print | xkbcomp -w0 -I -I"$xkbdir" -I/usr/share/X11/xkb - $DISPLAY && rm -rf "$xkbdir"

Arch 64, xfce4

Offline

Board footer

Powered by FluxBB