Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is it possible to do the following in Ubuntu? If so, can someone point me in the right direction.

Say you want to set a keyboard shortcut to do the following:

For examples sake, set Alt+F to open Firefox and maximize it, but only if Firefox is not already running. If it is running and not maximized, then maximize the most recently touched Firefox window. If it is maximized, then minimize Firefox.

share|improve this question
add comment

1 Answer

My recommendation would be to do it with a custom shell script. I'm not sure how to test if a window is maximised, but to check if it's running you could grep the output of ps:

ps -elf | grep username | grep firefox

There is probably a neater way of doing that, but speed isn't particularly of the essence.

Assuming you're running gnome under ubuntu, to run a custom script given a keyboard shortcut:

  1. open up gconf-editor
  2. go to apps->metacity

There are 2 folders of importance in there: - global_keybindings - this is used to specify the keybinding - keybinding_command - this is used to specify the command to run

In the global folder you'll see run_command_X and in the keybinding_command there is command_X. The integer X is the association between the binding and the command.

It might be possible to have different scripts bound to the same keystroke depending on the app that currently has focus. So for example Alt-F would always run the launchFirefoxIfNotOpen script, but the minimiseFirefox would only run if firefox received the keystroke. Not sure it's possible, just an idea.

Hope this helps and good luck!!

share|improve this answer
add comment

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.