How to isolate application instance to an activity

I am using Activities to separate tasks. Let’s say I have a Shallow Work activity with my Trello GTD on one virtual desktop and Thunderbird on another. I also have a Deep Work activity with LibreOffice Calc on one virtual desktop and my Trello DueProject board on the second virtual desktop.

In both activities I am using FireFox / AnyBrowser. In the first activity opening links from emails and in the second activity for LO Calc help topics and some DueProject details.

I´d like to achieve the following: Any links in any software in the Shallow Work activity opens in the FireFox / AnyBrowser instance in this activity. Ideally, if not present yet, fires up a new FireFox / AnyBrowser instance even if it’s already running in the Deep Work activity. The same applies to the Deep Work activity: Any link from any applications opens in the FireFox / AnyBrowser instance in this activity and not in the one in the Shallow Work activity.

How can I configure this as such?

(If this is a typical case of RTFM I’d appreciate being forwarded accordingly.)

Browser windows should open in the same activity they are opened, unless there is already a browser open in another activity. Which I am understanding is your problem with firefox. So, it may achieve what you want that when you open firefox from those applications the command is changed to: firefox --new-window

The easiest way to do this imo, is to create two firefox applications in ~/.local/share/applications.
One would be firefox adress whatever and the second one also firefox adress whatever. Give the applications a different name and then set them to be opened in activity whatever.
For example. Let’s say I have this regular firefox running whatever on activity Main. Now, I’d like to have a second firefox that runs YouTube on activity Media. Well, I make a desktop application and I name it Firefox Youtube. Something like along the lines of:

[Desktop Entry]
Comment=Firefox YouTube
GenericName=Firefox YouTube
Name=Firefox YouTube

PS: Or just copy the firefox application from /usr/share/applications to ~/.local/share/applications and add the website path to the executable

Once it’s made, run it, hit alt+F3 and add activities to the special window actions. There you can set it to run on activity Media only.

Example: I have this YouTube ssb and I only want it in activity Media.

Btw, if you want several tabs in each application, just run firefox whatever adress whatever adress…
as the executable in the application.
If you want, you can also make one application with several entries in a dropdown. Those would have to be in the application as desktop actions. It’s more compact in terms of menu entry or on a panel.
For example:
Clicking it would open firefox homepage. Rightclick would offer you a selection of firefox set with certain websites. As for where, on which activity they should be opened depends on your settings for that particular app.

Something like this example with konsole. If I want, I can have each command opened in a particular activity or virtual.

If you want to create separate Profiles for Firefox. Each Profile will open a separate Instance of Firefox… not just a new Window.


firefox -ProfileManager -no-remote

in the CLI to create a new profile, and

firefox -P <profilename> -no-remote

To open a specific profile.

I have all of my profiles set up in a .Desktop file, so I can choose the preferred profile from the Panel.

So I have a .Desktop file, in ~/.local/share that looks like this

[Desktop Entry]
Name=Firefox Web Browser
Comment=Browse the World Wide Web
GenericName=Web Browser
Exec=firefox -P default


[Desktop Action Default-Instance]
Name=Open Default Instance
Exec=firefox -P default

[Desktop Action Newspapers]
Name=Open Newspapers
Exec=firefox -P WorldNews

[Desktop Action Upload-Photos]
Name=Open Upload Photos
Exec=firefox -P MediaFire2

[Desktop Action Proton-Email]
Name=Open Proton Email
Exec=firefox -P "Proton Mail"

[Desktop Action Facebook]
Name=Open Facebook
Exec=firefox -P Facebook

[Desktop Action WebDev]
Name=Open Web Development
Exec=firefox -P WebDev

[Desktop Action Documentation]
Name=Open Documentation
Exec=firefox -P Documentation

[Desktop Action New-Private-Window]
Name=Open New Private Window
Exec=firefox -private-window

[Desktop Action Profile-Manager]
Name=Open Profile Manager
Exec=firefox -ProfileManager -no-remote

He wants them opened with certain sites. So that would require an adress. Unless he starts every ff profile where he left it. But yeah, that’s the structure the desktop file should be.

Then all you do is add the url at the end of the Exec instructions

EXEC=firefox -P Documentation

for example

@dzon @tracyanne Thanks for the elaborate answers. I am relatively new to KDE Plasma and this is my first dive into this aspect of the linux desktop. Thanks for the home work instructions :slight_smile:

I hope it’s what I am looking for. I do not know any URL’s up front. I intend to click links in other applications. For example, in the Main activity there’s Thunderbird and when I click on a link in an email it should open in an instance of Firefox in the Main activity and not in the already running instance of Firefox in the Office activity that’s currently displaying Help pages from LibreOffice Calc. And vice versa. Requesting help from LibreOffice Writer in the Office activity should start Firefox in the Office activity and not re-use the running FireFox instance in the Main activity.
Same goes for the Linux Project activity, where I have my Trello board and clicking a link from a card should use the Firefox instance in this activity or start it here instead of using an existing instance in a different activity.

My guess would be [at]clancularius (I am sorry, as a new user I cannot mention more than 2 users) answer should work as intended with the side note an existing instance will be ignored. In which case I’ll end up with an extra window in my automatically tiled windows layout.

Is there any clear user manual on activities and virtual desktops? For instance, I also would like to know if I can choose different number of VDs per Activity.

I don’t use Activities, but after a quick test, the answer appears to be no,