You are not logged in.

#1 2013-12-09 13:43:19

luther7hrol
Member
Registered: 2013-12-09
Posts: 33

setxkbmap from GUI

Hello!

I'm trying to set up quick little keyboards layout chooser which would on icon/applet click execute this command:

$ setxkbmap -rules evdev -layout es -model evdev

but, when I include this in "Create a new launcher" on desktop, either through "execute this command in terminal" or
directly, it doesn't do anything. Why is this not working from GUI and just from terminal? Can you maybe show me
how to write a little python GUI script that will execute this command, or point me to some link where I could learn this?

Thank you :-)

Last edited by luther7hrol (2013-12-09 13:44:31)

Offline

#2 2013-12-09 14:31:10

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 4,092
Website

Re: setxkbmap from GUI

I have my keyboard layout commands directly in my Openbox root menu. For example, one entry in my menu simply calls "setxkbmap dvorak".

What GUI do you use? Please post the ".desktop" file you made.

Offline

#3 2013-12-09 14:38:41

Ashren
Member
From: Denmark
Registered: 2007-06-13
Posts: 1,229
Website

Re: setxkbmap from GUI

In your launcher you could use the following:

xterm -iconic -e "setxkbmap -rules evdev -layout es -model evdev && notify-send -t 1000 'layout changed to es'; exit"

But this isn't needed when I think about it. I'm running setxkbmap from xmonad startupHook, and it is running fine without a terminal. You can skip the xterm part, I'll leave the above command here, you might be interested in the notify-send part.

Last edited by Ashren (2013-12-09 14:42:40)

Offline

#4 2013-12-09 15:55:31

luther7hrol
Member
Registered: 2013-12-09
Posts: 33

Re: setxkbmap from GUI

<drcouzelis> I use Cinnamon GUI (fork of GNOME). Here's .desktop file I tried with:

[Desktop Entry]
Comment=Choose Spanish Keymap
Terminal=false # tried with true, too
Name=es
Exec=setxkbmap -rules evdev -layout es -model evdev
Type=Application
Icon=gnome-panel-launcher

Maybe I could try writing my own cinnamon applet including setxkbmap command?

<Ashren> Thank you, it works with xterm part! :-) How do I do it without xterm, because when I exclude the xterm command, it doesn't do anything.
The notify-send little thing is great, i didn't know how to use it before so I've learnt something today.

Could you guys maybe tell me how this can be done from python, if it could be done easily, just curious to learn how to do it from different perspectives smile

Last edited by luther7hrol (2013-12-09 15:58:03)

Offline

#5 2013-12-10 08:15:36

Ashren
Member
From: Denmark
Registered: 2007-06-13
Posts: 1,229
Website

Re: setxkbmap from GUI

luther7hrol:

After researching a bit it seems that commands like this should be executed within a shell:

[Desktop Entry]
Version=1.0
Type=Application
Name=test
Comment=test
Exec=bash -c "setxkbmap -rules evdev -layout es -model evdev && notify-send -t 1000 'layout changed to es'"
Icon=accessories-character-map
Path=/bin
Terminal=false
StartupNotify=false

Last edited by Ashren (2013-12-10 08:24:55)

Offline

#6 2013-12-10 20:43:10

luther7hrol
Member
Registered: 2013-12-09
Posts: 33

Re: setxkbmap from GUI

Thank you my friend :-)

Offline

Board footer

Powered by FluxBB