Bug 125738 - Add option for reusing instances only if in same virtual desktop
Summary: Add option for reusing instances only if in same virtual desktop
Status: RESOLVED INTENTIONAL
Alias: None
Product: kate
Classification: Applications
Component: sessions (other bugs)
Version First Reported In: unspecified
Platform: Ubuntu Linux
: NOR wishlist
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
: 126915 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-04-17 15:32 UTC by Francesco Montorsi
Modified: 2015-10-08 08:59 UTC (History)
7 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Francesco Montorsi 2006-04-17 15:32:41 UTC
Version:            (using KDE KDE 3.5.2)
Installed from:    Ubuntu Packages

Hi,
   I find it very useful the -u option of Kate; however when I work with different desktops, this gives me some troubles.

E.g. I open an instance A of kate in desktop1; from any desktop calling kate -u works as expected: instance A opens that file.

However if I now open a new kate instance B in desktop 2, and, while in desktop 2, I use the -u option, instead of opening the file in instance B, it opens it in instance A, thus I manually have to change desktop to see it. Instance B does nothing.

I understand that this is a behaviour which someone could consider the best one. 

To erase any problem I suggest to add a new option, which explicitely tells kate to open the given file reusing an instance *only* if that instance is in the current virtual desktop: if no kate instances are in current desktop, a new one is created.
Comment 1 Shriramana Sharma 2007-03-17 04:23:15 UTC
I was going to report this bug in a slightly different form but it's basically the same so I'll add my votes and comments. Please fix this. It's really irritating to open a file using right-click (which is configured to use kate -u) and having to move to another desktop to view that file. The desktops are meant to enable the user to separate the opened applications logically. For instance I have:

1. Productivity
2. Development
3. Multimedia

If I have a kate instance open on Development with many cpp and h files open, and I move to Productivity and open a text file containing some phone numbers this phone numbers file is opened on Development. It is not at all related to development and I expect to be opened in the current desktop. (I don't expect KDE to know that phone numbers are not related to development -- I only expect it to open the file in the current desktop because I am using the current desktop separately from all others for this purpose only.)
Comment 2 Bram Schoenmakers 2007-03-18 00:39:36 UTC
*** Bug 126915 has been marked as a duplicate of this bug. ***
Comment 3 Thomas Friedrichsmeier 2007-12-13 00:21:15 UTC
Similar to bug #128193 (probably either wish would obsolete the other).
Comment 4 Shriramana Sharma 2007-12-13 01:19:02 UTC
I vote for this one over the other. Apps which restrict themselves to one session only should follow the one-session restriction per desktop only. The only exception should be administration tools running under kdesu or any other tools where the potential conflict of two sessions is much more serious.

Each desktop is meant to be a quasi-independent productivity environment. The whole purpose is to separate (at least for me) different kinds of productivity. 

For example, I used to have a separate desktop for Multimedia, Development and Others. In Development I would open Kate to edit some source code, but in Multimedia I might open it to edit a playlist or whatever. 

These functionalities are from my POV in different fields so I want the Kate used in Development separate from the Kate in Multimedia. The other wish would prevent me from doing this.
Comment 5 zOOm_ER 2008-10-07 18:25:13 UTC
still need this in new kate (from KDE4)
Comment 6 Nicolas Bigaouette 2010-08-31 19:36:24 UTC
I am highly interested in such a feature. I'm using KDE 4.4.5 for now. I have many virtual desktops and open files mostly from the command line. I want to open the files in the session on the actual desktop.

This is a wish I had for a long time (pre KDE4) and IIRC, at some point (maybe 4.3 or 4.2?) the behavior seemed to have been what I wanted and I though it was fixed. I though people had worked on this and so I forgot about it. But now, if I open a file from a terminal, it will always open it in the first session reported by dbus. For example:
$ kate file.txt
org.kde.kate-17443running instance:Session 1
org.kde.kate-14557running instance:Session 2
will always open the file in "Session 1".

Now I have hacked something in bash to open a file in kate window of the active desktop. Basically I find the PID of kate that runs on the current desktop and launch kate using "--pid":
#!/bin/bash

current_desktop=`wmctrl -d | grep "*" | awk '{print $1}'`
echo "current_desktop = ${current_desktop}"

pid=`wmctrl -l -p | grep Kate | sed "s|.*  ${current_desktop} \([0-9]*\) .*|\1|g" | grep -v 0x`
echo "Kate on current desktop has PID ${pid}"

if [[ "x${pid}" == "x" ]]; then
    kate ${@}
else
    kate --pid ${pid} ${@}
fi

I now have a bash alias pointing to that script.

Couldn't something similar be included directly in kate? I tried to do the same thing using qdbus but couldn't not find how (don't know much about dbus/qdbus). But if it's possible to get that information from dbus, couldn't kate use that information?

Bug #128193 should be merged here I think.
Comment 7 zOOm_ER 2010-10-03 23:39:33 UTC
Given that "Desktop Activities" paradigm is more powerful than just vitrual desktops, it is probably would be wise to rely such a feature on it. 
Which means, that kate should be activities-aware, and mechanism of switching between them would be no harder than one of virtual desktops.
Comment 8 Stéphane Magnenat 2011-02-09 11:05:05 UTC
Well, desktop activities should not imply a reduction of features for virtual desktops, as not everyone uses activities. What is logical is that kate instance is reused in there exists already one in the current desktop and activity.
Comment 9 Shriramana Sharma 2012-07-24 15:31:34 UTC
Hello people -- this bug is over six years old. Is it that difficult to fix? Please see if you can devote some small amount of time to it! Thanks!
Comment 10 Iñaki Baz Castillo 2013-06-05 09:48:39 UTC
I vote for the approach suggested by the reporter. Please make it to work with different virtual desktops instead on relying on "activities" (after 9 years using KDE I still don't know what "activities" are and I don't want to know it).
Comment 11 Iñaki Baz Castillo 2013-06-05 09:49:23 UTC
*** This bug has been confirmed by popular vote. ***
Comment 12 Christoph Cullmann 2015-10-08 08:59:18 UTC
Dear user,

this wish list item is now closed, as it wasn't touched in the last two years and no contributor stepped up to implement it.

The Kate/KTextEditor team is very small and we can just try to keep up with fixing bugs. Therefore wishs that show no activity for two years or more will be closed from now on to keep at least a bit overview about 'current' wishs of the users.

If you want your feature to be implemented, please step up to provide some patch for it. If you think it is really needed, you can reopen your request, but keep in mind, if no new good arguments are made and no people get attracted to help out to implement it, it will expire in two years again.

We have a nice website kate-editor.org that provides all the information needed to contribute, please make use of it. For highlighting improvements our user manual shows how to write syntax definition files.

Greetings
Christoph