How Do I Open Fixed Window In Firefox (like Chrome app mode)?

I was looking for something like this for a while, so here is how I made my own Firefox 'app' mode.

For Googlenauts with Windows/Mac 'Set Up Firefox' & 'Alternatively...' should also work on other OSs, perhaps with a few tweaks to the commands used, whilst 'Create Launcher' should work only for most Desktop Environments that implement the freedesktop 'specifactions'.

Set Up Firefox

First run firefox --ProfileManager from terminal (you may need to close any running instances of Firefox first, or use the -new-instance option).
Create a new profile and call it app. Select the 'Default' one (IMPORTANT: otherwise by default it will start the app profile you are creating) and press 'Exit'.

Firefox Profile Manager

Now run firefox -P app. This will start Firefox from the new app profile you just created. As removing the tabs and navigation bar is now difficult or impossible in Firefox's settings, you will need to install some extensions to remove them - these ones work, though may be better ones available that hide the bars permanently:

  • Hide Tab bar with one Tab - hides the tab bar when there is only one tab open.
  • Hide Navigation Bar - you need to press F2 to show/hide the nav bar

Edit: Both options of hiding the tab+nav bars is also included with Classic Theme Restorer - small icons can also be set for a more compact layout.

Now, when you run firefox -P app -new-instance http://URL (e.g. firefox -P app -new-instance https://askubuntu.com/q/487936/178596), you should get a Firefox window like this: Firefox window with only title bar

Also, when you open Firefox by running firefox or clicking the Firefox button, it should open your normal Firefox profile with the tab and nav bars.

Works in Firefox 30.0, 40.0, partially tested in 52.

Create Launcher

You probably want to create a launcher to open your app from the menu - you can do so using this template:

[Desktop Entry]
Name=<APP NAME>
GenericName=<APP NAME>
#Comment=Browse the Web
Exec=firefox -P app -new-instance <https://URL>
Icon=<ICON>
Terminal=false
Type=Application
#MimeType=text/html;text/xml;application/xhtml+xml;application/vnd.mozilla.xul+xml;text/mml;x-scheme-handler/http;x-scheme-handler/https;
StartupNotify=true
#Categories=Network;WebBrowser;
Keywords=<KEYWORDS>

Where:

  • <APP NAME> is the name of your app
  • <https://URL> is the URL you want shown by default on launching the app. -new-instance is optional but allows the Firefox App to be run as the same time as normal Firefox. See also: Mozilla Developer - Command Line options and the output of firefox --help.
  • <ICON> is the name of a icon /usr/share/icons or ~/.local/share/icons, or the path to a icon file (preferably PNG or SVG I think).
  • <KEYWORDS> - Relevant keywords delimited by ;, you can include words you can use to search for the launcher in the Dash/Menu - e.g. Paper;Ink;Toner; - Optional: comment it out with a # at the beginning of the line if you don't use this.

For more info on how .desktop files work, you can read this


You can also follow both above steps, and create various different app profiles, just remember if you use a different name to app - e.g. gmailapp, you need to use that name consistently instead of app.

Also, I'm not sure the -new-instance option is needed much any more, I have left it in anyway.

See also: - https://superuser.com/questions/468580/create-application-shortcut-chromes-feature-in-firefox

Alternatively...

I was looking for a solution to create a script so I could run a command and create Firefox apps (so without extensions etc), and the following userChrome.css works well at hiding all the toolbars:

@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
#TabsToolbar,
#PersonalToolbar,
#BookmarksToolbar,
#MenuToolbar,
#tabbrowser-tabs,
#nav-bar,
#TabsToolbar { display: none !important; }

I haven't tested it too much yet, thought it will be annoying to use since it hides all the open tabs....


I have an easier way I usually do this. It works with a stock Firefox installation without any customization. You can even change the height and width of the window.

The command:

firefox -url 'data:text/html;charset=utf-8,<!DOCTYPE html><html><body><script>window.open("http://google.com", "_blank","height=400,width=600,menubar=no,location=no,toolbar=no,left=100,top=100")<%2Fscript><%2Fbody><%2Fhtml>'

Just change http://google.com to the URL. You can also change the height and width variables (in pixels).


Firefox 73+ has Site-Specific Browsers: https://bugzilla.mozilla.org/show_bug.cgi?id=1283670

  • First set browser.ssb.enabled to true in about:config.

  • Then call your app with -ssb instead of -url.

For example:

firefox -ssb https://www.youtube.com

opens YouTube in this mode.

Tags:

Firefox