Nautilus actions, right click execute script: Difference between revisions
From WickyWiki
m 5 revisions |
No edit summary |
||
| Line 1: | Line 1: | ||
[[Category:Ubuntu]] | [[Category:Ubuntu]] | ||
[[Category:Ubuntu Gnome]] | [[Category:Ubuntu Gnome]] | ||
[[Category: | [[Category:201809]] | ||
Add 'Scripts' option to Nautilus. After adding this script you can right-click, go to 'Scripts' and then 'exec'. | |||
You can then disable the Nautilus script-dialog for executable files and pick your text editor as the default application. This dialog is especially annoying for NTFS drives where every text file is considered executable. | |||
= Configure = | |||
Create the 'Scripts' directory, sub-folders are also possible and will appear as sub-menu-items: | |||
<syntaxhighlight lang=bash> | |||
mkdir -p ~/.local/share/nautilus/scripts/ | |||
</syntaxhighlight> | |||
Create the script file, the filename is what will be used in the right-click menu. The script will run in a separate terminal window. It will also work for multiple scripts, one at the time, after each other: | |||
<syntaxhighlight lang=bash> | |||
< | gedit ~/.local/share/nautilus/scripts/exec | ||
</syntaxhighlight> | |||
</ | |||
< | <syntaxhighlight lang=bash> | ||
#!/bin/bash | |||
</ | while read -r fn; do | ||
if [ -n "${fn}" ]; then | |||
gnome-terminal -e "${fn}" | |||
fi | |||
done <<< "${NAUTILUS_SCRIPT_SELECTED_FILE_PATHS}" | |||
</syntaxhighlight> | |||
Make the script-file executable: | |||
<syntaxhighlight lang=bash> | |||
chmod +x ~/.local/share/nautilus/scripts/exec | |||
</syntaxhighlight> | |||
= See also = | |||
* https://fedoramagazine.org/integrating-scripts-nautilus/ | |||
Latest revision as of 09:33, 28 September 2018
Add 'Scripts' option to Nautilus. After adding this script you can right-click, go to 'Scripts' and then 'exec'.
You can then disable the Nautilus script-dialog for executable files and pick your text editor as the default application. This dialog is especially annoying for NTFS drives where every text file is considered executable.
Configure
Create the 'Scripts' directory, sub-folders are also possible and will appear as sub-menu-items:
mkdir -p ~/.local/share/nautilus/scripts/
Create the script file, the filename is what will be used in the right-click menu. The script will run in a separate terminal window. It will also work for multiple scripts, one at the time, after each other:
gedit ~/.local/share/nautilus/scripts/exec
#!/bin/bash
while read -r fn; do
if [ -n "${fn}" ]; then
gnome-terminal -e "${fn}"
fi
done <<< "${NAUTILUS_SCRIPT_SELECTED_FILE_PATHS}"
Make the script-file executable:
chmod +x ~/.local/share/nautilus/scripts/exec