Thursday, December 11, 2025

Paste with Ultracopier script

This script adds a service menu entry called "Paste with Ultracopier" when you right click in a folder inside a Linux supported file manager such as Dolphin or Nemo.

A service menu is just a .desktop file that can execute a shell command or run an external script. More about how to create a service menu can be found here https://develop.kde.org/docs/apps/dolphin/service-menus/:

In KDE-speak a "servicemenu" is a special entry that appears in a context menu (or other context-based interfaces) for a file (or for directory), depending on the type of files that are selected. 

Ultracopier is an utility that can replace the file copy dialog, similar to TerraCopy except it also works on Linux not just Windows but with one caveat. Do to how Linux file managers are build, the Ultracopier cannot override the default file copy manager. You can start the app and add source and destination manually but that's tedious and not how it should work. For this reason I made a script together with Gemini that detects if the file operation is cut or copy and executes the ultracopier app with the proper arguments such as CBcp or CBmv for clipboard copy or move. To detect between copy or move (cut) it searches for xclip, xsel or wl-paste on Wayland. At the end the copied files are selected by the use of inline Python D-Bus. 

Ultracopier file transfer dialog in Linux

Tested and made on OpenSUSE Tumbleweed KDE. 

Contents

Usage

Select one or multiple files/folders. From the context menu use Copy (CTRL+C) for copy or Cut (CTRL+X) to move the file by first copy then delete. Or for a single file use Copy Location (CTRL+ALT+C). Then on the destination directory right click on an empty area and select "Paste with Ultracopier" to copy or move the previously selected files. Now the Ultracopier GUI should appear with the file transfer dialog. Ultracopier will remain open in the system tray where you can configure it or manually close.

Motivation

For me, the main reason to replace the default file copier is the Checksum option. On Linux the only file manager that checks the files after they are copied is Thunar, but i prefer to use Nemo or Dolphin. On Windows I used to use TerraCopy. I always compare the file checksums since I had a loose HDD connector and I have noticed every now and then that some files were corrupted after being copied from one drive to another but there wasn't any warning. Another example is if you have a fake USB drive that reports the wrong size and if the size of the copied files is greater than the real capacity, the files will be copied "just fine" when in fact they are useless random data. If you have some wrong copied bits on a movie file you might not even notice but you might notice if the file is of an audio or image type. Imagine you transfer some rare family photos from the phone to the PC and not verify the integrity of the files and you loose the original source but you think you made a backup, just to notice that some photos are corrupted. In my opinion it worth to take the extra time for the file comparison.

Installation

Ultracopier 

First you need to compile Ultracopier for Linux which is very easy to do. Press CTRL+ALT+T to open up a terminal then download the project at an arbitrary location. Press tab to autocomplete and SHIFT + INSERT if CTRL+V doesn't work.

Set Downloads as the active folder.

cd ~/Downloads 

Clone the Ultracopier projects.

git clone https://github.com/alphaonex86/Ultracopier 

Move to project's folder. 

cd Ultracopier 

If qmake command is not found type qmake and press tab to see other names. For me it was qmake6. If qmake is not installed you might need to install these. Replace dnf with apt or zypper depending on your Linux distribution.

sudo dnf install qt6-qtbase-devel qt6-qtdeclarative-devel
sudo dnf install qt6-qttools-devel 

I recommend to compile with debugging disabled otherwise you will see an extra GUI window during file transfer. To do this, open the file Variable.h and make sure this line at the top is commented out by adding // at the beginning. If you have kate installed the fastest way to open a file is:

kate Variable.h

//#define ULTRACOPIER_DEBUG

Also comment out this line in ultracopier.pro by adding # at the beginning.

kate ultracopier.pro

# DEFINES += ULTRACOPIER_DEBUG ULTRACOPIER_PLUGIN_DEBUG ULTRACOPIER_PLUGIN_DEBUG_WINDOW 

Then use qmake or qmake6.

qmake ultracopier.pro

The next command is make and it takes a minute or two and if everything works the ultracopier executable should be in the same folder. There are some warnings of deprecated functions but they can safely be ignored.

make -j$(nproc)

Make the file executable then copy it to a location that is on the PATH so when the ultracopier is called you don't have to type the exact path to it but only 'ultracopier'.

chmod +x ./ultracopier

sudo cp ./ultracopier /usr/local/bin/ultracopier

Optionally, check if the executable is found

whereis ultracopier 

In case you want to change something to the project folder and need to recompile, use "make clean" to remove the generated files.

Service Menu

The service menu can be installed using the ultracopier-paste-installer.sh file which simply copies the 'ultracopier-paste.desktop' file to '/home/$USER/.local/share/kio/servicemenus' and the script 'ultracopier-paste.sh' to a 'Scripts' folder on the user's home folder. 

Open a terminal inside the folder where the  ultracopier-paste-installer.sh is located and run it like this:

./ultracopier-paste-installer.sh 

The file manager needs to be restarted for the context menu entry to appear. 

To remove the installed files, use the ultracopier-paste-uninstaller.sh the same way.

Support

If you fave some penny to spare you can donate some here: paypal.me/alientransducer.

Even though Ultracopier is free for Linux you might consider buying a license just to support the creator, here https://ultracopier.herman-brule.com

Download

v1.0 Ultracopier_ServiceMenu
Other Links
Ultracopier links https://github.com/alphaonex86/Ultracopier
https://ultracopier.herman-brule.com
Changelog
v1.0 11-12-2025:
- Public release under MIT license.

No comments:

Post a Comment