On Ubuntu, right-clicking on the Chromium browser icon you are shown 3 options:
- Open a New Window
- Open a New Window in incognito mode
- Open a New Window with a temporary profile

The Firefox browser just offers two options:
- Open a New Window
- Open a New Private Window

Here’s how you can add a script to get a new Firefox window with a temporary profile and add it to the actions to the Firefox contextual menu in the Ubuntu Unity menu.
The following script launches a new Firefox window with a temporary profile. The profile is created in a temporary directory that is removed when the script exits, using an exit trap. I also use the enhanced bash strict mode.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
#!/usr/bin/env bash SOURCED=false && [ "$0" = "$BASH_SOURCE" ] || SOURCED=true if ! $SOURCED; then set -euo pipefail IFS=\n\t' fi profiledir=$(mktemp -d -t firefox-temp-profile.XXXXXXXXXX) function cleanup { rm -rf "$profiledir" } trap cleanup EXIT firefox -profile "$profiledir" -no-remote -new-instance exit 0 |
You can save this script as /usr/local/bin/firefox-temp-profile
and make it executable with:
$ sudo chmod a+x /usr/local/bin/firefox-temp-profile
Now you can run the command firefox-temp-profile
and you will get a new window with a temporary profile.
To add an action to the contextual menu[1]I am mostly following this AskUbuntu answer.:
- copy the
firefox.desktop
launcher from/usr/share/applications/
to~/.local/share/applications/:
$ cp /usr/share/applications/firefox.desktop ~/.local/share/applications/firefox.desktop - Edit the new file:
- Add the new action
new-tempprofile-window
to the Actions entry:Actions=new-window;new-private-window;new-tempprofile-window;
- Add at the end of the file:
[Desktop Action temporary-profile-window]Name=Open a New Window With a Temporary
Exec=firefox-temp-profile
- Add the new action
- Remove the old icon from the Unity Launcher by right-clicking it and choosing
Unlock from Launcher
- Re-add the new icon by searching for Firefox in the Activities menu and dragging the Firefox icon to the Launcher
The new contextual menu has the action Open a New Window With a Temporary Profile:

A new window with a clean profile in Firefox – at least for version 76.0.1 (64-bit)
– looks like this:

References
↑1 | I am mostly following this AskUbuntu answer. |
---|