debiman wrote:i think op hopes that nautilus scripts can be made "compatible" with thunar in some magical way, or "imported into thunar".
i don't know what syntax they use (i think i remember that they are NOT shell scripts), i don't know what syntax thunar uses, but that is what you have to look at first. maybe show us an example script.
Yes, Nautilus scripts are shell scripts
and like I said above I was able to use them successfully inserting this in the command field like v&n sugested me:
/bin/bash /path_to_script/my_script %F
Like you asked, here are some examples of scripts I use:
copy file and rename the new file using it's new timestamp:
#!/bin/sh
TS=$( date +%Y%m%d_%H%M%S )
for i in "$@"; do cp "$i" "$TS.${i##*.}"; done
chmod to 777:
#!/bin/bash
chmod 777 -R "$@"
copy folder and rename the new folder using it's new timestamp:
#!/bin/sh
TS=$( date +%Y%m%d_%H%M%S )
cp -r "$@" $TS
create folder with the same name of the selected file and move the file inside the folder
#!/bin/sh
set -e
for file do
case "$file" in
*/*) TMPDIR="${file%/*}"; file="${file##*/}";;
*) TMPDIR=".";;
esac
temp="$(mktemp -d)"
mv -- "$file" "$temp"
#this line removes the file extension
mv -- "$temp" "$TMPDIR/${file%.*}"
#if I want to keep the file extension, use this line instead
#mv -- "$temp" "$TMPDIR/$file"
done
print all files inside folder:
#!/bin/sh
for FILE in ./*.pdf ; do lpr "$FILE" ; done
print all files inside folder, but only the first page of each file:
#!/bin/sh
for FILE in ./*.pdf ; do lp -o page-ranges=1 "$FILE" ; done
print only selected files:
#!/bin/sh
lpr "$@"
print only selected files, but only the first page of each file:
#!/bin/sh
lpr -o page-ranges=1 "$@"
move the selected file to a predefined folder, but before that, opens a small window so the user can write the new file name, and appends a timestamp prefix:
#!/bin/bash
newname=$(zenity --entry --text "new name?")
TS1=$( date +%Y%m%d )
TS2=$( date +%H%M%S )
if [ -d /home/user1/temp/temp_PDF ]; then
mv $@ /home/user1/temp/temp_PDF/$TS1" "$TS2" "FRU\ BPI" ""$newname".pdf
nautilus /home/user1/temp/temp_PDF
fi
if [ ! -d /home/user1/temp/temp_PDF ]; then
mkdir /home/user1/temp/temp_PDF
mv $@ /home/user1/temp/temp_PDF/$TS1" "$TS2" "FRU\ BPI" ""$newname".pdf
nautilus /home/user1/temp/temp_PDF
fi
or just one line commands like:
create a folder named with the current timestamp:
mkdir $(date '+%Y%m%d_%H%M%S')
open terminal:
xfce4-terminal
take a screenshot and save it to desktop named with the timestamp:
scrot -s ~/Desktop/'%Y%m%d_%H%M%S.png'
redefine the date and time of photos:
exiftool -AllDates='2015:05:25 22:38:55' -overwrite_original 5.jpeg
change a virtualbox virtual machine uuid:
VBoxManage internalcommands sethduuid $@ 12345678-1234-1234-1234-$(date '+13%m%d%H%M%S')