SEARCH

Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#1 2009-02-26 03:24:08

nabilalk
#! Die Hard
From: U.S.A.
Registered: 2009-01-28
Posts: 531

Temporarily switch Keyboard layouts in Openbox [Resolved]

Hey all, I have seen a number of posts on here about changing the keyboard layout from one language to another, but I have not seen any suggestions on temporarily switching the layout. I have a Spanish penpal and would like to be able to toggle between US keyboard (default) Spanish Macintosh via a keyboard shortcut.

I have found that I can switch the layouts via a programmed keyboard shortcut if I start up:

 gnome-keyboard-properties

or

xfce-setting-show keyboard

However, the shortcut doesn't work unless one of these two managers is first started up. This presents some problems as both Gnome and xfce4 take over the font, theme, and panel display settings and change my overall openbox theme (which I love btw ;-). I want to use Openbox and would prefer to not have to use something else in order to switch the layouts.  I noticed that Gnome has a Keyboard Indicator panel option. Is this possible with Openbox?

I see that there are some keyboard layout entries in autostart.sh.  If I enable one for Spanish, can I set a shortcut to switch layouts via Preferences>OpenBox config>Edit rc.xml?

# Set keyboard map if different than UK
# Uncomment one to enable, or define your own.
#setxkbmap us & # United States
# setxkbmap ca & # Canada
# setxkbmap fr & # Francais
# setxkbmap br & # Brazil
# setxkbmap de & # Germany
# setxkbmap cz & # Czech Republic
# setxkbmap it & # Italy
# setxkbmap pl & # Poland
# setxkbmap nl & # Netherlands
# etc.

How can I set a shortcut to quickly switch between keyboard layouts? Do I have to use Gnome, xfce4-mcs-manager or is there another way? Thanks, there has gotta be a way to do this that doesn't require the use of another desktop manager (at least I hope so...)

Last edited by nabilalk (2009-02-26 21:44:58)


#! 10 “Statler” r20110207 32-bit & Openbox

Offline

Help fund CrunchBang, donate to the project!

#2 2009-02-26 03:32:58

corenominal
WRONG
From: Lincoln, UK
Registered: 2008-11-20
Posts: 5,058
Website

Re: Temporarily switch Keyboard layouts in Openbox [Resolved]

nabilalk wrote:

How can I set a shortcut to quickly switch between keyboard layouts? Do I have to use Gnome, xfce4-mcs-manager or is there another way? Thanks, there has gotta be a way to do this that doesn't require the use of another desktop manager (at least I hope so...)

Hello nabilalk smile

You should be able to quickly switch keyboard layouts by entering the setxkbmap xx command in your terminal. Replace xx with the 2 letter country code for the desired layout. Hope this helps.

Offline

#3 2009-02-26 04:06:26

nabilalk
#! Die Hard
From: U.S.A.
Registered: 2009-01-28
Posts: 531

Re: Temporarily switch Keyboard layouts in Openbox [Resolved]

corenominal wrote:
nabilalk wrote:

How can I set a shortcut to quickly switch between keyboard layouts? Do I have to use Gnome, xfce4-mcs-manager or is there another way? Thanks, there has gotta be a way to do this that doesn't require the use of another desktop manager (at least I hope so...)

Hello nabilalk smile

You should be able to quickly switch keyboard layouts by entering the setxkbmap xx command in your terminal. Replace xx with the 2 letter country code for the desired layout. Hope this helps.

Thanks corenominal, that works great! Thanks to that handy cmd  setxkbmap xx, I was able to make a .desktop file for each keyboard layout and add items to the application launch bar. I was also able to set  keyboard shortcuts, by adding to rc.xml.

I used Ctrl-Shift-Alt-Right for Spanish layout and Ctrl-Shift-Alt-Left to switch back to the default English (US) layout. Hopefully some other people can benefit from the trial and error. For anyone who is interested in the .desktop files along with the .png's needed for the application launch bar icons, and instructions click the link to download the zipped archive: http://dl.getdropbox.com/u/23293/keyboa … switch.zip See below for the code to add to rc.xml to program the keyboard shortcuts.

 </action>
    </keybind>
    <keybind key="C-S-A-Right">
      <action name="Execute">
        <startupnotify>
          <enabled>true</enabled>
          <name>Spanish_keyboad_layout</name>
        </startupnotify>
        <command>setxkbmap es</command>
      </action>
    </keybind>
    <keybind key="C-S-A-Left">
      <action name="Execute">
        <startupnotify>
          <enabled>true</enabled>
          <name>English_keyboad_layout</name>
        </startupnotify>
        <command>setxkbmap us</command>
      

Edit: code entered incorrectly, should begin with <action> line and end with <command> line

Last edited by nabilalk (2010-02-06 00:51:33)


#! 10 “Statler” r20110207 32-bit & Openbox

Offline

#4 2009-10-31 11:57:27

catch22
#! Junkie
From: Belgium, Europe
Registered: 2009-10-16
Posts: 482
Website

Re: Temporarily switch Keyboard layouts in Openbox [Resolved]

corenominal wrote:

,,,You should be able to quickly switch keyboard layouts by entering the setxkbmap xx command in your terminal. Replace xx with the 2 letter country code for the desired layout...

Please allow me to add a warning here, just in case someone makes the same mistake I did neutral
I sometimes want to practice my Greek, so I was looking for a way to quickly switch keyboard.
But typing:

ludo@ludo-desktop:~$ setxkbmap el

didn't leave me with 2 keyboards and an option to switch, it just changed it to greek!

For getting back to normal I did the following: ctrl c the word  setxkbmap and ctrl v it in the browser search.
There I could copy the words setxkbmap de and paste it in terminal - then, having Latin characters again, changed back to setxkbmap be 

ludo@ludo-desktop:~$ setxkbmap βε
Error loading new keyboard description
ludo@ludo-desktop:~$ setxkbmap de
ludo@ludo-desktop:~$ setxkbmap be

Now if anyone knows how I can switch easily between greek and belgian keyboard through shortcut keys I'd be happy cool

Last edited by catch22 (2009-10-31 12:17:43)


#!+mocp=music in my ears

Offline

#5 2009-10-31 16:39:01

catch22
#! Junkie
From: Belgium, Europe
Registered: 2009-10-16
Posts: 482
Website

Re: Temporarily switch Keyboard layouts in Openbox [Resolved]

nabilalk wrote:

...I was also able to set  keyboard shortcuts, by adding to rc.xml...

 </action>
        ==snipped==
  </keyboard>

Hi nabilalk
I copied the above code and changed the keyboards to be and el for Belgium and Greece.
Then I pasted it in rc.xml but the layouts don't change even after reboot.
I got a message when opening the xml file:

XML Parsing Error: mismatched tag. Expected: </applications>.
Location: file:///home/catch22/.config/openbox/rc.xml
Line Number 741, Column 5:  </action>
----^

I sort of randomly put the code in, not knowing if it'd make a difference.
Any pointers how to do it correctly?


#!+mocp=music in my ears

Offline

#6 2009-10-31 17:06:32

pvsage
Internal Affairs
From: North Carolina
Registered: 2009-10-18
Posts: 12,789

Re: Temporarily switch Keyboard layouts in Openbox [Resolved]

XML is a lot like HTML in that every <tag foo> needs a </tag> after it, e.g.

    <keybind key="W-1">
      <action name="Execute">
        <command>mocp --toggle-pause</command>
      </action>
    </keybind>

If the action's name is something understood internally by Openbox, the / can be at the end of the action line like thus:

    <keybind key="A-Tab">
      <action name="NextWindow"/>
    </keybind>

Hope this helps!  By the way, I <3 your sig.

Last edited by pvsage (2009-10-31 17:07:37)


I'm a moderator here.  How are we doing?  Feedback is encouraged.

Offline

#7 2009-10-31 17:38:34

catch22
#! Junkie
From: Belgium, Europe
Registered: 2009-10-16
Posts: 482
Website

Re: Temporarily switch Keyboard layouts in Openbox [Resolved]

pvsage wrote:

XML is a lot like HTML in that every <tag foo> needs a </tag> after it...
By the way, I <3 your sig.

thanks, it's my 1st sig ever on any forum smile

If I understand right, the code I copied 1st time was incorrect because it started with end tags.
So I took them off (1st 2 lines if I remember ok) and pasted this in the rc.xml:

<keybind key="C-S-A-Right">
      <action name="Execute">
        <startupnotify>
          <enabled>true</enabled>
          <name>Greek_keyboard_layout</name>
        </startupnotify>
        <command>setxkbmap el</command>
      </action>
    </keybind>
    <keybind key="C-S-A-Left">
      <action name="Execute">
        <startupnotify>
          <enabled>true</enabled>
          <name>Belgian_keyboard_layout</name>
        </startupnotify>
        <command>setxkbmap be</command>
      </action>
    </keybind>
  </keyboard>

but I got a notification at reboot about "openbox syntax error".
Strange thing is, that the line the error is pointing at is 848 (the very last line of the file), whereas I pasted the code at lines 741 to 759.


#!+mocp=music in my ears

Offline

#8 2009-10-31 18:11:19

VILLA21
Member
From: Greece
Registered: 2009-09-16
Posts: 44
Website

Re: Temporarily switch Keyboard layouts in Openbox [Resolved]

have a look at this thread, 1st post:
http://crunchbanglinux.org/forums/topic … ang-linux/
btw, why do you want to learn Greek? smile


.::Blood just looks the same when you open the veins::.

Offline

#9 2009-10-31 19:14:54

catch22
#! Junkie
From: Belgium, Europe
Registered: 2009-10-16
Posts: 482
Website

Re: Temporarily switch Keyboard layouts in Openbox [Resolved]

VILLA21 wrote:

have a look at this thread, 1st post:
http://crunchbanglinux.org/forums/topic … ang-linux/
btw, why do you want to learn Greek? smile

that looks complicated to me, but I'll give it a shot. edit: I tried and got stuck (posted a reply in that topic)

I first got interested in Greek by listening to smyrneïka and rembetika.
After a visit to Greece I decided to take evening classes and did so for 2 years.
Needless to say I'm not perfect in Greek, but it's fun to go there and be able to have at least some conversation in a village where there are no tourists and nobody speaks any English smile

Last edited by catch22 (2009-10-31 19:35:06)


#!+mocp=music in my ears

Offline

#10 2009-11-01 09:02:06

Blitz
#! Member
From: Athens , Greece
Registered: 2009-10-12
Posts: 52
Website

Re: Temporarily switch Keyboard layouts in Openbox [Resolved]

Well someone who wants to learn my native language tongue

This is what i have changed in my rc.xml to switch between greek and english layouts

<keybind key="W-F1">
      <action name="Execute">
        <startupnotify>
          <enabled>false</enabled>
          <name>English Keyboard</name>
        </startupnotify>
        <command>setxkbmap -model pc105 -layout us</command>
      </action>
    </keybind>
    <keybind key="W-F2">
      <action name="Execute">
        <startupnotify>
          <enabled>false</enabled>
          <name>Greek Keyboard</name>
        </startupnotify>
        <command>setxkbmap -model pc105 -layout gr</command>
      </action>


I don't these shortcuts for desktop changing so they seemed fine , you can use any other combination ...

BTW it is cool that you want to learn Greek , it is pretty difficult though wink . If you need any help pm me


On receiving an interrupt, decrement the counter to zero

Offline

#11 2009-11-01 10:09:51

catch22
#! Junkie
From: Belgium, Europe
Registered: 2009-10-16
Posts: 482
Website

Re: Temporarily switch Keyboard layouts in Openbox [Resolved]

Blitz wrote:

...BTW it is cool that you want to learn Greek , it is pretty difficult though wink . If you need any help pm me

Thanks, I'll keep that in mind smile
So far I had syntax errors every time I changed anything in the rc.xml though; does it matter exactly where in the file I paste the code??

BTW the problem seemed solved yesterday, but that solution is gone this morning.
The workaround was here:
http://crunchbanglinux.org/forums/post/43625/#p43625


#!+mocp=music in my ears

Offline

#12 2009-11-01 12:40:39

catch22
#! Junkie
From: Belgium, Europe
Registered: 2009-10-16
Posts: 482
Website

Re: Temporarily switch Keyboard layouts in Openbox [Resolved]

catch22 wrote:

So far I had syntax errors every time I changed anything in the rc.xml though; does it matter exactly where in the file I paste the code??

BTW the problem seemed solved yesterday, but that solution is gone this morning.
The workaround was here:
http://crunchbanglinux.org/forums/post/43625/#p43625

this is getting heavy (for me at least)...
I pasted the code in rc.xml and uncommented the older settings for W-F1 and W-F2
At reboot I got a syntax error again, this time it said "Premature end of data in tag openbox_config line 2"

NOTHING worked anymore, but after desperately banging (well, gently really wink) some random keys, I managed to enter the terminal and undo the changes in /.config/openbox/rc.xml

I think I might leave it and wait and see if maybe in 9.10 there'll be a secure way of using 2 keyboard layouts.


#!+mocp=music in my ears

Offline

#13 2009-11-01 15:26:49

Blitz
#! Member
From: Athens , Greece
Registered: 2009-10-12
Posts: 52
Website

Re: Temporarily switch Keyboard layouts in Openbox [Resolved]

Your command starts with </keybind> then the keybind key and the body of the command , and ti ends with </action> .  If that isn't helpful y don't you just try to change the commands in the original W-F1 and W-F2 keybinds ? That is what worked for me anyway.


On receiving an interrupt, decrement the counter to zero

Offline

#14 2009-11-02 19:47:08

catch22
#! Junkie
From: Belgium, Europe
Registered: 2009-10-16
Posts: 482
Website

Re: Temporarily switch Keyboard layouts in Openbox [Resolved]

Solved it via this thread:
http://crunchbanglinux.org/forums/post/43770/#p43770
Thank you all so much!


#!+mocp=music in my ears

Offline

Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.

Debian Logo