Post by chour on Jan 10, 2022 12:04:49 GMT
Open Thunar File Manager, menu - Edit - Custom Actions. This is where the "source of Thunar's power" is. Custom Actions allow you to significantly expand the context menu (right-click) of various file types.
But default is very little action here! Let's try to make your Thunar a strong man and add convenience to our work.
Open the Custom actions settings, click the "+" on the right - add an action.
On the first tab (Basic) we see:
--Name - write a short name for the action to be displayed in the Thunar menu
--Description - a description that explains the action (optional)
--Command - a command that will act on a file (folder). The command is usually followed by an option (% f for single files,% F for multiple files, and so on). The description of the option is given in the settings window.
--Keyboard shortcut - optional, only if you are not afraid to get confused in the system keyboard shortcuts.
The second tab - Appearance Conditions - is used to mark what types of files the action will be applied to.
=================
What to add?
Want to calculate the md5 checksum of a file? (zenity package must be installed)
command:
zenity --info --title="Calculate md5 for %n" --text="$(md5sum %f)"
for other checksums, you can add a command using ";"
zenity --info --title="Calculate sha1 for %n" --text="$(sha1sum %f)
zenity --info --title="Calculate sha256 for %n" --text="$(sha256sum %f)
zenity --info --title="Calculate sha512 for %n" --text="$(sha512sum %f)
as you can see, here you can write the name "md5", however, everything is at the request of the user.
Select file type - everything except Directories.
-----------
Want to compress a file and create an .xz archive with the original file removed?
Attention! Substitution of a file for an archive!
command:
xz %f
Select file type - everything except Directories.
-----------
Do you want to reduce the size of the image(picture) from 100% to 40% (while maintaining the width-height ratio)?
First install the imgp package and its dependencies.
Now let's set up the action.
command:
imgp -ix 40 %f
and in a few seconds you will receive a thumbnail copy of the picture.
As you can see, it is easy to fix the command of your choice.
Select file type - Image Files
----------
To reduce one or more pictures to a size of 1280(with proportional reduction in width)
imgp -ix 1280x1280 %F
Select file type - Image Files
The width value in the command can be changed at your discretion or you can create another action for quick conversion with different parameters.
----------
Enlarge 1 picture WITHOUT REGARD TO PROPORTIONS, indicating SPECIFIC sizes, for example, up to 2000х1000.
imgp -infx 2000x1000 %f
Select file type - Image Files
----------
Get media file metadata (if you have ffmpeg + zenity packages installed)
command:
ffmpeg -i %f 2>&1 | grep -e Stream -e Duration -e Input | zenity --width=800 --height=240 --text-info --title %n
Select file type - media(video+audio+image)
we get an output like this:
Input #0, avi, from '/path/my-vileo.avi':
Duration: 00:00:11.28, start: 0.000000, bitrate: 1208 kb/s
Stream #0:0: Video: mpeg4 (Simple Profile) (FMP4 / 0x34504D46), yuv420p, 720x480 [SAR 1:1 DAR 3:2], 1203 kb/s, 25 fps, 25 tbr, 25 tbn, 25 tbc
=========
Exotics:
Get a list of files in this folder command into a separate file:
command:
vdir %f awk '{print \$9, \$5}'| cat> 'List of files here'
get a text file with a list of files in this folder
Select file type - only Directories
----------
Get complex password (yad package must be installed)
command:
yad --info --center --title="Password" --text="$(< /dev/urandom tr -dc '[:punct:][:alnum:]' | head -c${1:-16};echo; %n)"
Select file type - only Directories
---------------
How to take advantage of this?
By right-clicking the mouse, we can get ADDITIONALLY the following features:
For text file
-- compress instantly into an archive with or without replacing the original file
-- view the last lines of the file (not covered here)
-- get checksums

For file-images
-- enlarge or reduce dimensions to specified dimensions or even without preserving aspect ratio
-- checksums, archives
-- optimize(not covered here)
-- get metadata


For folder
-- open as root(not covered here)
-- list of files in folder (detailed)(not covered here)
-- get a new password
-- snapshot with delay and area selection(not covered here)

=========
Come up with more Special Actions and turn Thunar into your helper.для Thunar Share with us!
Would you like to have additional Custom Actions for Thunar "out of the box", and which ones?
But default is very little action here! Let's try to make your Thunar a strong man and add convenience to our work.
Open the Custom actions settings, click the "+" on the right - add an action.
On the first tab (Basic) we see:
--Name - write a short name for the action to be displayed in the Thunar menu
--Description - a description that explains the action (optional)
--Command - a command that will act on a file (folder). The command is usually followed by an option (% f for single files,% F for multiple files, and so on). The description of the option is given in the settings window.
--Keyboard shortcut - optional, only if you are not afraid to get confused in the system keyboard shortcuts.
The second tab - Appearance Conditions - is used to mark what types of files the action will be applied to.
=================
What to add?
Want to calculate the md5 checksum of a file? (zenity package must be installed)
command:
zenity --info --title="Calculate md5 for %n" --text="$(md5sum %f)"
for other checksums, you can add a command using ";"
zenity --info --title="Calculate sha1 for %n" --text="$(sha1sum %f)
zenity --info --title="Calculate sha256 for %n" --text="$(sha256sum %f)
zenity --info --title="Calculate sha512 for %n" --text="$(sha512sum %f)
as you can see, here you can write the name "md5", however, everything is at the request of the user.
Select file type - everything except Directories.
-----------
Want to compress a file and create an .xz archive with the original file removed?
Attention! Substitution of a file for an archive!
command:
xz %f
Select file type - everything except Directories.
-----------
Do you want to reduce the size of the image(picture) from 100% to 40% (while maintaining the width-height ratio)?
First install the imgp package and its dependencies.
Now let's set up the action.
command:
imgp -ix 40 %f
and in a few seconds you will receive a thumbnail copy of the picture.
As you can see, it is easy to fix the command of your choice.
Select file type - Image Files
----------
To reduce one or more pictures to a size of 1280(with proportional reduction in width)
imgp -ix 1280x1280 %F
Select file type - Image Files
The width value in the command can be changed at your discretion or you can create another action for quick conversion with different parameters.
----------
Enlarge 1 picture WITHOUT REGARD TO PROPORTIONS, indicating SPECIFIC sizes, for example, up to 2000х1000.
imgp -infx 2000x1000 %f
Select file type - Image Files
----------
Get media file metadata (if you have ffmpeg + zenity packages installed)
command:
ffmpeg -i %f 2>&1 | grep -e Stream -e Duration -e Input | zenity --width=800 --height=240 --text-info --title %n
Select file type - media(video+audio+image)
we get an output like this:
Input #0, avi, from '/path/my-vileo.avi':
Duration: 00:00:11.28, start: 0.000000, bitrate: 1208 kb/s
Stream #0:0: Video: mpeg4 (Simple Profile) (FMP4 / 0x34504D46), yuv420p, 720x480 [SAR 1:1 DAR 3:2], 1203 kb/s, 25 fps, 25 tbr, 25 tbn, 25 tbc
=========
Exotics:
Get a list of files in this folder command into a separate file:
command:
vdir %f awk '{print \$9, \$5}'| cat> 'List of files here'
get a text file with a list of files in this folder
Select file type - only Directories
----------
Get complex password (yad package must be installed)
command:
yad --info --center --title="Password" --text="$(< /dev/urandom tr -dc '[:punct:][:alnum:]' | head -c${1:-16};echo; %n)"
Select file type - only Directories
---------------
How to take advantage of this?
By right-clicking the mouse, we can get ADDITIONALLY the following features:
For text file
-- compress instantly into an archive with or without replacing the original file
-- view the last lines of the file (not covered here)
-- get checksums

For file-images
-- enlarge or reduce dimensions to specified dimensions or even without preserving aspect ratio
-- checksums, archives
-- optimize(not covered here)
-- get metadata


For folder
-- open as root(not covered here)
-- list of files in folder (detailed)(not covered here)
-- get a new password
-- snapshot with delay and area selection(not covered here)

=========
Come up with more Special Actions and turn Thunar into your helper.для Thunar Share with us!
Would you like to have additional Custom Actions for Thunar "out of the box", and which ones?