You are not logged in.

#26 2009-09-14 13:39:32

anrxc
Member
From: Croatia
Registered: 2008-03-22
Posts: 835
Website

Re: Detecting current Xorg keyboard layout

jbromley wrote:
anrxc wrote:
veox wrote:

thanks for the code, weird there was no such utility already.

http://www.archlinux.org/packages/search/?q=xxkb

So certainly similar software existed, but still there was none that did exactly what I wanted.

Of course it existed, not only it existed as some obscure utility, but was also in the repos. That is all. I don't think your utility is a waste of time.


You need to install an RTFM interface.

Offline

#27 2009-10-21 18:30:22

veox
Member
Registered: 2008-10-28
Posts: 48
Website

Re: Detecting current Xorg keyboard layout

Does this work with Ruby 1.9? On a quick check, there's some trouble with SWIG or something. Sorry, I don't have the time to investigate right now.

Offline

#28 2010-01-31 21:37:30

Goosfrabaa
Member
Registered: 2010-01-31
Posts: 9

Re: Detecting current Xorg keyboard layout

yhager wrote:

jbromley, thanks for the code, it works perfectly.
...
...

I uses two layouts under Window Maker: hungarian and usa. (Yes my favorite window manager is very old, but quick, and small).
I set my wm, when I push the ScrollLock button it is changes the actual layout another and vica versa (flip-flop).
I wrote an example file with doityourself adesklet http://adesklets.sourceforge.net/desklets.html which is check and show the actual Xorg keyboard layout, and can change it (predefinied values) if I click on.

Here is my xkeyboard.sh script:

#!/bin/bash
#
# This is a back-end script for doityourself. It displays the output
# of the setxkbmap layout, and changes from us to hungarian layout
# or from hungarian to us layout

case $1 in
        init)   echo "<font 'VeraMono/15'/>"
                echo "<background.color None/>" ;;
        test)   keymap=$(setxkbmap -v | awk -F "+" '/symbols/ {print $2}')
                echo ${keymap:0:2} ;;
        click)  if (setxkbmap -v | grep -q hu)
                    then exec setxkbmap us
                    else exec setxkbmap -layout "hu(qwerty)"
                fi ;;
        *)      echo "Usage: $0 [ init | test | click ] test-value"
esac

This code should just copy your ~/.desklets/doityourself-0.4.1/scripts/ directory, and should to change a ~/.desklets/doityourself-0.4.1/scripts/ config.txt last lines:

id0 = {'rawmode': False, 'script': 'xkeyboard.sh'}

That's it!

Last edited by Goosfrabaa (2010-01-31 21:38:29)

Offline

Board footer

Powered by FluxBB