1

I would like to have this option in my menu on right click.

At the moment it looks like this:

enter image description here

And I know that I can hit Ctrl+H to show the hidden files but I want to learn so if I want to add some other options later I can use this answer.

0

Yes‚ you can do it with this steps:

nano ~/.local/share/nautilus/scripts/hide_or_show

And then paste this lines to it:

#!/bin/bash
OLDSTATE=$(gsettings get org.gtk.Settings.FileChooser show-hidden)
if [ "$OLDSTATE" == "false" ] ; then
gsettings set org.gtk.Settings.FileChooser show-hidden true
else      
gsettings set org.gtk.Settings.FileChooser show-hidden false
fi

And then make this file executable:

chmod +x  ~/.local/share/nautilus/scripts/hide_or_show

And then restart nautilus:

nautilus -q

And after this you can right-click on any files and then from scripts choose hide_or_show.


But if you want to hide_or_show display every where like empty space (not only when a files is selected):

1.Install nautilus-actions:

sudo apt install nautilus-actions

2.Then click on Define a new action.

3.From action tab, in the Context-label field, type hide_or_show (or any other names that you want)

4.Then check the Display item in location context menu.

5.From Command tab, in the Path, type /home/YOURUSERNAME/.local/share/nautilus/scripts/hide_or_show

6.Then save the changes by Ctrl+s and then restart nautilus:

nautilus -q

So with this steps hide_or_show is always visible in context menu > nautilus Actions action.

| improve this answer | |
  • I am not sure if we understand each other. I wanted to have an option in right click menu to show all hidden files like in pcmanfm file explorer. – lewis4u Jun 5 '17 at 18:08
  • @lewis4u Thanks for your reply; No this instruction do the same thing as you want . Please try it ;) – Ali Razmdideh Jun 5 '17 at 22:42
  • Yes, it works...but it's not as i wanted to...to be seamless like the option "Open in Terminal" in standard right click menu. You must click on some file to be able to change show_hide, it would be nice when it could work by clicking in empty space like in pcmanfm – lewis4u Jun 6 '17 at 14:17
  • @lewis4u yes ; but the in second method you can click on empty space . Did you tested the second one ? In the second method when you check the "Display item in location context menu" you can click on empty space. – Ali Razmdideh Jun 6 '17 at 16:54
  • @lewis4u Please try "nautilus-action" way. – Ali Razmdideh Jun 6 '17 at 17:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.