This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Isolating Virtual Desktops

Tags: None
(comma "," separated)
User avatar
lava
Registered Member
Posts
18
Karma
0
OS

Isolating Virtual Desktops

Sun Nov 01, 2020 7:15 am
Greetings.
I have a bizzare desire to make virtual desktops behave as if they were a separate OS.
Currently if I have an open program(Sublime Text) in Desktop 1, opening a file from Desktop 2 will open that file in Desktop 1 as a tab in already running program which is a default behavior. It was OK for me in the past, but now I want that file to open in Desktop 2 and doesn't matter if it creates a separate window(since RAM is not an issue). It would be nice if I could choose which programs to behave like this, but it's OK to turn this behavior for all programs.

I have dolphin tabs detached for each desktop with related folders, but when I open a folder(from say Desktop 2 with a detached Dolphin tab/window) it creates a separate window and opens that folder as a tab. I want that folder to open as a tab in a detached currently open tab/window of dolphin. Note: this happens when opening a directory by double clicking a desktop icon, I can diminish my sufferings by only opening from existing dolphin window by ctrl + T and so on, but...

Offtopish:
Ideally I want each desktop have it's own Firefox windows and related tabs and when I startup a laptop it would open all those Firefox and Dolphin windows in their own Virtual Desktops. But it may be a Firefox issue as well(currently I just select all tabs and bookmark) probably Firefox profiles is a way to go.
User avatar
claydoh
Registered Member
Posts
1170
Karma
9
OS

Re: Isolating Virtual Desktops

Sun Nov 01, 2020 8:06 pm
have you looked at Activities as opposed to virtual desktops?
I have a couple of them i have set up, each with different backgrounds, widgets, and browser windows/tab sets when I open them.
They save their state, so any docs or programs open will restore when the activity is re-opened.


claydoh, proud to be a member of KDE forums since 2008-Oct, and KDE user since 2001
User avatar
lava
Registered Member
Posts
18
Karma
0
OS

Re: Isolating Virtual Desktops

Sun Nov 01, 2020 11:25 pm
claydoh wrote:have you looked at Activities as opposed to virtual desktops?
I have a couple of them i have set up, each with different backgrounds, widgets, and browser windows/tab sets when I open them.
They save their state, so any docs or programs open will restore when the activity is re-opened.

I've actually tried Activities about a year ago, but couldn't make each Activity to have their own desktop files(tried moving folders into different activities with no success. Thought it was one of Activities main goals, so failing it I abandoned it without looking deeper. I think I should give it another try from different angle, thanks in advance.
User avatar
claydoh
Registered Member
Posts
1170
Karma
9
OS

Re: Isolating Virtual Desktops  Topic is solved

Mon Nov 02, 2020 12:13 am
What you might try is for each Activity, change the Desktop settings to point to its own directory instead of the default "Desktop" folder.
Make sure the Desktop Layout is set to 'Folder View', which is the default, normally.


claydoh, proud to be a member of KDE forums since 2008-Oct, and KDE user since 2001
User avatar
lava
Registered Member
Posts
18
Karma
0
OS

Re: Isolating Virtual Desktops

Mon Nov 02, 2020 10:06 am
claydoh wrote:What you might try is for each Activity, change the Desktop settings to point to its own directory instead of the default "Desktop" folder.
Make sure the Desktop Layout is set to 'Folder View', which is the default, normally.

Thank you, Activities look pretty solid and the Desktop folder feature was very helpful. You saved me a lot of a hassle. Superb.
User avatar
lava
Registered Member
Posts
18
Karma
0
OS

Re: Isolating Virtual Desktops

Tue Nov 03, 2020 5:16 am
While Activities somewhat isolates workspaces (like different desktops files, folders, wallpaper, widgets, panels) they also have the same limitations with applications as Virtual Desktops. Activities interact with other Activities to open files. Like when you want to open a file from a specific Activity, it opens it in another Activity because it has running instance* of that program(which opens those type of files as a default app) or some other criteria like remembering last time interaction with a particular program and opens it in that activity's instance(it looks like that, but not exactly sure though). It's confusing when opening a file causes switch of Activities and it happens even if you stop other Activities, the event(open a file) starts(awakes) an Activity that has a running instance.

I looked into Activities settings but couldn't find a solution to my problem there. If you know something more tell me, please.

* Instance I mean a particular window of programs like Sumile Text, Vscode, Firefox, Dolphin. I usually use the same tool for different Activities/projects.
koffeinfriedhof
Registered Member
Posts
608
Karma
4
OS

Re: Isolating Virtual Desktops

Tue Nov 03, 2020 8:05 am
Hi!

This is nothing you can achieve with a window manager as this depends on how the application itself is written. What you can do ist use custom desktop-files and change the Exec= command. For dolphin this would be (untested)
Code: Select all
cp /usr/share/applications/org.kde.dolphin.desktop ~/.local/share/applications/
sed 's#Exec=.*#Exec=dolphin --new-window %u#' ~/.local/share/applications/org.kde.dolphin.desktop

This will force Dolphin to ALWAYS open a new instance if called by e.g. `xdg-open` but won't work for stuff calling /usr/bin/dolphin directly.

Some applications allow only one instance. For these, there is no possibility to force a second instance, but you can workaround this by starting them as a second user which has the same access permissions as your first user. It will get complicated then anyway. Text Editors, Browsers and Dolphin allow second instances, so this should not match your case.
User avatar
lava
Registered Member
Posts
18
Karma
0
OS

Re: Isolating Virtual Desktops

Sun May 16, 2021 12:07 pm
koffeinfriedhof wrote:Hi!

This is nothing you can achieve with a window manager as this depends on how the application itself is written. What you can do ist use custom desktop-files and change the Exec= command. For dolphin this would be (untested)
Code: Select all
cp /usr/share/applications/org.kde.dolphin.desktop ~/.local/share/applications/
sed 's#Exec=.*#Exec=dolphin --new-window %u#' ~/.local/share/applications/org.kde.dolphin.desktop

This will force Dolphin to ALWAYS open a new instance if called by e.g. `xdg-open` but won't work for stuff calling /usr/bin/dolphin directly.

Some applications allow only one instance. For these, there is no possibility to force a second instance, but you can workaround this by starting them as a second user which has the same access permissions as your first user. It will get complicated then anyway. Text Editors, Browsers and Dolphin allow second instances, so this should not match your case.


Good day and good rotating.
So what you're saying is it'll require changing the code of those programs(text editors, browsers, dolphin) to have what I want? It's absolutely impossible to do it in Activities? Are you 100% sure?(Are you a KDE developer yourself?) I am asking this cause I wanted to suggest this request in KDE Brainstorm. If that's true at least Dolphin they can modify.
Unfortunately your suggestion for dolphin is useless for me, since I almost never open files through terminal, it's not that convy (though I have short alias for xdg-open).
koffeinfriedhof
Registered Member
Posts
608
Karma
4
OS

Re: Isolating Virtual Desktops

Sun May 16, 2021 8:37 pm
lava wrote:So what you're saying is it'll require changing the code of those programs(text editors, browsers, dolphin) to have what I want? It's absolutely impossible to do it in Activities?

That depends. Normally you can open as many instances of a tool as you want. But some tools use lockfiles, pid-checks or whatever to make sure that there is only one running instance. For those you must use some container or jail-system to force them running in multiple instances or a second user running them.

For Dolphin (firefox,…) as mentioned, you can just create your own desktop-file to change its behaviour or even a simple script which triggers the correct behaviour for you. There is also the method of KWin-Scripting to have an on-the-fly check.
Are you 100% sure?

Never.
Are you a KDE developer yourself?

No, I am not a developer at all. I just code a little for myself in my spare time and try to help out in little projects or answering questions in forums, irc, etc. to give something back.
If that's true at least Dolphin they can modify.

They should modify what exactly? Dolphin already can run in multiple instances.
Unfortunately your suggestion for dolphin is useless for me, since I almost never open files through terminal

I don't know why you would need the terminal to open files. If you click on a file it is opened with the application defined by you or the default depending on its MIME-Type.
User avatar
lava
Registered Member
Posts
18
Karma
0
OS

Re: Isolating Virtual Desktops

Mon May 17, 2021 2:19 am
koffeinfriedhof wrote:They should modify what exactly? Dolphin already can run in multiple instances.

I have trouble opening files in their own Activity. For example, I have separate desktop folders for different Activities(at least 2) and when I open a file from a desktop it opens it in another Activity which is not what I want. Who needs a switch of Activity for that? I want that file to be opened in it's own Activity from where I open it, in its own instance of a program(those programs allow multiple instances). Ideally it shouldn't matter if an Activity has its own desktop folder, files should open(from desktop or dolphin) from Activity I click them, without switching an activity.
I don't know why you would need the terminal to open files. If you click on a file it is opened with the application defined by you or the default depending on its MIME-Type.

I use xdg-open to open files in a terminal. Anyway I didn't get you message, I've used your command but I didn't notice anything Dolphin's behavior is the same.
koffeinfriedhof
Registered Member
Posts
608
Karma
4
OS

Re: Isolating Virtual Desktops

Wed May 19, 2021 1:10 pm
You can have a look at https://forum.kde.org/viewtopic.php?f=66&t=166979 which explains a bit how to achieve it.


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], q.ignora, watchstar