swap/re-map ctrl alt keys lxde/lubuntu (mac like behavior)

Please post all general support questions for LXDE here.
Locked
lubhna
Posts: 1
Joined: Thu Nov 29, 2012 11:44 pm

swap/re-map ctrl alt keys lxde/lubuntu (mac like behavior)

Post by lubhna »

I'd like to swap ctrl and alt keys on my laptop-PC (make it behave like a mac). I know I can map alt to ctrl & alt to win keys using lxkeymap layout options. I'm not that familiar with LXDE/Lubuntu. It would be great if the answer contains step by step instructions on how to do it.
Any help is highly appreciated.

LXDE is pretty fast...!!!
M_Mynaardt
Posts: 72
Joined: Wed Dec 15, 2010 9:37 pm
Location: Victoria, BC, Canada

Re: swap/re-map ctrl alt keys lxde/lubuntu (mac like behavio

Post by M_Mynaardt »

lubhna wrote:I'd like to swap ctrl and alt keys on my laptop-PC (make it behave like a mac). I know I can map alt to ctrl & alt to win keys using lxkeymap layout options. I'm not that familiar with LXDE/Lubuntu. It would be great if the answer contains step by step instructions on how to do it.
Any help is highly appreciated.

LXDE is pretty fast...!!!
I use Lubuntu too and have customized the keyboard settings to my own liking. I had to learn all about this to make my own short-cuts using the "Windoze" key on my computer. And when I say I learnt it, I really mean that I had a lot of help in forums like this, of course!

I'm not too sure what key combinations you want exactly, but once you figure this out, you should be able to set them to your heart's content.

First, you need to go to the file ~/.config/openbox/lubuntu-rc.xml -- this is a file you need to be careful with if you don't want to make a mess of your keyboard settings. Make sure you have a back up in case things go amiss.

Then look for the section starting with "<keyboard>" and ending with "</keyboard>". In between those will be a good number of keybinding settings that should be easy to figure out. Each stars with "<keybind>" and ends with "</keybind>". Their format should be pretty easy to figure out once you have a good look at a few of them.

Here's one example; one of my own I made once I actually knew what I was doing with this file. This is for my locking the screen on my laptop if I step away from it and don't want anyone to pry:

Code: Select all

 <!-- Super-L to lock the screen with the screen saver -->
    <keybind key="W-l">
      <action name="Execute">
        <command>xscreensaver-command -lock</command>
      </action>
    </keybind>
Here's one of the default keybindings in ~/.config/openbox/lubuntu-rc.xml; it's the short-cut to take you to work space 2:

Code: Select all

 <keybind key="W-F2">
       <action name="Desktop">
         <desktop>2</desktop>
       </action>
     </keybind>
The only thing that you need to be careful of is that any keybindings you create don't conflict with ones that are already there. When I made my own short-cuts to use the Windows/Super key, I didn't realize there was already two keybindings in there to open the LXDE menu if only the (right or left) Windows key was pressed, which meant my keybindings didn't work until I removed those two.

That's probably a bit long winded. But it took me a little bit of trial and error (read: mostly error) to get that keybinding business figured out.

And if you need it, here's a 'cheat sheet' of the default keybindings in Lubuntu:

Keybindings for desktop switching
Ctrl-Alt-Left; move to desktop to the left
Ctrl-Alt-Right; move to desktop to the right
Ctrl-Alt-up; move to desktop above
Ctrl-Alt-down; move to desktop below
Shift-Alt-Left; move current app to desktop to the left
Shift-Alt-Right; move current app to desktop to the right
Shift-Alt-up; move current app to desktop above
Shift-Alt-down; move current app to desktop below
Windows-F1; go to desktop # 1
Windows-F2; go to desktop # 2
Windows-F3; go to desktop # 3
Windows-F4; go to desktop # 4

Keybindings for Windows (i.e. "Windoze" wannabes sort of thing)
Alt-F4; close the current app (like Ctrl-q)
Alt-Esc; focus to the (app on the) bottom
Alt-Space; open the client menu for the current app

Keybindings for Window (app) switching
Alt-Tab; switch to next (app) window
Alt-Shift-Tab; switch to previous (app) window
Ctrl-Alt-Tabl; switch to next (app) window

Keybindings for LXPanel (LXDE menu)
Alt-F1; open LXDE menu
Alt-F2; open LXPanel run command
Ctrl-Esc; open LXDE menu
Super-l; open LXDE menu (left Windoze key)
Super-r; open LXDE menu (right Windoze key, if there is one)

Toggle fullscreen
F11; toggles fullscreen for all apps


Enjoy! And you're right, LXDE is very fast indeed! I use it on an ageing Toshiba Satellite-A100 and it's blinding fast to the old (gag!) Windoze operating system that it came with.
~*~ M_Mynaardt ~*~

LXDE is your computer's Friend!
Always trust LXDE!
Locked