top of page

Nautilus right click scripts.

Nautilus is the default file manager of Gnome graphics user interface. After Gnome 3.0 release it's new name is “Files” but all remember is as “nautilus”.  It started in lately 90's and it's one of the best file managers out there with KDE's Dolphin and XFCE's Thunar also close.

 

But let's start this tutorial.

 

Sometimes is very boring to open whole applications or to run scripts just to do simple thinks with files. We will take as example out InstallerCreator and Convert2Mp3.

 

InstallerCreator takes as an input a executive file and install it to your Linux. Without the nautilus script you need to open the GUI app, navigate to the folders, find the executive file and select it.

(Fild more about InstallerCreator here)

 

Same problem in Convert2Mp3 when you need to find the .mp4 from you files to convert to .mp3.

 

Writing nautilus script with the basic application you will be able to create easiest script for the users. Now you can select the file you want to take part in your application just with the right click! How cool is that?

 

But how this works?

 

The first think you need to know is that the scripts that you can see in the right click “Scripts” category in nautilus placed in the folder

~/.local/share/nautilus/scripts.

 

So, you need to place your nautilus compatible scripts there. You copy (cp) the scripts from the app folder to there in the installation procedure asking users if they want it (see InstallerCreator) or without ask them, because you know theiw own good (see Convert2Mp3) :P . You don't need to be superuser to copy it this folder.

 

Sweat! The key point it's how to use filename in the script in this way. The answers is simple. It's in the variable 1. So, to use the filename ins the script you need to use

$1.

$1 saves only the filename, not the path.

 

 

Example please.

 

Okay. Let's create a nautilus script named “Test” that print us the name of the selected file in the notification area using notify-send (test is before).

The scripts placed of course at .local/share/nautilus/scripts and its code is just one line.

 

 

 

 

We make it executable giving

chmod +x Test.

You can find this now in nautilus as you can see! As you can see in the notification area of our gnome there is the name of the file that we selected!

 

 

It's all in $1.

 

That was the tutorial for today. Hope you like it. If you wonder who is this girl in the picture, it's Phoebe Tonkin <3

 

 

 

 

She's pretty, isn't she?

 

 

 

© 2023 by Conferences Website. Proudly created with Wix.com

  • Facebook Classic
  • Google+ App Icon
  • Twitter Classic
bottom of page