I have created a shell script for a custom action which is working fine. I want to run this .sh file (mon.sh) on pressing Alt+F15.

I have done the following: In gconf-editor, under apps>metacity>keybinding_commands, edited command_1 with value

"/home/administrator/My Scripts/mon.sh" (tried without quotes also)

under apps>metacity>global_keybindings, edited run_command_1 with value


But the script is not getting executed when pressing Alt+F15

What is that I am missing?

  • If you are using gnome-shell, your windowmanager is not metacity, it ist mutter
    – david
    Apr 9 '11 at 9:42
  • I am using standard ubuntu installation. So what could it be? I am not sure about what is gnome-shell. I am running gnome, that's all I know. Apr 9 '11 at 9:44

I have no idea if you are using the right gconf-keys, but you can configure this via gui:

If you are using Ubuntu without desktopeffects metacity is your windowmanager, then you should use System ▸ Preferences ▸ Keyboard Shortcuts to add your command and set the keybinding.

If desktopeffects are activated, you are using compiz windowmanager. Install compizconfig-settings-manager Install compizconfig-settings-manager, run it and enter your script in the Commands preferences.

  • That worked. I didn't know it was this straightforward. Apr 9 '11 at 10:23

In the keyboard shortcuts panel, you should add sh on the beginning of the command.
sh /home/administrator/My Scripts/mon.sh

You can also use gnome-terminal
gnome-terminal /home/administrator/My Scripts/mon.sh

xdg-open to launch the default associated program with the extension.
xdg-open /home/administrator/My Scripts/mon.sh

xterm is a pretty alternative.
xterm /home/administrator/My Scripts/mon.sh

  • Your gnome-terminal command is missing the -x switch. xdgopen will open the file in the preferred application and is unlikely to execute it. your xterm command is missing the -e switch, but all that aside. How does any of this insure that the script is launched upon pressing <Alt>F15? If you were to expand some effort to edit this answer to resolve these problems it might be useful answer, but thanks for trying to help! FYI We have no shortage of Unanswered questions that perhaps would benefit from your focus.
    – Elder Geek
    Mar 12 '17 at 21:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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