Ubuntu – set up two key-bindings to launch the Main Menu? … specifically: Alt+F1 and Super

menupanelscriptsshortcut-keys

I've set up the Super key to open the main menu. It works.

gconftool-2 --set /apps/metacity/global_keybindings/panel_main_menu --type string "Super_L"

,
I have a shell script super.sh which injects a Super keypress into X. It works; the menu appears.

#!/bin/bash
echo "KeyStrPress Super_L KeyStrRelease Super_L"| xmacroplay -d 1 :0.0 &> /dev/null

.
I use xbindkeys to associate Alt+F1 with super.sh. It should work, but it doesn't!

However, when I associate Alt+F1 with nautilus, or make nautilus the only active command in the script, then Alt+F1 successfully launches nautilus… so I am a bit puzzled about what's happening to the script.

Any ideas, anybody?
If there is a another way, I'd like to know about it,
and I'd still like to resolve this macro-generated key-press issue.

Best Answer

I seem to have hit upon a solution with a caveat however. Details below.

  1. Use gconftool-2 to set /apps/metacity/global_keybindings/panel_main_menu to Super_L (as you have mentioned in your question.
  2. Install xvkbd package via sudo aptitude install xvkbd
  3. Use ccsm (System -> Preferences -> Compizconfig settings manager) to create a new command bound to Alt+F1. Against Commands -> Commands -> Command 4 enter xvkbd -text "\[Super_L]" and against Commands -> Keybindings -> Run Command 4 select F1 as keybinding.

This should work. It is almost completely copied from this ubuntuforums post.

Caution

When I tried this in my system, I found 1 very strange issue. The sytem started behaving as if the Alt key was permanently held (e.g., I could just press to switch between windows). I am not sure this is because I had earlier invoked xvkbd to simulate some Alt key presses. If you face this problem, the only option I found to make the system usable again was to follow below steps.

  1. Drop to a terminal by pressing Ctrl+Alt+F1

  2. Login with your user name & password

  3. Force logout and restart of X by running below command.

    sudo restart gdm
    

If the problem persists after login also, then you can use the following command to reset the mapping of Super_L to panel_main_menu (back to defauly Alt+F1) gconftool --unset /apps/metacity/global_keybindings/panel_main_menu

Related Question