keyboard shortcut to restart firefox? [Mac]

User Help for Mozilla Firefox
Ed1
Posts: 1059
Joined: January 30th, 2005, 2:33 pm

Re: keyboard shortcut to restart firefox? [Mac]

Post by Ed1 »

Thanks, morat.

Is there any way to place this button, or a button with the same restart function, on the Navigation Toolbar?
morat
Posts: 6403
Joined: February 3rd, 2009, 6:29 pm

Re: keyboard shortcut to restart firefox? [Mac]

Post by morat »

@Ed1

It is not possible with the userChrome.css file or with a WebExtension.
Ed1
Posts: 1059
Joined: January 30th, 2005, 2:33 pm

Re: keyboard shortcut to restart firefox? [Mac]

Post by Ed1 »

OK, thanks, morat. Sorry to hear that. It would be a useful addition.

Just so I understand then, your .css code seems to make a restart button always available on the Addons page, rather than the default behavior which is to not show a Restart button on that page unless there is a reason that a restart would be required. Is that correct?

I can't think of when Firefox 57+ would display a Restart button, since Addons now are immediately installed and uninstalled without a Restart being necessary.

The reason I would like a Restart button is to reload Firefox with current tabs open after they and perhaps many other tabs have been opened and/or closed during a very long browser session that has caused RAM ussage to go way up. A restart would be a way to reduce RAM usage during further browser use. With the old Restart addons, that was easily accomplished with either a Restart button or a Restart entry in the File menu. Now it seems impossible.
User avatar
Gingerbread Man
Posts: 7735
Joined: January 30th, 2007, 10:55 am

Re: keyboard shortcut to restart firefox? [Mac]

Post by Gingerbread Man »

  1. Shift + F2
  2. restart
  3. Shift + F2
You can send the above to Firefox by creating a macro in either your mouse or keyboard software, or your operating system settings. You'll need to insert a delay in between the commands at some point; how many milliseconds is appropriate varies depending on the system. If such a feature isn't available, you can use an external utility like AutoHotkey for Windows or BetterTouchTool for Mac.
morat
Posts: 6403
Joined: February 3rd, 2009, 6:29 pm

Re: keyboard shortcut to restart firefox? [Mac]

Post by morat »

Ed1 wrote:Is that correct?
Yes.
Ed1 wrote:I can't think of when...
It is possible to install legacy extensions in Fx 57+ nightly build so the about:addons restart button is still available.
Ed1
Posts: 1059
Joined: January 30th, 2005, 2:33 pm

Re: keyboard shortcut to restart firefox? [Mac]

Post by Ed1 »

Thanks, Gingerbread Man! I tried that sequence manually on my Win10 system with FF57 open. Just to clarify what worked for me was:

1. Shift + F2 (to open the console at the bottom of the screen)
2. Type: restart
3. Press: Enter key (to restart Firefox)
4. Shift + F2 (to close the console at the bottom of the screen)

I've noticed lately that when FF57 is restarted, it restarts minimized to the Windows tray area. With the old Restart addons, it used to restart maximized and in focus. So, I'm looking for a way to restart maximized.

I don't know anything about macros or scripting, but I looked at the Autohotkey web page and it looks interesting. I might give it a try!
User avatar
Gingerbread Man
Posts: 7735
Joined: January 30th, 2007, 10:55 am

Re: keyboard shortcut to restart firefox? [Mac]

Post by Gingerbread Man »

Ed1 wrote:Thanks, Gingerbread Man!
You're welcome.
Ed1 wrote:I've noticed lately that when FF57 is restarted, it restarts minimized to the Windows tray area. With the old Restart addons, it used to restart maximized and in focus. So, I'm looking for a way to restart maximized.
I can't reproduce that in Nightly.

The following AutoHotkey script does the job. I don't know why the maximize command doesn't work when it's fine in a separate script by itself. I included it commented out, for reference. The following script maximizes the window via keyboard shortcut instead. Paste it into Notepad, then save it as "Restart Firefox.ahk" including the quotation marks.

Code: Select all

WinActivate, ahk_exe firefox.exe ; Focus the Firefox window
SendInput, +{F2} ; Open the Developer Toolbar
Sleep, 350 ; Wait 350ms
SendInput, restart{Enter} ; Type "restart" then press Enter
Sleep, 4250 ; Wait 4.25s for Firefox to load completely
SendInput, +{F2} ; Close the Developer Toolbar
WinActivate, ahk_exe firefox.exe ; Focus the Firefox window
; I can't get the maximize command to work, though it works in other scripts.
; WinMaximize, ahk_exe firefox.exe ; Maximize the Firefox window
SendInput, !{Space}x
Return
I haven't tried, but you can probably launch it from a Firefox toolbar button using the External Application Button add-on.
siffemoz
Posts: 250
Joined: January 29th, 2016, 4:36 pm

Re: keyboard shortcut to restart firefox? [Mac]

Post by siffemoz »

This little gem from morat earlier in this thread no longer works :-( Can it be fixed?

/* Firefox userContent.css */

@-moz-document url-prefix("about:addons"),
url-prefix("chrome://mozapps/content/extensions/extensions.xul") {
#updates-restart-btn {
display: -moz-box !important;
}
#updates-restart-btn .button-icon {
/* list-style-image: url("chrome://browser/skin/panic-panel/header-small.png") !important; */
/* list-style-image: url("chrome://browser/content/abouthome/restore.png") !important; */
list-style-image: url("chrome://branding/content/icon32.png") !important;
}
#updates-restart-btn .button-text {
display: none !important;
}
}
siffemoz
Posts: 250
Joined: January 29th, 2016, 4:36 pm

Re: keyboard shortcut to restart firefox? [Mac]

Post by siffemoz »

Missing in all releases, apparently. So no way to revive it?
siffemoz
Posts: 250
Joined: January 29th, 2016, 4:36 pm

Re: keyboard shortcut to restart firefox? [Mac]

Post by siffemoz »

And typing restart at the console no longer works either. They even removed SHFT-F2 to get right to the console!
morat
Posts: 6403
Joined: February 3rd, 2009, 6:29 pm

Re: keyboard shortcut to restart firefox? [Mac]

Post by morat »

siffemoz wrote:So no way to revive it?
*** for advanced users only ***

You could use the CustomizableUI.createWidget method to create a restart button.

I don't know if the hack works in Nightly. I'm using similar buttons in the release build.

Firefox Quantum compatible userChrome.js
http://github.com/Sporif/firefox-quantum-userchromejs

Restart Button
http://gist.github.com/Sporif/ad6e917d8 ... 80d3c8918c

CustomizableUI
http://developer.mozilla.org/docs/Mozil ... ableUI.jsm
http://developer.mozilla.org/docs/Mozil ... ed_widgets
Last edited by morat on June 28th, 2018, 3:00 am, edited 1 time in total.
siffemoz
Posts: 250
Joined: January 29th, 2016, 4:36 pm

Re: keyboard shortcut to restart firefox? [Mac]

Post by siffemoz »

Thanks morat. I can't quite get it right. Where should the button appear?

Steps taken:

1. Put this into my existing userChrome.css:
@namespace url
(http://www.mozilla.org/keymaster/gateke ... s.only.xul);
toolbarbutton#alltabs-button {
-moz-binding: url("userChrome.xml#js");
}

2. Copied userChrome.js and userChrome.xml to the Chrome folder

3. Replaced contents of userChrome.js with the code from RestartFirefoxButton_Movable.uc.js
morat
Posts: 6403
Joined: February 3rd, 2009, 6:29 pm

Re: keyboard shortcut to restart firefox? [Mac]

Post by morat »

@siffemoz

* right click the menu bar
* left click the customize menu item

Is there a restart button in the customize firefox tab? If so, then drag the button to a toolbar.
siffemoz
Posts: 250
Joined: January 29th, 2016, 4:36 pm

Re: keyboard shortcut to restart firefox? [Mac]

Post by siffemoz »

I had already tried that, expecting to find it there, but nope.
Post Reply