36

I'm essentially wanting to create a desktop shortcut to open a window of Firefox without tabs, locked address bar, no menu, etc.

Similar to what some pop ups look like or what Chromium Desktop Apps look like.

What options can I use to accomplish this from the command line?

3
  • I wasn't quite sure you wanted - so I went on the 'like Chromium Desktop apps' bit.
    – Wilf
    Jun 25, 2014 at 16:17
  • 1
    Your answer shows exactly what I am after, thanks. I'll give it a shot in a bit. Jun 26, 2014 at 0:45
  • See also: eudennis.tumblr.com/post/123744218866/… (from euDennis's answer)
    – Wilf
    Sep 15, 2015 at 9:36

7 Answers 7

29

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:

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....

6
  • There’s still a white 1-pixel-wide horizontal bar on top of the window – both when I use an extension and when I apply your userChrome.css. Have you run across this before?
    – tomekwi
    Apr 1, 2016 at 10:21
  • Don't think so, what theme/desktop are you using?
    – Wilf
    Apr 1, 2016 at 12:41
  • I’m using Gnome 3.18 with the default shell theme and Firefox 45.0.1 with the default theme. I have a custom GTK theme applied – but I don’t think it’s relevant since a stripe like this doesn’t appear in any other app. Compare firefox -P app to google-chrome --app.
    – tomekwi
    Apr 4, 2016 at 20:41
  • Thanks. The userChrome.css option provided a quick and simple solution for me. The only obvious issue is that the downloads icon is now hidden. Nov 30, 2016 at 13:41
  • Those two extensions don't appear to exist anymore
    – EoghanM
    Dec 22, 2020 at 10:50
11

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).

4
  • Works great :) just need to sort popup blocker settings
    – Wilf
    Jan 14, 2017 at 9:20
  • you can add ,scrollbars=yes to allow the popup to have scroll bars. Mar 16, 2017 at 20:52
  • You can add it as a bookmarklet: javascript:(function(){window.open("http://google.com", "_blank","height=400,width=600,menubar=no,location=no,toolbar=no,left=100,top=100");})();
    – ADTC
    Nov 21, 2017 at 22:11
  • 13
    Looks like this no longer works after Firefox 57 was released
    – Tooniis
    Jan 5, 2018 at 12:10
8

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.

5
  • 2
    It may be helpful to also provide a full command example, as opposed to specifying the option to use for the command.
    – Ulincsys
    Apr 26, 2020 at 8:34
  • how to create a shortcut with this? and is possible to have a different icon?
    – Arnold Roa
    Nov 8, 2020 at 17:31
  • @ArnoldRoa I polished up an answer to that here: askubuntu.com/a/1364545/307091
    – Carolus
    Sep 19, 2021 at 8:45
  • 2
    If you scroll to the bottom of that Bugzilla thread, it seems like -ssb is not a feature yet/any_more. Also, it doesn't seem to work for me on Firefox 92.0 (64-bit).
    – Carolus
    Sep 19, 2021 at 8:54
  • 1
    Note that this feature has been removed, as of Firefox 86+: bugzilla.mozilla.org/show_bug.cgi?id=1682593
    – Pi Delport
    Jun 26, 2023 at 12:02
4

Kiosk mode

Similar, but not exactly the same is kiosk mode:

firefox -kiosk -new-window https://yourwebapplication.whatever

In this mode, input options will be partially limited (e.g. no right-click context menu). Otherwise your addons still work and you can change the current address by reaching for the hidden address bar with Alt+d or F6. Your sessions and cookies will also be kept the same. If you wish to avoid that use:

firefox --kiosk --private-window https://yourwebapplication.whatever

Exiting fullscreen

  • Your window manager might let you bind a global shortcut key to toggle fullscreen for any application.
  • Your window manager might have a window operations menu from which to control fullscreen (Alt+F3 for KDE).
  • To accomplish this from a terminal window or script you can use e.g. wmctrl:
wmctrl -r "Mozilla Firefox" -b toggle,fullscreen
  • Many other GUI and CLI (i.e. terminal) tools might help you as well here.

Getting the content to be 100% of the non-fullscreen window

Next, you might want to remove the window border (also with a global keybinding or from the window operations menu.

The last barrier left might be hiding toolbars and such. You can toggle those off:

  • from the menubar - reached with Alt+v and then arrow keys.
  • with keybindings if they have any - e.g. Ctrl+Shift+b for the bookmark toolbar; or Ctrl+h for the history sidebar;
5
  • 2
    Kiosk mode takes over the whole screen - it can't run in a window. Feb 7, 2020 at 16:03
  • 1
    Kiosk model is typically a locked down mode where several features are disabled like right-click, keyboard shortcuts and anything that might allow escaping or exiting the "kiosk". In "App mode", the user is still trusted to use most features the browser offers. Aug 19, 2020 at 14:43
  • 1
    @AndyForceno if you use a separate profile with -P and --no-remote and possible --class it'll open a separate instance
    – Fuseteam
    Aug 5, 2021 at 2:09
  • @ChrisL.Barnes There are some workarounds. See the updated answer.
    – Carolus
    Sep 22, 2021 at 20:21
  • @AndyForceno That was due to a missing parameter - see the first command of the updated answer above.
    – Carolus
    Sep 22, 2021 at 20:22
1

Since geek1011's solution doesn't work after Firefox 57, here's my solution:

I wrote a small piece of code to create an application window, and present a list of webapps based on a custom-defined list. Copy the code I posted here, then create a bookmerklet that points to: javascript:[paste code here].

Just customise the details in the appList object to match your needs.

Note you still need to configure Firefox as explained in ADTC's answer to allow window.open to create tab-less, toolbar-less, scrollbar-less windows.

1
  1. You need to download these extensions for Firefox:

  2. Configure web app mode for your preferred URLs:

  3. Any time you open these URLs the will be in their own standalone window. You can use bookmarks, or you can open one of the URLs from the command line:

     firefox https://app.example.com/
    
1
  • This extension works pretty well for me. Clicking external URLs in the apps opens them in the main Firefox window as expected. I'd like more options for position and height, eg 100 pixels from the left of the screen, 1500 pixels wide, full height of screen, largest monitor Sep 6, 2023 at 11:57
-1

I finally figured out a way to do it as I want.

Enable the "Single Site Browser" feature in Firefox

  1. In a new tab, type or paste about:config in the address bar and press Enter/Return. Click the button accepting the risk.
  2. In the search box type ssb.
  3. Double-click the browser.ssb.enabled preference to switch the from false to true

Launch the URL with the -ssb switch

type the following in a terminal:

firefox -ssb https://notion.so/

This works really well.

5
  • 1
    This doesn't seem to be supported or working when reading the last posts here
    – Carolus
    Sep 19, 2021 at 8:47
  • @Carolus I'm not in Ubuntu or Firefox now to test and confirm. But have you tried this and found this to be not working? It was working when I posted this almost a year ago, not sure what changed after that.
    – Vignesh
    Sep 21, 2021 at 17:29
  • Yeah. I tested this myself as well.
    – Carolus
    Sep 22, 2021 at 20:26
  • Still does not work on Firefox Ubuntu 22.04LTS. Shame.
    – Vince Pike
    Oct 19, 2022 at 16:38
  • 2
    Note that this feature has been removed, as of Firefox 86+: bugzilla.mozilla.org/show_bug.cgi?id=1682593
    – Pi Delport
    Jun 26, 2023 at 12:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .