Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

What is command line argument to raise and give focus to an existing instance of Firefox?

  • 5 replies
  • 2 have this problem
  • 1 view
  • Last reply by John99

more options

I'd like to create a shortcut which acts on the existing Firefox instance. If iconified, it should deiconify. In any case, it should come to the top of the window stack and take focus. I have looked over the command line arguments, and I don't see one that will do that. The closest I can come is to give it a URL; but I don't really want to open a new tab.

I'd like to create a shortcut which acts on the existing Firefox instance. If iconified, it should deiconify. In any case, it should come to the top of the window stack and take focus. I have looked over the command line arguments, and I don't see one that will do that. The closest I can come is to give it a URL; but I don't really want to open a new tab.

All Replies (5)

more options

There is an option to focus on a new window when it opens in the Firefox Options > tabs > "When I open a new tab switch to it immediately", however since you would like to do this from the command line/cmd the default ones are https://support.mozilla.org/en-US/kb/keyboard-shortcuts-perform-firefox-t...

If this does not already exist: https://developer.mozilla.org/en-US/d.../Commands

more options

The response from guigs2 was not helpful. Indeed, I don't think guigs2 understood my question. When Firefox is already running but iconified or buried under other windows, I want a simple way to deinconify it (if necessary), bring it to the front, and give its window focus. I figured there should be a command line argument that would do that; in which case I could put an invocation of Firefox with that argument into a system-level keyboard shortcut of the sort you can set up on any Windows shortcut. But I could not find such a command line argument. Referring me to the same list of command line arguments I have already examined certainly does not help. (If it is there is a disguised form, please tell me what it is explicitly.) The Firefox keyboard shortcuts are of no use unless the Firefox window already has focus; so those are clearly irrelevant.

If there is no way to do this with what exists in Firefox and Windows, I will just have to install AutoHotkey, as I know it can do what I want.

more options

Hi DrHow, currently I do not know of a command line argument that does this for Firefox at the moment. The last link shows an example of how to configure one. However if you are looking for one that is already developed, AutoHotkey may be a good work around.

more options

When I looked at the last link the first time, I could not even figure out what it had to do with my question. But I thought I would give it another try. I now realize that I had been dumped into the middle of the XUL tutorial. I knew nothing about XUL, but I began looking into it a bit. I am guessing that guigs2 is suggesting that I can compose a .xul file such that, if I invoked Firefox.exe passing it that file, then it would do what I want. However, looking around in the XUL Reference and XUL Controls, I have been unable to find anything that has to do with iconifying, deiconifying, raising to the top, or giving focus to a Firefox window. If such things are in there, I'd appreciate some pointers.

more options

This looks like a Windows question rather than a Firefox issue. I am not sure XUL will help but you will have already discovered the documentation starts here

Like you say Autohotkey may well be the answer. Autohotkey appears to automate exactly the kind of actions you are trying to use.

The program is written in Autohotkey with a single line of code:

^SPACE::  Winset, Alwaysontop, , A