1

I am using KDE Plasma 5.12.7 on Kubuntu 18.04 (for details of my system configuration, see below).

I would like a clipboard manager and a file manager that would together allow me to rename files, where I would build a single new filename by combining several items from the clipboard history. I would like to be able to do it within the file manager (while it is in its 'rename' mode) through using global shortcuts that directly paste the individual items from the clipboard history onto the blank filename. (By 'blank filename' I'm referring to what you get when, in a file manager, you right-click a file and select 'rename'. This is inline renaming; in all file managers I tried, it is only for batch renaming of multiple files that a renaming dialog window opens. I rarely batch rename files, so it's the inline process that is relevant here.)

This comes up when I try to rename a downloaded article into something like e.g. 'Smith and Williams A new algorithm for matrix multiplication J Num Math 45 897-903 2004.pdf'. I usually have to copy the last name of each author separately, each line of the title (if it's long) separately, etc., so that all those things become items in the clipboard history.

In other words, I would like the following functionality:

  1. Copy at least 10 items onto the clipboard history, e.g. item 0 is 'Smith', item 1 is 'Williams', item 2 is 'A new algorithm for matrix multiplication', item 3 is 'J', item 4 is 'Num', item 5 is 'Math', item 6 is '45', etc.
  2. I should be able to paste these items via global shortcuts. For example, meta+shift+1 pastes 'Smith', meta+shift+2 pastes 'Williams', etc.
  3. I should be able to use these shortcuts while inline-renaming a filename within the file manager. So e.g. in Dolphin, I would highlight the file I wish to rename, press f2 (which invokes the 'rename' function), delete the old filename, and then rename the file into 'Smith and Williams A new algorithm for matrix multiplication J Num Math 45 897-903 2004.pdf' by pressing meta+shift+1, then typing ' and ', then meta+shift+2, then typing ' ' (i.e. just ordinary space), then meta+shift+3, etc.

I should mention that I was able, for a while, to have this functionality in Windows 7, using the standard Explorer file manager and a clipboard manager called Ditto.

Under kubuntu+KDE Plasma, the only clipboard manager that I've been able to find that in principle allows for something like this functionality is CopyQ. I wrote new commands, with appropriate global shortcuts, that look like this:

the first global shortcut, meta+shift+1, executes
copyq:
select(0)
paste()

the second global shortcut, meta+shift+1, executes
copyq:
select(1)
paste()

and so on.

This works as expected inside text editors, e.g. Kate.

However, it does not work when I try to rename a file within Dolphin. What happens instead is that when the global shortcut is pressed, Dolphin exits the renaming mode and... actually, it's not clear what it does next. Sometimes it leaves the filename as it was, sometimes it prompts me with 'Filename for clipboard content'. Sometimes it apparently simply deletes the file I was trying to rename (without moving it to trash, which is kind of disturbing).

I tried using two other file managers, Krusader and Konqueror, but they also did not support this functionality in combination with CopyQ. The problem is the same as with Dolphin: when I try to use the global shortcut, they just exit the filename renaming mode and leave the old filename intact.

Another clipboard manager that comes close to what I want is Klipper. One problem with Klipper is that there don't seem to be any global shortcuts that directly access the items in the clipboard history. What I was able to do instead is this: in system settings-> workspace->shortcuts->Global shortcuts->Plasma, I assigned shortcuts to 'Next history item' and 'Previous history item'. I can use those to cycle through the clipboard, and use ctrl+v (or sometimes the middle button) as usual to paste them.

This is not exactly what I want, but I could accept it if it worked for the purposes of file renaming. However, once again, while this sort of cycling through the clipboard history plus ctrl+v works fine within text editors, it does not work within file managers: as soon as a global shortcut is pressed, the file manager exits the renaming functionality.

It is true that I could use these two clipboard managers on the command line (i.e. in Konsole). I can indeed use the cp command and then build the new filename on the command line using the global shortcuts, which do work inside Konsole. But I want to be able to do it within a file manager.

For what it's worth, the same problem appears if I try to paste from e.g. texpander: the moment its global hotkey is pressed, the file manager exits the renaming mode.

Now, if a renaming window opens, then I can normally paste into it from the clipboard managers and texpander. But such a window only opens if I try to batch rename more than one file, which I rarely do.

Does anyone have any ideas about how I might be able to have the functionality I described? Is there no way to use global shortcuts within the inline renaming function of a file manager?

I did a lot of googling, but found nothing.

Here are the versions of the various components of my system:
kubuntu 18.04
KDE Plasma Version 5.12.7
KDE Frameworks: 5.44.0
Qt: 5.9.5
kernel version: 4.18.0-17-generic
machine: Dell Precision M4800 (which is a 64-bit machine)

  • Do you have some sort of bibliography program or reference manager to store your citations? Is the set of operations you outlined something you need to do for a few files or for numerous files? – Justice for Monica Apr 7 at 2:07
  • I don't know how helpful this is but I can paste text from my texpander list into the dialog window that appears when I press F2 to rename a file in Dolphin. – Justice for Monica Apr 7 at 2:11
  • @dk-bose These are not necessarily articles I will be citing, but rather articles that I download while researching a topic, so I don't want to immediately make a BibTeX entry for them (for example). Probably just author name and the title might be enough, but that's still at least two items to copy and paste from a typical journal page/downloaded article. So, I download an article, then rename into something I'd recognize later (also something my file manager will find if I search for a keyword from the title). On some days, I may download five or ten articles like that. – linguisticturn Apr 7 at 9:05
  • @dk-bose Yes, I too can paste into batch rename dialog window. However, if I try to rename just a single file, then no such dialog window appears. Instead, my version of Dolphin behaves just as described in the Dolphin handbook: pressing f2 Renames one currently selected item inline. Opens the batch rename dialog if several items are selected. And I checked if texpander can paste inline, and it can't. Same problem: the moment a global hotkey is pressed, Dolphin exits the renaming mode, leaving the file name as it was. – linguisticturn Apr 7 at 9:29
1

There turns out to be a simple solution: turn off inline renaming (in Dolphin: Control->Configure Dolphin...->General->Behavior->deselect 'Rename inline').

Now the renaming is done within a dialog window, and I can use global shortcuts to paste from clipboard managers.

I would still like to know why we can't do this inline, but that, perhaps, should be posted as a separate question.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.