Nautilus: Open current folder in VS Code through a keyboard shortcut

In ~/.local/share/nautilus/scripts/my_first_script.sh, write a script that uses the variables demonstrated here for your own actions. Note that the variable is a space separated list, and URIs of local files will start with file:///. Also don’t forget to set it to executable.

#!/bin/bash
echo Selected File Paths: $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS
echo Selected File URIs: $NAUTILUS_SCRIPT_SELECTED_URIS
echo Current location URI: $NAUTILUS_SCRIPT_CURRENT_URI

In ~/.config/nautilus/scripts-accels, add a shortcut and the script name associated with it:

<control>y my_first_script.sh

See Gtk.accelerator_parse and Gtk.ShortcutTrigger.parse_string for more info on how to format the shortcut.

1 Like