You are not logged in.

#1 2009-05-07 09:52:05

zephyrus17
Member
Registered: 2008-06-15
Posts: 323

openbox keyboard layout switching without xorg.conf

The way in the wiki to have a non-us keyboard layout is through hal and 10-keymap.fdi, but how do I set it to have layout switching in openbox by pressing alt+shift?

Offline

#2 2009-05-07 10:13:49

whoops
Member
Registered: 2009-03-19
Posts: 891

Re: openbox keyboard layout switching without xorg.conf

Hi!

I'm not familiar with openbox, but if you have something that lets you define keyboard shortcuts, you can make it run
setxkbmap -layout [layout]
on different key combinations or do a small toggle script if you only want one key.

Offline

#3 2009-05-07 10:37:09

zephyrus17
Member
Registered: 2008-06-15
Posts: 323

Re: openbox keyboard layout switching without xorg.conf

Putting that in ~/.xinitrc? Would the key combination be "setxkboptions"?

Offline

#4 2009-05-07 11:07:55

DonVla
Member
From: Bonn, Germany
Registered: 2007-06-07
Posts: 997

Re: openbox keyboard layout switching without xorg.conf

zephyrus17 wrote:

Putting that in ~/.xinitrc? Would the key combination be "setxkboptions"?

i have this in my menu.xml for switching keyboard layouts:

<menu id="keyboard-menu" label="tastatur">
    <item label="de-kbd">
      <action name="Execute"><command>setxkbmap de</command></action>
    </item>
    <item label="us-kbd">
      <action name="Execute"><command>setxkbmap us</command></action>
    </item>
</menu>

or in your rc.xml use smth like:

    <keybind key="A-S-e">
      <action name="Execute">
        <command>setxkbmap us</command>
      </action>
    </keybind>
    <keybind key="A-S-d">
      <action name="Execute">
        <command>setxkbmap de</command>
      </action>
    </keybind>

alt-shift alone does not work. both are modifiers

Offline

#5 2009-05-07 11:28:52

whoops
Member
Registered: 2009-03-19
Posts: 891

Re: openbox keyboard layout switching without xorg.conf

Shouldn't there be tools included with xorg to fetch the currently used layout and do a simple toggle script? I don't know how, but some "one-liner" like...:

[pseydocode! me no bash, me not know where to get current layout from]

if $(getxkbmap -layout) == us; do setxkbmap -layout de; else do setxkbmap -layout us; done

[/yes, this is no working code! wink]

... that you "openbox-people" can write directly into your rc.xml - thing?

Last edited by whoops (2009-05-07 11:29:36)

Offline

#6 2009-05-07 11:58:31

DonVla
Member
From: Bonn, Germany
Registered: 2007-06-07
Posts: 997

Re: openbox keyboard layout switching without xorg.conf

whoops wrote:

Shouldn't there be tools included with xorg to fetch the currently used layout and do a simple toggle script? I don't know how, but some "one-liner" like...:

[pseydocode! me no bash, me not know where to get current layout from]

if $(getxkbmap -layout) == us; do setxkbmap -layout de; else do setxkbmap -layout us; done

[/yes, this is no working code! wink]

... that you "openbox-people" can write directly into your rc.xml - thing?

eg:

<keybind key="A-S-<key>">
      <action name="Execute">
        <command>bash -c "if $(getxkbmap -layout) == us; do setxkbmap -layout de; else do setxkbmap -layout us; done"</command>
      </action>
    </keybind>

Offline

#7 2009-05-07 12:10:20

zephyrus17
Member
Registered: 2008-06-15
Posts: 323

Re: openbox keyboard layout switching without xorg.conf

But since I'm not using xorg, wouldn't whoops' method be invalid?

The menu and rc.xml ideas are great, though.

Offline

#8 2009-05-07 12:56:03

whoops
Member
Registered: 2009-03-19
Posts: 891

Re: openbox keyboard layout switching without xorg.conf

Found that:

if [ `setxkbmap -print | grep xkb_symbols | awk '{print $4}' | awk -F"+" '{print $2}'` = us ] ;then setxkbmap de ; else setxkbmap us ; fi

here: http://bbs.archlinux.org/viewtopic.php?id=46581

works fine (with compiz), don't know if there's a better way to get the current layout's code, so:

<keybind key="A-S-<key>">
      <action name="Execute">
        <command>bash -c "if [ `setxkbmap -print | grep xkb_symbols | awk '{print $4}' | awk -F"+" '{print $2}'` = us ] ;then setxkbmap de ; else setxkbmap us ; fi"</command>
      </action>
    </keybind>

... might maybe do the trick for openbox.

But since I'm not using xorg

Are you not using xorg or not using the xorg.conf? What xserver do you use or can openbox run without? I don't get it... does the (if [ `setxkbmap -pri.....-) line above do anything pasted in a terminal?

Last edited by whoops (2009-05-07 12:57:06)

Offline

#9 2009-05-08 08:11:56

zephyrus17
Member
Registered: 2008-06-15
Posts: 323

Re: openbox keyboard layout switching without xorg.conf

Sorry. I'm not using xorg.conf, I meant.

Terminal output:

[gary@Belkadan ~]$ bash -c "if [ `setxkbmap -print | grep xkb_symbols | awk '{print $4}' | awk -F"+" '{print $2}'` = us ] ;then setxkbmap de ; else setxkbmap us ; fi"
bash: -c: line 0: syntax error near unexpected token `('
bash: -c: line 0: `if [ us(dvorak) = us ] ;then setxkbmap de ; else setxkbmap us ; fi'

Offline

#10 2009-05-08 09:41:31

rzodkiewka
Member
Registered: 2009-04-19
Posts: 41

Re: openbox keyboard layout switching without xorg.conf

You just need to cut off the brace in "us(dvorak)" expression:

$ bash -c "if [ `setxkbmap -print | grep xkb_symbols | awk '{print $4}' | awk -F"+" '{print $2}' | awk -F"(" '{print $1}'` = us ] ;then setxkbmap de ; else setxkbmap us ; fi"

However I guess you would like to change it to dvorak, so try:

$ bash -c "if [ `setxkbmap -print | grep xkb_symbols | awk '{print $4}' | awk -F"+" '{print $2}' | awk -F"(" '{print $1}'` = us ] ;then setxkbmap de ; else setxkbmap us dvorak ; fi"

Offline

#11 2009-06-17 08:13:37

alecmg
Member
Registered: 2008-12-21
Posts: 86

Re: openbox keyboard layout switching without xorg.conf

zephyrus17 wrote:

The way in the wiki to have a non-us keyboard layout is through hal and 10-keymap.fdi, but how do I set it to have layout switching in openbox by pressing alt+shift?

Here is part of my 10-keymap.fdi:

<merge key="input.xkb.layout" type="string">ee,ru</merge>
<merge key="input.xkb.options" type="string">grp:alt_shift_toggle,grp_led:scroll</merge>

Works like a charm


Xyne wrote:
"We've got Pacman. Wacka wacka, bitches!"

Offline

Board footer

Powered by FluxBB