MozillaZine

keyboard shortcut to restart firefox? [Mac]

User Help for Mozilla Firefox
Negativeions
 
Posts: 240
Joined: September 17th, 2003, 12:07 pm

Post Posted October 1st, 2017, 5:46 pm

Thanks.

smsmith
Moderator

User avatar
 
Posts: 19451
Joined: December 7th, 2004, 8:51 pm
Location: Indiana

Post Posted October 1st, 2017, 6:42 pm

I don't believe there is a built in restart keyboard shortcut, but you can use this extension to do that:
https://addons.mozilla.org/en-US/firefo ... /re-start/

The extension may no longer work in Fx 57, though.
Give a man a fish, and he eats for a day. Teach a man to fish, and he eats for a lifetime.
I like poetry, long walks on the beach and poking dead things with a stick.
Please do not PM me for personal support. Keep posts here in the Forums instead and we all learn.

morat
 
Posts: 2503
Joined: February 3rd, 2009, 6:29 pm

Post Posted October 1st, 2017, 8:13 pm

You can show a restart button in the Add-ons Manager with a css tweak in Fx 57.

Code: Select all
/* Firefox userContent.css */

@-moz-document url-prefix("chrome://mozapps/content/extensions/extensions.xul"), url-prefix("about:addons") {
  #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;
  }
  #updates-restart-btn .button-text {
    display: none !important;
  }
}

http://kb.mozillazine.org/UserContent.css

Edit:

The header-small.png image isn't available in Fx 58. (fix below)
Last edited by morat on November 20th, 2017, 11:25 pm, edited 1 time in total.

dickvl

User avatar
 
Posts: 52286
Joined: July 18th, 2005, 3:25 am

Post Posted October 2nd, 2017, 12:23 am

I usually have the developer toolbar visible and type 'restart' (rest: autocomplete with the tab key) to restart.

Negativeions
 
Posts: 240
Joined: September 17th, 2003, 12:07 pm

Post Posted October 3rd, 2017, 8:20 am

Thanks.

Out of curiosity, what function does the restart button call? Is there any way to map that function to a hotkey in macOS preferences > Keyboard > Shortcuts?

morat
 
Posts: 2503
Joined: February 3rd, 2009, 6:29 pm

Post Posted October 3rd, 2017, 9:34 am

The restart button calls an internal command that's only valid when the Add-ons Manger tab is selected.

Code: Select all
goDoCommand("cmd_restartApp");

Mac OS doesn't have access to internal commands.

I don't know how you would politely close a process on the Mac OS.

Windows OS
http://nircmd.nirsoft.net/closeprocess.html
http://nircmd.nirsoft.net/killprocess.html

RobertJ
Moderator

User avatar
 
Posts: 10334
Joined: October 15th, 2003, 7:40 pm
Location: Chicago IL/Oconomowoc WI

Post Posted October 3rd, 2017, 10:03 am

.
You could write a simple AppleScript to shut down FF and then restart it. You could then use Automator to assign that AppleScript to a keyboard shortcut. BEWARE: on Mac all keyboard shortcuts are global so what ever you select must be unique.

.
FF 57.0.2 - FF 58b11 - Palemoon 27.3.0 - TB 52.5 - Mac OSX 10.13.2
Computers I've used: IBM 7094/UNIVAC 1108/IBM 360/DEC PDP11/DEC VAX-11 780/DEC VAXstation 8000/Sun SPARCstation 2/Mac from 1984 to 2017

Negativeions
 
Posts: 240
Joined: September 17th, 2003, 12:07 pm

Post Posted October 3rd, 2017, 1:03 pm

morat: you can kill processes from terminal or activity monitor (which is sort of like task manager in Windows or whatever it's called)

RobertJ: oh ya, right. Forgot about that. Thanks.

Negativeions
 
Posts: 240
Joined: September 17th, 2003, 12:07 pm

Post Posted October 3rd, 2017, 1:48 pm

check it, I made a stupid simple applescript app tell application "firefox" to quit, delay, tell application Firefox to open. I have BetterTouchTool, created a firefox specific shortcut to open the script app with cmd-shift-q. I mean... just. Great.

dickvl

User avatar
 
Posts: 52286
Joined: July 18th, 2005, 3:25 am

Post Posted October 4th, 2017, 12:16 am

Keep in mind that it can take unknown time for Firefox to close properly.
When you use builtin means to restart then it is known when Firefox has closed and Firefox is restarted properly in all cases and currently open tabs will reloaded (browser.sessionstore.resume_session_once = true).
If you use an external script then you would have to guess how long you need to wait before starting Firefox.
Otherwise you will get the alert dialog that Firefox is already running.

Negativeions
 
Posts: 240
Joined: September 17th, 2003, 12:07 pm

Post Posted October 4th, 2017, 10:29 pm

On macOS, I don't think that's a problem. I've never seen a "firefox is already running" msg, or any other app for that matter. If I do, I'll increase the delay but right now it's at 1 second with no problems whatsoever. But even if I try to click on the firefox dock icon as it's quitting just nothing happens. Actually it automatically starts up again after it's quit. So I don't think it's possible to start up an app again before it's fully quit on macOS.

therube

User avatar
 
Posts: 18030
Joined: March 10th, 2004, 9:59 pm
Location: Maryland USA

Post Posted October 5th, 2017, 8:50 am

(
I don't know how you would politely close a process on the Mac OS.

kill -9
;-)
)
Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.19) Gecko/20110420 SeaMonkey/2.0.14 Pinball CopyURL+ FetchTextURL FlashGot NoScript

siffemoz
 
Posts: 64
Joined: January 29th, 2016, 4:36 pm

Post Posted November 17th, 2017, 1:20 am

Hi, unfortunately morat's code no longer works on 58 beta or 59 nightly :-( Can it be revived?

Edit: I haven't updated to 57 yet, so can't say if it still works there.

morat
 
Posts: 2503
Joined: February 3rd, 2009, 6:29 pm

Post Posted November 17th, 2017, 5:24 am

It succeeds in Fx 57. It fails in Fx 58. The header-small.png image isn't available in Fx 58.

Try this:

Code: Select all
/* 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;
  }
}

http://dxr.mozilla.org/mozilla-release/ ... nsions.xul
http://dxr.mozilla.org/mozilla-release/ ... -small.png
http://dxr.mozilla.org/mozilla-release/ ... ersion.txt

http://dxr.mozilla.org/mozilla-beta/sea ... nsions.xul
http://dxr.mozilla.org/mozilla-beta/sea ... -small.png
http://dxr.mozilla.org/mozilla-beta/sou ... ersion.txt

siffemoz
 
Posts: 64
Joined: January 29th, 2016, 4:36 pm

Post Posted November 18th, 2017, 10:23 pm

Works! Thanks much, morat.

Return to Firefox Support


Who is online

Users browsing this forum: Bing [Bot] and 10 guests