Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

share|improve this question
    
is there anyway to capture the output of the script when launched via Alt+F1. Did you try changing the shortcut ? What method you have used to associate the Alt+F1 binding to the super.sh script ? –  koushik Oct 7 '10 at 11:29
    
In gconf-editor you can use mappings to run custom commands (see /apps/metacity/global_keybindings/run_command_1 and /apps/metacity/keybinding_commands/command_1) If you have compiz, then this is better configured via compiz frontend. Have you used that for Alt+F1 > super.sh mapping ? –  koushik Oct 7 '10 at 11:35
    
@koushik: I used xbindkeys to make the association... I modified the script to direct output to a log-file. Both running the script from the terminal, and running it via Alt+F1 produce the identical output... stderr reports version-ID, and indicates proper release of mouse and pointer (OK)... stdout shows the two args, one per line, "KeyStrPress: Super_L", "KeyStrRelease: Super_L", but then displays another line "Unknown tag: Super_L" (not OK)... It "works" in one environment, but not in the other... For now, I'll try another keystroke generator... and then I'll try your further suggestions... –  Peter.O Oct 7 '10 at 19:50
    
@koushik: I tried the Compiz inerface, with identical results (it doesn't work)... I'm still plucking away at it though... –  Peter.O Oct 8 '10 at 0:44
1  
while you are trying other launchers, you could checkout xvkbd (see this - which if it works is IMO exactly what you want) & xte (see this thread). –  koushik Oct 8 '10 at 6:05

1 Answer 1

up vote 1 down vote accepted

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

share|improve this answer
    
Wow! What a great answer. What a great effort, but unfortunatley I got the same result as before.. nothing :( ... I didn't get that lock-up with xvkbd (but I did in some of my original tests)... I'll definitely be keeping 'sudo restart gdm' in my notes... good one! ... For now, I'll just live with only the Super key for a while, but I saw somewhere that there is a Python lib for sending general X messages...That may well do the trick... Thanks again. –  Peter.O Oct 8 '10 at 12:21
1  
PS. I wonder if there is some completely different way to do this. I am fascinated by the macro method of one key kicking off another one, but perhaps there is a some other way; something as simple as (dare I say it) as Windows shortcuts... eg. Is there an actual "command" to invoke to display the menu, or is this action only bindable via the config setting? .. If there is a command, then it should be straight forward. –  Peter.O Oct 8 '10 at 12:35
    
Unfortunate that this doesn't work. I think we are pretty close. I think your need is fair and someday I might want to do something similar. Hopefully, like you said, there is some other method that enables this. –  koushik Oct 8 '10 at 14:08
1  
There is something called gnome-main-menu (install -> apt.ubuntu.com/p/gnome-main-menu) which provides another menu on the panel. More interestingly, it has a command called application-browser which brings up another interface to search and launch applications. Maybe you could try that. By default, the executables from this package are installed at /usr/lib/gnome-main-menu which is not in the path. So if you'd like to bind a keyboard shortcut, take care to specify full path (like /usr/lib/gnome-main-menu/application-browser). –  koushik Oct 11 '10 at 5:08
    
Enabling the ctrl-alt-backspace shortcut to restart X is handy to avoid the dance under "caution". –  Roger Pate Oct 16 '10 at 19:23

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.