Bug 428265

Summary: Expose konsolepart shortcuts in Dolphin's shortcuts view
Product: [Applications] dolphin Reporter: Andrew Shark <ashark>
Component: panels: terminalAssignee: Dolphin Bug Assignee <dolphin-bugs-null>
Status: RESOLVED FIXED    
Severity: wishlist CC: jagarni1983, kfm-devel, nate, schlichtanders
Priority: NOR    
Version: 20.08.2   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 22.04

Description Andrew Shark 2020-10-26 09:14:43 UTC
There is no way to change shortcuts for terminal panel in Dolphin.
For example, I like to use ctrl+C and ctrl+V for copying and pasting in terminal. But in shortcuts settings there is currently no such possibility.

In Yakuake in shortcut settings, there are two subsets of them: Konsolepart and Yakuake. In Konsolepart subset I could change Copy or Paste actions without any problem.

Could similar thing be done for Dolphin? I mean, adding Konsolepart subset of shortcuts to the Dolphion shortcut settings.

OS: Arch Linux
KDE Plasma Version: 5.20.1
KDE Frameworks Version: 5.75.0
Qt Version: 5.15.1
Comment 1 Nate Graham 2020-10-26 14:39:37 UTC
FWIW the shortcuts are Ctrl+Shift+C and Ctrl+Shift+V. Using Ctrl+C as the copy shortcut makes no sense since Ctrl+C is a shell signal to kill the current program.

Adding a Konsolepart subset of shortcuts to the Dolphion shortcut settings seems reasonable.
Comment 2 Andrew Shark 2020-10-26 16:19:22 UTC
Yeah, I know about standard shortcuts, thanks. I just really want to swap them, because I do copy-pasting much more often than interrupting a process. It drive me nuts sometimes, because I often accidently press ctrl+shift+c in chromium instead of ctrl+c, so the web console opens. I am aware about ctrl+c in terminal, and I would happily use it for example in tty, but not in desktop environment.

In yakuake it works this way: if you highlight the text with mouse, then pressing ctrl+c copies it. If there is no selected text, then it works as usual ctrl+c (process interrupting). Seems ok to me also.
Comment 3 Nate Graham 2020-10-26 18:17:23 UTC
Now that's interesting. Might be worth adding that to konsolepart too (in a separate bug report of course). If you file it, I'll support it.
Comment 4 Andrew Shark 2020-10-27 22:00:52 UTC
Here it is: Bug 428363
P.S. thanks for all your work and weekly blog!
Comment 5 Nate Graham 2020-10-28 19:22:42 UTC
*** Bug 428363 has been marked as a duplicate of this bug. ***
Comment 6 Stephan 2021-07-27 12:29:39 UTC
I also wanted to switch the copy paste shortcuts and was able to do this everywhere but in Dolphin... would be really nice if Dolphin supports adaptation of the konsolepart shortcuts.

Does someone knows of a workaround, e.g. changing some config files manually?
Comment 7 Stephan 2021-12-02 07:40:31 UTC
@Nate Graham this is the key feature I am missing in dolphin. Is there any roadmap/plan of supporting it?

In case it is straightforward to implement this on your own, I am happy to give it a try over christmas, however I am on nixos, never wrote something for KDE and I am a bit afraid, that the dev setup is not straightforward. Maybe I am wrong and there is a standard dev docker or similar to get started quickly.

If someone else can implement this in a reasonable amount of time, say 2 months, e.g. by adapting from Yakuake, I would also be willing to support it by cash, e.g. 50€.
Comment 8 Nate Graham 2021-12-02 16:21:01 UTC
I have no idea what it would take to support this, sorry. You're welcome to work on it, though! The instructions for setting up a development environment can be found at https://community.kde.org/Get_Involved/development. I'd be happy to help. If you run into trouble, you can post about it in the #kde-devel Matrix room. I'm in there and I can help to answer questions.
Comment 9 Stephan 2021-12-28 10:37:24 UTC
I've investigated the code and understood roughly what needs to be done
- use the code by this yakuake patch https://invent.kde.org/utilities/yakuake/-/commit/a0b08cb1f71ef18449bfbf5852c01e323604142f
- and bring it into dolphinmainwindow.cpp https://invent.kde.org/system/dolphin/-/blob/v21.08.3/src/dolphinmainwindow.cpp

The code from yakuake patch was build to work with several integrated terminals and hence constructs a list of subactions, which then also get updated if one is updated. This can be simplified for dolphin as it only has one integrated konsolepart.

-------------------------

I've tried to setup a development environment using the kde-pim-docker https://community.kde.org/KDE_PIM/Docker however it didn't work. Being in the docker shell, I installed everything with `kdesrc-build --include-dependencies dolphin`
and then run `~/kdesrc-build/kdesrc-run dolphin`. It failed with the following which I was not able to fix
```
neon@b1df127876b0:~$ ~/kdesrc-build/kdesrc-run dolphin
################################################################################
kdesrc-run
Module:             dolphin
Program:            dolphin
Revision:           c071150b7d30c8826496f130b792aed47d4f8326
Arguments:
################################################################################

No protocol specified
qt.qpa.xcb: could not connect to display :0
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, xcb.

Aborted (core dumped)
```
@Nate Graham can you help about where to get help for such specific development issues?

I only found that kde-pim actually does not support dolphin, but only KDE pim applications, so I felt a bit lost with this development environment. On the other side, the bug sounds like very basic, so I am expecting the docker image to run as expected. 

My graphics card is an intel card "Mesa Intel(R) Iris(R) Plus Graphics (ICL GT2)" with OpenGL 4.6 (Compatibility Profile) Mesa 21.2.5. I am running the docker on NixOS.
Comment 10 Stephan 2022-01-03 09:27:19 UTC
I've been able to setup an alternative dev environment, make it work, and made a pull request
https://invent.kde.org/system/dolphin/-/merge_requests/320

Some last open questions arise, as I've been able to add new shortcuts, but was not able to add CTRL-V as a shortcut for paste... maybe some interaction with the existing dolphin setup, don't know.
Comment 11 Méven Car 2022-01-25 17:33:05 UTC
Git commit d71b617205ce152dedc5d3a5b5b801697741f8eb by Méven Car, on behalf of Stephan Sahm.
Committed on 25/01/2022 at 17:33.
Pushed by meven into branch 'master'.

Expose konsolepart shortcuts in Dolphin's shortcuts view

Adapt some changes from Yakuake https://invent.kde.org/utilities/yakuake/-/commit/a0b08cb1f71ef18449bfbf5852c01e323604142f

credit to Stephan Sahm @schlichtanders

M  +16   -1    src/dolphinmainwindow.cpp
M  +6    -0    src/dolphinmainwindow.h
M  +35   -0    src/panels/terminal/terminalpanel.cpp
M  +3    -1    src/panels/terminal/terminalpanel.h

https://invent.kde.org/system/dolphin/commit/d71b617205ce152dedc5d3a5b5b801697741f8eb
Comment 12 Andrew Shark 2022-12-01 09:01:25 UTC
*** Bug 196482 has been marked as a duplicate of this bug. ***
Comment 13 Andrew Shark 2022-12-01 09:18:40 UTC
Possibly this bug was fixed wrong. The shortcuts does not actually work. See Bug 452745.