HowTo: Use different session "profiles" in KDE Plasma Dolphin

This is a long wanted Feature.

What are profiles?

Many programs have support for profiles and nobody knows it.

  • Firefox
  • Thunderbird
  • Element Desktop
  • Chromium, Chrome, Edge, …

These allow to have different states a program saves it’s user session to. For example, you use the same browser, but for work, private, and for logging into public wifis (captive portals).

Many people just use different browsers, which has tons of drawbacks.

Profiles in Dolphin

Dolphin, the Filemanager of KDE Plasma, has no native Portal support.

But as we know how the concept works:

  • a program is launched
  • it saves user session data like open Tabs
  • the data is saved to a specific location

And how programs react when that data is missing or changed

  • when data is missing: start with an empty session
  • when data is changed: simply use that

We can make a hack!

Desktop Entries

Here is a list of mine, featuring many cool hacks with Desktop Entries

These entries are the thing that displays the icon and name for a program in your app launcher.

They are also used in other areas.

To overwrite the entry of an existing app, copy it to the user directory.

cp /usr/share/applications/org.kde.dolphin.desktop ~/.local/share/applications/

Dolphin Profiles

In there, edit the file, for example replace it with this

[Desktop Entry]
Name=Dolphin
Exec=dolphin %u
Icon=org.kde.dolphin
Type=Application
X-DocPath=dolphin/index.html
Categories=Qt;KDE;System;FileTools;FileManager;
GenericName=File Manager
MimeType=inode/directory;
InitialPreference=10
Keywords=files;file management;file browsing;samba;network shares;Explorer;Finder;
X-DBUS-ServiceName=org.kde.dolphin
X-KDE-Shortcuts=Meta+E
StartupWMClass=dolphin

Actions=work;private;


[Desktop Action work]
Name=Work
Name[de]=Arbeit
Icon=tools-symbolic
Exec=mv $HOME/.config/session/dolphin_dolphin_dolphin.work $HOME/.config/session/dolphin_dolphin_dolphin ; dolphin && mv $HOME/.config/session/dolphin_dolphin_dolphin $HOME/.config/session/dolphin_dolphin_dolphin.work

[Desktop Action private]
Name=Private
Name[de]=Privat
Icon=user-home-symbolic
Exec=mv $HOME/.config/session/dolphin_dolphin_dolphin.private $HOME/.config/session/dolphin_dolphin_dolphin ; dolphin && mv $HOME/.config/session/dolphin_dolphin_dolphin $HOME/.config/session/dolphin_dolphin_dolphin.private

Explanation

The concept is pretty simple. The entry adds 2 “Actions” to the Dolphin app. When right-clicking the icon, you can run them.

A profile action does this:

  1. If a session backup exists, copy it to the file that is actually used
  2. Run Dolphin
  3. After Dolphin is closed (&&) copy the active session file to the correct backup location

An issue could be losing session data when Dolphin crashes.

Custom Profiles

You can add as many blocks of these actions/profiles as you want.

Will absolutely add a nice screenshot soon

Added f40, howto and removed proposed-howto