Nautilus scripts in Thunar right-click menu?

Here you can discuss every aspect of Debian. Note: not for support requests!

Nautilus scripts in Thunar right-click menu?

Postby efrpcabo » 2016-09-04 09:07

Is it possible to insert an entry to Nautilus scripts in Thunar right-click menu?

I know that Thunar has it's custom actions, but I've got dozens of Nautilus scritps and I really want to achieve this.
efrpcabo
 
Posts: 31
Joined: 2013-08-08 06:36

Re: Nautilus scripts in Thunar right-click menu?

Postby v&n » 2016-09-04 16:30

efrpcabo wrote:I know that Thunar has it's custom actions..

As you're already aware of that, I hope you also know the usual /bin/bash <your_script> %F method.
May be you also know that these custom actions are stored as an xml file : <your home directory>/.config/Thunar/uca.xml

So, just to clarify your question -
  • Do you want ONE simple entry in right-click menu that opens a sub-menu listing all of your *Nautilus* scripts?
  • Are you using Nautilus along with Thunar?
  • What is your DE (I'm assuming xfce4)?

I have a few more questions but don't know how to ask them in short, without confusing the question even more. I think you should elaborate your question stating what exactly is your current situation and what exactly you want to do. And also - why you want to avoid the 'usual' method that Thunar provides.

I may not provide an alternative (quicker, easier) solution, but what *I think* you want to achieve looks interesting to me, so just joining in.
v&n
 
Posts: 595
Joined: 2015-02-04 02:57

Re: Nautilus scripts in Thunar right-click menu?

Postby debiman » 2016-09-04 22:09

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.
User avatar
debiman
 
Posts: 2814
Joined: 2013-03-12 07:18

Re: Nautilus scripts in Thunar right-click menu?

Postby efrpcabo » 2016-09-05 07:33

@v&n
thank you very much for pointing me in the right direction

v&n wrote:I hope you also know the usual /bin/bash <your_script> %F method.

No, I didn't
and that info alone made me able to use successfully all the nautilus scripts I've tested so far in thunar

v&n wrote:May be you also know that these custom actions are stored as an xml file : <your home directory>/.config/Thunar/uca.xml

Yes, I knew that

v&n wrote:Are you using Nautilus along with Thunar?

Yes, I am using both filemanagers

v&n wrote:What is your DE (I'm assuming xfce4)?

Yes, I'm using xfce4


v&n wrote:Do you want ONE simple entry in right-click menu that opens a sub-menu listing all of your *Nautilus* scripts?

Yes, that's exactly what I'd like to achieve
that would aloud the use of the same scripts in both filemanagers at the same time
but Thunar is the default filemanager in my system and with these sub-menu listing I would have no need for Nautilus

in fact, despite the fact I also like Nautilus, the only reason I'm using it is because of Nautilus scripts that make my life much easier
especially with it's automatic sub-menus that mimic the scripts' directory's hierarchy

Thunar's custom actions are great, but if you have many of scripts like I do, the sub-menu listing is really necessary to organize them properly
so, if you or someone else could help solve this, it would be extremely helpful not only for me but I guess also for many other users
efrpcabo
 
Posts: 31
Joined: 2013-08-08 06:36

Re: Nautilus scripts in Thunar right-click menu?

Postby efrpcabo » 2016-09-05 07:56

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')
efrpcabo
 
Posts: 31
Joined: 2013-08-08 06:36

Re: Nautilus scripts in Thunar right-click menu?

Postby v&n » 2016-09-05 08:15

efrpcabo wrote:
v&n wrote:I hope you also know the usual /bin/bash <your_script> %F method.

No, I didn't
and that info alone made me able to use successfully all the nautilus scripts I've tested so far in thunar

Glad I could be of at least some help.

Yes the sub-menu style would be great. Unfortunately I don't know if it is even possible in Thunar ritght-click menu, hence my curiosity. :)
v&n
 
Posts: 595
Joined: 2015-02-04 02:57

Re: Nautilus scripts in Thunar right-click menu?

Postby fsmithred » 2016-09-05 13:45

Make a custom action that runs a script for each category of scripts you want under the same heading. The script makes a zenity list of the scripts in its category and passes the arguments to the script that does the real work. That way, a few custom actions give you access to a large number of scripts.
fsmithred
 
Posts: 1866
Joined: 2008-01-02 14:52


Re: Nautilus scripts in Thunar right-click menu?

Postby debiman » 2016-09-06 06:44

efrpcabo wrote:Yes, Nautilus scripts are shell scripts

ok, well that makes things easy then.
User avatar
debiman
 
Posts: 2814
Joined: 2013-03-12 07:18

Re: Nautilus scripts in Thunar right-click menu?

Postby efrpcabo » 2016-09-06 09:48

fsmithred wrote:Make a custom action that runs a script for each category of scripts you want under the same heading. The script makes a zenity list of the scripts in its category and passes the arguments to the script that does the real work. That way, a few custom actions give you access to a large number of scripts.


Thank you, I've never thought of that.
I'm going to try that.
efrpcabo
 
Posts: 31
Joined: 2013-08-08 06:36


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

fashionable