Bug 292518

Summary: New tab shows local terminal instead of remote when running konsole via ssh kio
Product: [Applications] konsole Reporter: Maximiliano Bertacchini <maxiberta>
Component: generalAssignee: Konsole Developer <konsole-devel>
Status: RESOLVED FIXED    
Severity: wishlist CC: adaptee, alex-kostjukov, anthony.renoux, bookwood, g111, maurokino, Stefan.Borggraefe, tsdogs
Priority: NOR    
Version: 2.8   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed In: 4.9.0
Sentry Crash Report:
Attachments: This patch adds a "Clone Current Tab" action
Updated "Duplicate Tab" patch for Konsole

Description Maximiliano Bertacchini 2012-01-26 21:22:23 UTC
Version:           2.8 (using Devel) 
OS:                Linux

In kde 4.7 and before it was possible to open an ssh session in Konsole by typing ssh://user@host in krunner, and every new tab would be "cloned", ie. it would try to reconnect through ssh. This is really handy when working in several shells in a remote server, specially if using ssh keys or ssh connection multiplexing. In these cases, new tabs would immediately open a new ssh terminal without asking for a passphrase.

In kde 4.8 instead new tabs always start a local shell.

Reproducible: Always

Steps to Reproduce:
1. Open an ssh terminal via ssh kio, either by:
  - typing "ssh://user@host" in krunner, or
  - running kioclient exec ssh://user@host in any terminal
2. Open a new tab in the newly opened konsole window

Actual Results:  
The new tab shows a local terminal

Expected Results:  
The new tab should open a remote ssh terminal

Maybe related to bug #184788 ?
Comment 1 Jekyll Wu 2012-01-26 23:20:09 UTC
Thanks for reporting.

Yes, your guess for bug 184788 is right. The behavior is changed mainly because it is often confusing and annoying, although handy in some cases. "New Tab" action triggered though shortcut (Ctrl+Shift+T by default) should always open new tab using the default profile. That's the most intuitive way and what most users would expect.

So the problem is users might have different expectation of what "New Tab" should do in that case. I personally prefer the current way over the old way, because it at least allow users to open local shell in new tab, while the old way might make it impossible if no profile is set to "show in menu".

As I have suggested in bug 254976, one solution could be adding a new action dedicated for the lost handy feature: "Clone Tab".

Finally, there is a trick at the moment: use "konsole --profile some-ssh-profile" (or use the Konsole sessions plugin for krunner) instead of "konsole -e ssh user@host". Then "New Tab" will behave like "Clone tab". However, I personally see that as a hidden bug so it might stop working sometime later.
Comment 2 Maximiliano Bertacchini 2012-01-27 18:01:14 UTC
Created attachment 68244 [details]
This patch adds a "Clone Current Tab" action
Comment 3 Maximiliano Bertacchini 2012-01-27 18:01:49 UTC
Comment on attachment 68244 [details]
This patch adds a "Clone Current Tab" action

This patch adds a new "Clone Tab" action which creates a new tab and copies the command and arguments from the current session into the new one. Its shortcut is Ctrl+Alt+C.

I'm using this patched konsole and so far it's working fine. And multiple ssh sessions are back :D
Comment 4 Jekyll Wu 2012-01-28 10:53:43 UTC
(In reply to comment #3)
> (From update of attachment 68244 [details])
> This patch adds a new "Clone Tab" action which creates a new tab and copies the
> command and arguments from the current session into the new one. Its shortcut
> is Ctrl+Alt+C.
> 
> I'm using this patched konsole and so far it's working fine. And multiple ssh
> sessions are back :D

Thanks for the patch. However, There are some problems :

1). It changes konsoleui.rc without increasing the version number. 
    
    Actually, I'm not sure whether that new action should be accessible through menu. At least, putting "Clone Tab" near "Close Tab" is a little problematic, since they are very similar in the English locale. 

2). Its default shortcut is Ctrl+Shift+C, conflicting with the "Copy" action.

3). What that action does is not fully "clone". It only clones the command of current session, but all other settings(color theme, encoding, etc) are from the default profile. The appropriate way is to find out the profile(either permanent or temporary) associated with current session, then use that profile to create new tab. Unfortunately, due to the way how command line option "-e" is processed , that way does not work as expected at the moment.


So I think this issue needs to wait for some time :)
Comment 5 Maximiliano Bertacchini 2012-01-29 18:26:09 UTC
(In reply to comment #4)

Thanks for your suggestions. Here's an updated patch.

> 1). It changes konsoleui.rc without increasing the version number. 
>     Actually, I'm not sure whether that new action should be accessible through
> menu. At least, putting "Clone Tab" near "Close Tab" is a little problematic,
> since they are very similar in the English locale. 
 
Updated konsoleui.rc version, and action renamed as "Duplicate Tab".

> 2). Its default shortcut is Ctrl+Shift+C, conflicting with the "Copy" action.

Shortcut is now Ctrl+Shift+D, which has no conflicts AFAIK.
 
> 3). What that action does is not fully "clone". It only clones the command of
> current session, but all other settings(color theme, encoding, etc) are from
> the default profile. The appropriate way is to find out the profile(either
> permanent or temporary) associated with current session, then use that profile
> to create new tab. Unfortunately, due to the way how command line option "-e"
> is processed , that way does not work as expected at the moment.

This action now gets the profile of the current session from SessionManager and uses it to create the new one.
Comment 6 Maximiliano Bertacchini 2012-01-29 18:27:34 UTC
Created attachment 68308 [details]
Updated "Duplicate Tab" patch for Konsole
Comment 7 Jekyll Wu 2012-01-31 15:14:30 UTC
Sorry, I didn't express myself clear enough when I said "this issue needs to wait for some time". I mean I would like to do some clean up of related code before fixing this issue. That would make the needed change smaller and cleaner, IMHO.

Anyway, thanks for your following-up :)
Comment 8 Jekyll Wu 2012-02-03 18:41:38 UTC
I have created a review request at https://git.reviewboard.kde.org/r/103859/. Feel free to leave your comment there.
Comment 9 Jekyll Wu 2012-02-10 18:43:19 UTC
Git commit 56acddac933b96c10c782a918a419f6aaf4b2702 by Jekyll Wu.
Committed on 10/02/2012 at 19:37.
Pushed by jekyllwu into branch 'master'.

Add 'Clone Tab' action for cloning current tab

This action will create new tab/session using the same settings(command,
colors, etc) used in current tab/session.

At this moment, this action does not always clone current tab/session
100%. For example, If you change the scrollback setting of current
session temporarily through context menu or dbus method, this action
won't clone the temporary change. Another example is the tab title.

On the other hand, this action works quite well with command line
options(-e, -p, etc) and the 'konsoleprofile' utility.
Related: bug 254976
FIXED-IN:4.9.0

REVIEW:103859

DIGEST:

M  +3    -1    desktop/konsoleui.rc
M  +23   -0    src/MainWindow.cpp
M  +2    -0    src/MainWindow.h

http://commits.kde.org/konsole/56acddac933b96c10c782a918a419f6aaf4b2702
Comment 10 Jekyll Wu 2012-03-22 15:10:09 UTC
*** Bug 296524 has been marked as a duplicate of this bug. ***
Comment 11 Jekyll Wu 2012-03-28 14:18:41 UTC
*** Bug 296960 has been marked as a duplicate of this bug. ***
Comment 12 Jekyll Wu 2012-04-10 21:18:20 UTC
*** Bug 297852 has been marked as a duplicate of this bug. ***
Comment 13 Jekyll Wu 2012-04-19 09:11:05 UTC
*** Bug 298398 has been marked as a duplicate of this bug. ***
Comment 14 Jekyll Wu 2013-01-26 00:03:15 UTC
*** Bug 313903 has been marked as a duplicate of this bug. ***