Nemo Custom actions help

Please post suggestions for improvement of Cinnamon on:
https://github.com/linuxmint/Cinnamon
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
mintman112

Nemo Custom actions help

Post by mintman112 »

Hi everyone i am really struggleing with how to add custom actions to nemo can someone please help?

I would like to add this action to right click in nemo so i can secure delete files with ease

shred -u -z -n 10
mintman112

Re: Nemo Custom actions help

Post by mintman112 »

Anybody?
grizzler

Re: Nemo Custom actions help

Post by grizzler »

This works for me (using nemo 1.8.4): create a file called shred.nemo_action or something like that, making sure the extension is nemo_action, in /usr/share/nemo/actions, containing

Code: Select all

[Nemo Action]
Name=Shred file
Comment=securely delete a file
Exec=/usr/bin/shred -uzn 10 %F
Icon-Name=gtk-execute
Selection=S
Extensions=any;
You can choose another icon if gtk-execute doesn't suit you.

Make sure you read the disclaimer in the man page so you understand why shred may not be effective on ext3 (and ext4) file systems.
mintman112

Re: Nemo Custom actions help

Post by mintman112 »

Many thanks for the help grizzler this worked fine with some files and then others it just wouldent delete i dont know whats wrong? im useing Mint 16 petra.
FM33

Re: Nemo Custom actions help

Post by FM33 »

Hello,

Is there a documentation for nemo actions ?
nathant

Re: Nemo Custom actions help

Post by nathant »

mintman112 wrote:Many thanks for the help grizzler this worked fine with some files and then others it just wouldent delete i dont know whats wrong? im useing Mint 16 petra.
I think you need to add the option -f to force shred to change permissions to allow overwriting

Nathan
User avatar
hatteras
Level 11
Level 11
Posts: 3884
Joined: Fri Sep 24, 2010 6:43 pm
Location: En el paraiso en la tierra
Contact:

Re: Nemo Custom actions help

Post by hatteras »

Todos somos muy ignorantes. Pero no todos ignoramos las mismas cosas.
Es un placer ayudar, y ver que a alguien le es útil.
Es un placer pedir ayuda y ver que alguien te la da desinteresadamente.
FM33

Re: Nemo Custom actions help

Post by FM33 »

Not really reading spanish, but it helped me a lot anyway (intuition + dictionary), thanks :D
User avatar
sadhu
Level 5
Level 5
Posts: 860
Joined: Fri Nov 22, 2013 9:48 am
Location: Sri Lanka
Contact:

Re: Nemo Custom actions help

Post by sadhu »

grizzler wrote:

Code: Select all

Exec=/usr/bin/shred -uzn 10 %F
Selection=S
I would change a some parameters in the nemo_action file:
  • Exec=/usr/bin/shred -uzn 2 %F; two overwrites, plus a final 'zero' overwrite is probably overkill on modern high-density drives.
  • Selection=any so that more than one file can be selected for shredding.
  • EscapeSpaces=true I added this because I was getting errors on files with spaces in the filename.
For SSDs or thumb drives, or HDDs with filesystem ext3/4 with journaling enabled, then shred is worthless. The only way to securely erase these devices is by using dd on the entire drive. And that may not even be enough. Smashing the device with a sledge hammer will also make the data unavailable, thus effectively erasing the medium.

See also viewtopic.php?f=42&t=230092

Sadhu
sabbe sattā bhavantu sukhitattā. LM 21.2-64 Cinn 5.8.4
User avatar
zpangwin
Level 1
Level 1
Posts: 21
Joined: Sun Mar 04, 2018 2:21 am
Location: Southeast U.S.
Contact:

Re: Nemo Custom actions help

Post by zpangwin »

In case this helps anyone else stumbling in from google...

If you also want a custom icon to go along with your custom action, then the nemo source code appears to just be passing the icon name to a GTK api function and letting it do the work of resolving the name to a file (apologies in advance if I am incorrect on this.. I only skimmed the code, it's been years since I played around in C/C++, and I am unfamiliar with using the GTK framework).

I tested this by searching for a few installed installed icons:

Code: Select all

SEARCH_FOR="antimicro"
find ~/.local/share/.icons -iname "*${SEARCH_FOR}*" 2>/dev/null;
find /usr/share -iname "*${SEARCH_FOR}*" 2>/dev/null;
For the above, the most likely png was '/usr/share/pixmaps/antimicro.png'. I saw some of the other icons in other formats (xpm, svg). Not sure about jpg/gif/ico/etc (i had image magick installed so just did 'convert file.ico file.png'). I assume square icon sizes are required. Anyway, this had worked for me:

Code: Select all

sudo cp git-ext-clone.png /usr/share/pixmaps/git-ext-clone.png
sudo chown root:root /usr/share/pixmaps/git-ext-clone.png
sudo chmod ugo+r /usr/share/pixmaps/git-ext-clone.png
~/.local/share/nemo/actions/gitext-clone.nemo_action

Code: Select all

[Nemo Action]
Name=GitExt Clone
Comment=GitExt Clone
Exec=/opt/GitExtensions/nemo-scripts/launch-gitext-clone.sh %F
Icon-Name=git-ext-clone
Selection=Any
Extensions=any;
Quote=double
/opt/GitExtensions/nemo-scripts/launch-gitext-clone.sh

Code: Select all

#!/bin/bash
/usr/bin/mono "/opt/GitExtensions/GitExtensions.exe" clone "$@" &
Locked

Return to “Cinnamon”