Bug 276912 - newSession() dbus call does not allows to open new session in specified window
Summary: newSession() dbus call does not allows to open new session in specified window
Status: RESOLVED FIXED
Alias: None
Product: konsole
Classification: Applications
Component: general (show other bugs)
Version: 2.7
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: Konsole Developer
URL:
Keywords:
: 253833 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-07-01 19:39 UTC by Marian Kyral
Modified: 2012-03-03 01:18 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.9.0
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marian Kyral 2011-07-01 19:39:48 UTC
Version:           2.7 (using Devel) 
OS:                Linux

Currently, org.kde.konsole.Konsole.newSession() methods are always creating a new session under first (or lowest?) konsole window. Would be good, to allow to create a new session to defined window. E.g. I have two konsole windows open, each on different desktop. When I create a new session in second konsole window, the session is not opened in current window, where I'm expecting it, but in the first window.

To solve it a new method currentWindow() should be added. It will be similar to the org.kde.konsole.Konsole.currentSession() method. Also a new methods org.kde.konsole.Konsole.newSession() accepting window parameter, needs to be created.


Reproducible: Always

Steps to Reproduce:
1) Open two konsole windows
2) Go to second konsole window
3) Run command: qdbus org.kde.konsole /Konsole newSession


Actual Results:  
New session is open in first konsole window

Expected Results:  
New session is created in specified konsole window. When not specified, the current window should be used. If current window is not available (script is running outside of the konsole window), lowest konsole window will be used.
Comment 1 Jekyll Wu 2011-08-12 07:12:33 UTC
*** Bug 253833 has been marked as a duplicate of this bug. ***
Comment 2 Roland Pabel 2011-10-27 00:13:56 UTC
I just wish to add that I think someone misfiled this as "wishlist", it should be a bug. Why? Because the dbus methods don't behave as expected.
For example, after you create a new session in a second window, calling nextSession() and prevSession() will traverse (loop) the sessions in the first window only.
So you can query your session id with currentSession() and then trying to find it using prev/nextSession() fails.
If this is not a bug, what is the idea behind it?
I'd really like to see this resolved, it's drving me crazy sometimes...
Comment 3 Jekyll Wu 2011-10-27 00:45:40 UTC
(In reply to comment #2)

You are right. It is a bug. My fault of changing its severity when I have not fully understood the underlying problem.

FYI, this bug is really not ignored. You can read comment #2 in bug 281513 to get a general idea why some dbus methods behave in a strange way.
Comment 4 Jekyll Wu 2012-02-08 17:52:58 UTC
Git commit 07cddfe302233c3555258f077429e55ce622e262 by Jekyll Wu.
Committed on 08/02/2012 at 18:49.
Pushed by jekyllwu into branch 'master'.

Create dbus object for each Konsole window respectively

Its naming scheme is "/Windows/N", similar to "/Sessions/N" for
sessions. That is not the final decision and might change before next
major release.

The old "/Konsole" dbus object is still available at this moment, but
it might disappear or be used for something different in the future, so
it is better to use "/Windows/N" from now on.

For convenience, $KONSOLE_DBUS_WINDOW can be used to refer to the dbus
object corresponding to the Konsole window containing current session.
Note, that environment variable does not work well with detaching and
draging. Maybe it should not be added at all.
Related: bug 281513, bug 292309

REVIEW:103790

M  +2    -0    src/Application.cpp
M  +5    -0    src/Session.cpp
M  +2    -0    src/Session.h
M  +11   -0    src/ViewManager.cpp
M  +5    -0    src/ViewManager.h

http://commits.kde.org/konsole/07cddfe302233c3555258f077429e55ce622e262
Comment 5 Marian Kyral 2012-02-10 08:28:21 UTC
Hi, it works great, thanks.

Regarding to $KONSOLE_DBUS_WINDOW. Maybe could be replaced by currentWindow() dbus call. (similar to currentSession())
Comment 6 Jekyll Wu 2012-02-26 00:46:21 UTC
Well, not that easy or feasible.

The situation is complicated by the fact that Konsole support these three features:

1). Split view, which means one session might have multiple indenpendant views
2). Detaching view, which means one view can be detached from one window and live in its own new window.
3). Dragging view, which means one view can be dragged from window 1 to window 2

So taking all those flexible and dynamic behavior into account, it is quite hard or just impossible to answer the question: "which window does that or current session lives in?"