Ubuntu Linux: Start Edge Browser in Private Mode by Default

This blog post explains a hack that you can use to configure the Microsoft Edge browser on Ubuntu Linux to start in private mode by default, even when clicking links in emails.

Screen shot showing updated contents of /usr/share/applications/microsoft-edge-beta.desktop and context menu for Edge icon

I wanted to make the icon for the browser in the dock open in private mode by default. To run the browser in private mode, I need to launch microsoft-edge-beta with the –inprivate command line argument. It’s interesting to see a software beta at a version number greater than 100.

This command lists the favorites on the dock:

/usr/bin/gsettings get org.gnome.shell favorite-apps

This lists an array such as the following:

['thunderbird.desktop', 'libreoffice-writer.desktop', 'code.desktop', 'gnome-control-center.desktop', 'org.gnome.Terminal.desktop', 'org.gnome.Nautilus.desktop', 'microsoft-edge-beta.desktop']

You can use the gsettings command to update the favorites, but I could not figure out how to pass command line parameters.

Instead, backup the /usr/share/applications/microsoft-edge-beta.desktop file and then edit it. After removing comments and translations that are irrelevant in my case:

[Desktop Entry]
Version=1.0
Name=Microsoft Edge (infinite beta)
GenericName=Web Browser
Comment=Access the Internet
Exec=/usr/bin/microsoft-edge-beta %U --inprivate
StartupNotify=true
Terminal=false
Icon=microsoft-edge-beta
Type=Application
Categories=Network;WebBrowser;
MimeType=application/pdf;application/rdf+xml;application/rss+xml;application/xhtml+xml;application/xhtml_xml;application/xml;image/gif;image/jpeg;image/png;image/webp;text/html;text/xml;x-scheme-handler/http;x-scheme-handler/https;
Actions=new-private-window;new-tracking-window;

[Desktop Action new-private-window]
Name=New Private Window
Exec=/usr/bin/microsoft-edge-beta --inprivate

[Desktop Action new-tracking-window]
Name=New Tracking Window
Exec=/usr/bin/microsoft-edge-beta

The key changes are in bold. First, I added –inprivate to the first Exec, which is apparently the default. Then, I removed the default new-window entry, reversed the order of the last two entries, updated those two entries to be more specific, and updated Actions to reference those two entries.

I tried setting Terminal to true so I could see the debugging messages coming from the microsoft-edge-beta process, but it did not seem to affect anything.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: