This project has moved to Gitlab.com
The GitHub repository here is not up-to date. Please refer to the repository on Gitlab.com for Issues, Releases and the up-to-date repository code.
The Thunar file browser has this awesome custom actions feature which can make working with Thunar pretty productive and personal.
Unfortunately, Thunar is not very flexible when it comes to the storing location of these custom actions: There is only one file ~/.config/Thunar/uca.xml
that can contain custom actions for that specific user. As far as I know, there is no possibility to define system-wide custom actions that apply to every user.
This is an attempt to realize system-wide Thunar custom actions that can easily be updated and maintained.
Writing your own custom actions for Thunar by hand can become frustrating pretty quickly. Eventually you will come to the point, where you would like to make it a little more sophisticated by adding one or more of the features below. This piece of software thunar-custom-actions addresses all of the following features:
Feature | Approach |
---|---|
ensure all needed software is present, e.g. on configuration migration or system reinstallation | configure or rather the Depends: section in the debian package |
ensure the actions work regardless of ugly characters in the filename (e.g. whitespace) | sensible shell programming |
ensure existing files don't get accidentally overwritten | ask the user for overwriting confirmation |
ensure a broken or failing action command does not accidentally delete files | cache an action's output in a temporary file before copying it over to the final location |
indicate progress on long-running actions | where possible, display a progressbar |
be able to interrupt an action | the Cancel button on the progressbar |
warn if an action failed | show a warning message |
provide translations | localisation with gettext |
maintenance: be able to apply changes to all actions at once | use m4 as preprocessor |
There are currently actions for:
- rotating images
- shrinking images
- grayscaling images
- filling transparent areas in images with a given color
- converting images to an A4 multi-page PDF document
- converting images to arbitrary formats
- concatenating PDF documents into one
- shrinking PDF file sizes
- de/encrypting arbitrary files with GPG (both symmetrically and asymmetrically)
- finding big elements in a folder
- creating symbolic links to files and folders
- showing checksums (MD5,SHA1,SHA256) of files
See some screenshots:
You then have to specify the recipient's public key from a list generated from a parsed output of gpg2 --list-public-keys
:
At its heart, thunar-custom-actions is actually just the script (Makefile) bin/uca-apply
that instructs the Python script bin/uca-manip
to merge or remove the custom actions provided by thunar-custom-actions (the files share/thunar-custom-actions/system-uca/*.xml
) into [the|each] user's Thunar configuration ~/.config/Thunar/uca.xml
.
The actions itself are (pretty long) pre-processed shell commands in the <command>
-tags of the configuration file. The macro language m4
is used for pre-processing. This enables sophisticated commands to be written as very simple m4
-macros which are scalable and easily maintainable.
The Debian package takes care of the actions provided by thunar-custom-actions automatically:
- adding them to the users' configurations on package installation
- removing them from the users' configurations on package removal
- removing the old, then adding the new actions on package update
The manual installation requires the user to do this himself.
The action merging/removal process is designed to NOT touch the actions that were there before! It should leave them totally untouched. So you should be safe to just try thunar-custom-actions and if you don't like it, uninstall it again without causing any damage to your configuration. But as always, you are encouraged to backup your ~/.config/Thunar/uca.xml
file before using thunar-custom-actions if you care about your already-defined custom actions.
I am testing thunar-custom-actions regularly on several different machines running Xubuntu 16.04 LTS. Actually, as long as you get it ./configure
d without errors, it should work regardless of the system used.
Disclaimer: I am paying a lot of attention here to prevent data loss or data corruption when executing the Thunar custom actions provided by thunar-custom-actions (e.g. by caching in temporary files, asking for overwriting permission, catching errors, etc...). Nonetheless I cannot guarantee that there are no cases where something might go haywire. So please use the actions provided with responsibility and the fact in mind that a mere mortal created them. I suggest you backup sensitive or important data you care about before running a custom action from here on it.
If you encounter any problems installing or using thunar-custom-actions, feel free to open a new Issue here on GitHub and describe your problem.
On Debian-based systems, thunar-custom-actions is best installed or updated via the Debian package. A Debian package is obtainable either:
- via Download from the releases page on GitHub or
- by creating it directly from the repository with
dpkg-buildpackage -us -uc
(You might need tosudo apt-get install dpkg-dev
before.)
Then install the *.deb
-package like so:
sudo dpkg -i thunar-custom-actions*.deb || sudo apt-get install -f -y
If you use my apt repository, installation is even easier:
sudo apt-get update && sudo apt-get install thunar-custom-actions
Also, you will get automatic updates when using my repository.
You can also install thunar-custom-actions by hand. You may want to do that if you don't have root privileges on your machine, or you are using a distribution that does not utilise the .deb
software package format.
# clone the repository
git clone https://github.com/nobodyinperson/thunar-custom-actions
cd thunar-custom-actions
./configure --prefix=$HOME/.local PASSWDFILE=/etc/passwd
make
make install
Errors when running ./configure
are most likely connected to requirements not being installed. It will tell you what's missing.
To merge the actions provided by thunar-custom-actions into your Thunar configuration, run:
uca-apply update
If you don't want them anymore, run:
uca-apply remove
To uninstall thunar-custom-actions, run from the git repository root:
make uninstall
To upgrade to the latest development version, run from the repository root:
uca-apply remove
make uninstall
git pull
./configure --prefix=$HOME/.local PASSWDFILE=/etc/passwd
make
make install
uca-apply update
If you installed it manually, make sure that you did a uca-apply update
afterwards to actually merge the actions provided by thunar-custom-actions into your Thunar configuration.
You may also close all thunar
instances, run thunar -q
from the terminal and then re-check if there are still no actions.
Okay, this should theoretically not happen. This probably means that either I didn't cover a special case in the code or that a software requirement is missing on your machine. To get more information on your problem:
- start
thunar
from the command-line - repeat the steps to produce your problem
- save the output from the terminal
- open a new Issue here on GitHub and paste it there so I can help you.
This is because Thunar drops all translations but the current locale from its custom actions configuration file.
Close all Thunar windows, then run uca-apply remove && uca-apply update && thunar -q
to re-add all translations. The next time Thunar is opened, it will again remove all translations but the (desired) current locale.
See the instructions in CONTRIBUTING.md.