Skip to content

Instantly share code, notes, and snippets.

@dreua
Last active February 23, 2024 23:23
Show Gist options
  • Save dreua/2e399ffcfb42c4b6932de73a5ad5f268 to your computer and use it in GitHub Desktop.
Save dreua/2e399ffcfb42c4b6932de73a5ad5f268 to your computer and use it in GitHub Desktop.
Simple instructions for adding a shortcut to nautilus which opens a terminal at the current location

I copied this from "RobotMan" on http://askubuntu.com/a/696901

I added a new feature to Nautilus with the precious help of the maintainers.

This new feature allow you to map custom keyboard shortcuts to launch the scripts in the scripts folder ( ~/.local/share/nautilus/scripts ).

So, when you add an executable in that folder it will appear in the right-click context menu, but now if you create a special configuration file ( ~/.config/nautilus/scripts-accels ) you can assign a shortcut to it.

For example make a script called Terminal with the following content:

#! /bin/sh
gnome-terminal

Now create (or edit) the ~/.config/nautilus/scripts-accels file adding the following line:

F4 Terminal

Restart Nautilus and when you'll press F4 key you'll open a new terminal window in the current directory.

Note: if you select one or more files, their names will be passed as parameters to the executable. Your script can also have access to many information through environment variables.

Link of the commit: https://git.gnome.org/browse/nautilus/commit/?id=9fe1335

There is also a gui to manage these shortcuts: https://github.com/echo-devim/nautilusaccelsmanager

@cfgnunes
Copy link

cfgnunes commented Jun 20, 2023

Thanks, @dreua!!! I did not know about this feature!!!

Now, I can access my scripts (https://github.com/cfgnunes/nautilus-scripts) using the keyboard! 😊

Moreover, I will configure to open the VSCode in the current directory more easily!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment