Add a right click context menu in Nautilus to add new documents for Linux desktop.

angela fbc7007cdd Explicit path referenced 6 months ago
img a8e28768cc initial commit 1 year ago
LICENSE a8e28768cc initial commit 1 year ago
README.md fbc7007cdd Explicit path referenced 6 months ago
Templates.tar.gz 5988e3135e Cleaner file type prefix 9 months ago
automate.sh 79ea9de1dc Concise filename change 9 months ago

README.md

Right-click New File Context Menu for Nautilus / Gnome File Manager

Super easy and light script to automate adding a context menu to Nautilus / Gnome Files to create a new document.

Built in GNOME Nautilus 3.22.3 (current version used in Debian Stable); not tested in other versions (see footer for Nautilus 3.26+).

Before:

nautilus right click context menu - before

After:

nautilus new file context menu - after

Default Menu Options

  • Bash Script
  • PHP Script
  • Text File
  • Libre Office Word Document

Any menu item ins interchangable and can be removed.

Download the automation script

Run via terminal:

git clone https://github.com/angela-d/nautilus-right-click-new-file.git && cd nautilus-right-click-new-file

Confirm you're in the right directory:

ls

You should see:

img  LICENSE  automate.sh  README.md  Templates.tar.gz

Now, run the script:

./automate.sh

That's all there is to it!


(optional) Manual Instructions

(if you don't want to run the automated script)

  • Download Templates.tar.gz and extract bash tar -xvzf Templates.tar.gz
  • Move the extracted files (templates) into /home/youruser/Templates/

(in Nautilus; Open File Manager -> Click Home on the left -> If Templates folder does not exist, create it)

  • If your changes to do not automatically appear, log out or run: bash xdg-user-dirs-update to generate the user-dirs config file.

Done!

Note

Each of the template files have a prefix like #!/bin/bash or <?php when you open the file (except the Text file & Writer/Word .doc) - while standard for the script type in question, it is also used so the operating system could interpret the type of file and automatically create the context menu icon without any extra code.


(optional) Customize your Context Menu

In Nautilus, navigate to the Home directory and then Templates.

In the Templates directory, you can place your dummy files (templates) in folders for easy sorting, or add new ones.

If your changes are not instantaneous, restart Nautilus:

nautilus -q && nautilus &

In some instances, you may have to log out and log back in.

(optional) Prevent Nautilus from breaking desktop icons

In 3.26, Nautilus will be breaking desktop icons.

To prevent this from occurring, prevent Nautilus from updating (if you've already updated, you'll have to downgrade the pacakge in order for the hold to be effective).

In Debian / Ubuntu (and deriatives):

apt-mark hold nautilus

Note: This will prevent the Nautilus package from updating, you will not receive future bug or security fixes until you undo the hold.

Ubuntu users: Ubuntu 18.04 LTS will be sticking with an older version of Nautilus due to the desktop icons being taken out.