Context Action Menu additions

Savman
  2 years ago
  2

The context menu is the pop-up menu you get when you right click on a file or directory. Linux Mint does a great job with providing options, but I like to have some more choices to select in the menu. So, I thought I would pass on what I did and maybe you could benefit from my work.

**The directories to place the custom action files: **
~/.local/share/nemo/actions/    used for your user actions.
usr/share/nemo/actions/           used for system-wide actions. Root access is required.
 
**Note - Your .local directory is hidden so you may need to use Ctrl+h to see any hidden files or directories.
**Note - Actions files must have the .nemo_action file extension:  sample.nemo_action
**Note - You will need to log off then log back in or restart nemo before the actions are available
**Note - You will need to install an application called ffmpeg. From the terminal run     
     
 
$ sudo apt install -y ffmpeg

 

 The large bold type is the nemo action and below that is the information for the action

Reduce Image by 50%- used on various image files to reduce the image size by 50%.

**Note – the new reduced image will be stored in the users home directory. The new file will be called copy-50 + the original file name.**

Create a file in one of the above actions directories and name the file reduce_50.nemo_action. Add the below text inside the file. Then save and exit

 

[Nemo Action]
Active=true
Name=Reduce Image 50%
Comment=Reduce the size of the image by 50%
Exec=ffmpeg -i %F -vf scale=iw/2:-1 copy-50%f
Icon-Name=image
Selection=any;
Extensions=jpg;jpeg;png;bmp;gif;tiff;raw;
Terminal=true
 

 

Reduce Image by 75%- used on various image files to reduce the image size by 75%.

**Note – A new reduced image will be stored in the users home directory. The new file will be called copy-75 + the original file name.**

Create a file in one of the above actions directories and name the file reduce_75.nemo_action. Add the below text inside the file. Then save and exit

 

[Nemo Action]
Active=true
Name=Reduce Image 75%
Comment=Reduce the size of the image by 75%
Exec=ffmpeg -i %F -vf scale=iw/4:-1 copy-75.%f
Icon-Name=image
Selection=any;
Extensions=jpg;jpeg;png;bmp;gif;tiff;raw;
Terminal=true
  

Convert to mp3 – used to convert various audio files to an mp3 format.

Create a file in one of the above actions directories and name the file music-convert.nemo_action. Add the below text inside the file. Then save and exit

 

[Nemo Action]
Active=true
Name=Convert to MP3
Comment=Convert an audio file to the MP3 format
Exec=ffmpeg -i %F %F.mp3
Icon-Name=emblem-music-symbolic
Selection=any;
Extensions=wav;ogg;aac;m4a;flac;mp4;wma;aac;midi;aif;aifc;aiff;au;ea
Terminal=true
 

 

Images to video – You can select multiple images to make a small video. This one is the most complex because it requires 2 files for it to work. A nemo_action file and a bash script file.

Create a file in one of the above actions directories and name the file image-to-video.nemo_action. Add the below text inside the file. Then save and exit

 

[Nemo Action]
Active=true
Name=Images to Video
Comment=Create video from images
Exec=<image-to-video.sh %F>
Icon-Name=image
Selection=m
Extensions=jpg;jpeg;png;bmp;gif;tiff;raw;
Quote=double
Terminal=true

 

Next create a file called image-to-video.sh in the same directory you saved the nemo_action file.

Add the below text inside the file. Then save and exit. You will need to make this file executable.
 
 
#!/bin/bash
for f
     do
        echo "file '$f'
duration 3" >> ~/Videos/mylist.txt
     done
 
ffmpeg -f concat -safe 0 -i ~/Videos/mylist.txt -s 500x300 ~/Videos/"$(date '+%b-%d-%Y %T').mp4"
rm ~/Videos/mylist.txt
 

 

**You can make some changes to the image-to-video.sh and make it the way you want the video to look. Below explains what you may want to change.

  • duration 3” – This sets the amount of time (in seconds) each image is displayed.

  • -s 500x300 – This is the size of the video. I picked 500x300 because it works for me. You can put whatever you want but, a larger size will increase the output file size.

  • ~/Videos/"$(date '+%b-%d-%Y %T').mp4" – This part places the video in the users Videos directory and names it by the current date and time of the system.

  • rm ~/Videos/mylist.txt - This will delete the mylist.txt file. If you remove this line, the mylist.txt file will continue to grow in size adding more images to the out put file.

 

I hope you enjoy the new menu selection

Comments
Savman 2 years ago

Atlant:
Please verify that you (1) installed ffmpeg (2) named the file correctly and (3) put the file in ~/.local/share/nemo/actions/


atlant 2 years ago

I tried the above regarding converting to mp3, rebooted but the menu did not appear - maybe the "linux mint" version no longer supports these features?