You are not logged in.

#1 2017-05-13 02:59:46

Steve
Member
Registered: 2017-01-03
Posts: 642

File Manager Custom Actions

I couldnt find a thread on this and thought it would be a bit of fun to add to Bunselabs forum.

Concentrating on thunar as it is the BL's FM.

I found some good ones here: http://vsido.org/index.php?topic=838.0 (also contains instructions on adding custom actions in thunar).

This one is a good one =  Create backup file in same folder

cp --backup=t %f %f.backup

What custom actions do you use that are non standard if any?

I would like to add "encrypt via GPG" and "decrypt via GPG" but not sure how to go about this? still researching though.

Offline

#2 2017-05-13 04:10:41

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,028

Re: File Manager Custom Actions

I use the Canadian English spell checker and a Spanish spell checker so the first two are:

Nano-En

terminator --geometry=900x950+30+20 -b -x nano %f

File Pattern: *
[+] Text Files

Nano-Es

terminator --geometry=900x950+30+20 -b -x nano -s "aspell -l es check" %f

File Pattern: *
[+] Text Files

to continue...

Check md5sum

yad --info --title="Check md5 for %n" --text="$(md5sum %f)"

File Pattern: *.iso;*.img;*.sub
[+] Other Files

Check sha256sum

yad --info --title="Check sha256 sum for %n" --text="$(sha256sum %f)"

File Pattern: *.iso;*.img;*.sub
[+] Other Files

Check sha512sum

yad --info --title="Check sha512 sum for %n" --text="$(sha512sum %f)"

File Pattern: *.iso;*.img;*.sub
[+] Other Files

MPV

mpv %f --no-border --geometry=60:60

File Pattern: *
[+] Audio Files [+] Video Files


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#3 2017-05-13 09:22:12

Steve
Member
Registered: 2017-01-03
Posts: 642

Re: File Manager Custom Actions

Thanks Sector11, added that mpv one to mine. Is the geometry able to be scaled down? I tried 40:40 and made no difference for me.

Offline

#4 2017-05-13 13:31:40

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,028

Re: File Manager Custom Actions

If by "scaled down" you mean size I didn't use the size, just the position part of geometry

--geometry=300x100 60:60

mpv window is 300 pixels wide, 100 pixels high and 60 pixels from the left and 60 pixels from the top.

--geometry=<[W[xH]][+-x+-y]>, --geometry=<x:y>

Adjust the initial window position or size. W and H set the window size in pixels.  x and y set the window position, measured in pixels from the top-left corner of the screen to the top-left corner of the image being displayed.  If a percentage sign (%) is given after the argument, it turns the value into a percentage of the screen size in that direction.  Positions are specified similar to the standard X11 --geometry option format, in which e.g. +10-50 means "place 10 pixels from the left border and 50 pixels from the lower border" and "--20+-10" means "place 20 pixels beyond the right and 10 pixels beyond the top border".

Notice I'm using 60:60  that's x & y settings not W & H as described in the man page.  I let the video set the size and or simply tap [f] for full screen


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#5 2017-05-13 13:42:51

Steve
Member
Registered: 2017-01-03
Posts: 642

Re: File Manager Custom Actions

Oh i see, so just orientation geometry? Good idea as sometimes when i load a video in VLC it will go out of bounds, using mpv and those commands keeps the screen in bounds and as you say from there you can press F for full screen. I was thinking that geometry setting was able to scale up and down.

Offline

#6 2017-05-13 15:08:29

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,028

Re: File Manager Custom Actions

Well, that's all I'm using, just the position part.  smile

I have a couple of others but they are simple and quite possibly defaults:

Open Terminal Here

sh -c 'cd %f;terminator -b --geometry=1000x900+75+75'

Appearance Conditions
File Pattern: *
[+] Directories

Open root Terminal Here

sh -c 'cd %f;gksu terminator''

Appearance Conditions
File Pattern: *
[+] Directories
This one doesn't seem to like any other options for terminator.  smile

Open Txt as Root

gksu "medit %f"

Appearance Conditions
File Pattern: *
[+] Text Files
[+] Other Files

There is also this:  Thunar Custom Actions


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#7 2017-05-13 15:30:25

Steve
Member
Registered: 2017-01-03
Posts: 642

Re: File Manager Custom Actions

Thanks sector11

I think i have figured out how to add the custom action to use GPG encrypt, just a simple setting but is working and brings up the terminal to complete command but cant figure out the decrypt command of the same value.

Encrypt

terminator -e gpg -c %f

Decrypt (not working), terminal not appearing for completion.

terminator -e gpg -d %f

Offline

#8 2017-05-13 17:22:04

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,028

Re: File Manager Custom Actions

I don't do encryption but I've been looking ... do any of these help you:

They all require: gpg

-------------------------------
Sign Using GnuPG

Command:

terminal -e "gpg -a -u [user] -b %f"

Description: Signs a file with the user's GPG key.

-------------------------------
Encrypt Using GnuPG

Command:

terminal -e "gpg -e -r [recipient] %f"

Description: Encrypts a file using GPG.

-------------------------------
Decrypt GnuPG File

Command:

terminal -e "gpg -o %n.decrypted -d %f"

Description: Decrypts GnuPG file, appending ".decrypted" to the decrypted filename.


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#9 2017-05-14 04:41:35

Steve
Member
Registered: 2017-01-03
Posts: 642

Re: File Manager Custom Actions

Thanks Sector11, unfortunatly the decrypt one you posted did not work for me, havent tried those others yet.

I got decrypt to work using this script here: https://github.com/cytopia/thunar-custo … decrypt.sh

So the command to enter goes like this

terminator -e ~/bin/thunar-gpg-decrypt.sh -f %f

But it seems to just extract the file into the folder, i would like to just read the text file in the terminal rather than extracting or writing the file to the folder.

Offline

#10 2017-05-14 12:23:29

Steve
Member
Registered: 2017-01-03
Posts: 642

Re: File Manager Custom Actions

Thanks misko but does the same. Just creates a decrypted text file in the same folder im working in. I think this must have something to do with output commands in the script im using, dont fully understand it but im learning as i go.

I get this:

gpg: CAST5 encrypted data
gpg: encrypted with 1 passphrase
gpg: WARNING: message was not integrity protected
sc@debian:~/Documents$ 

Whereas i thought i would try this:

terminator -e ~/bin/thunar-gpg-decrypt.sh -f %f; bash

and recieved this output:

gpg: CAST5 encrypted data
gpg: encrypted with 1 passphrase
File `/home/sc/Documents/Linux Info.backup' exists. Overwrite? (y/N) 
Enter new filename: 

Last edited by Steve (2017-05-14 12:23:59)

Offline

#11 2017-05-15 08:09:41

Steve
Member
Registered: 2017-01-03
Posts: 642

Re: File Manager Custom Actions

Thanks misko.

Offline

#12 2017-07-25 13:26:36

devnull
Member
Registered: 2017-06-29
Posts: 69

Re: File Manager Custom Actions

This is one I use quite often

# Uploads the image to imgur and opens a yad dialog with the link

img=$(curl -vH "Authorization: Client-ID 3e7a4deb7ac67da" -F image=@%f https://api.imgur.com/3/upload.xml | grep -Eo '<[a-z_]+>http[^<]+'|sed 's/^<.\|_./\U&/g;s/_/ /;s/<.*>//' | sed  's/^.*imgur\.com\//http:\/\/imgur.com\//g;s/\.[^.]*$//') && yad --entry --text "your imgur link" --entry-text "$img"

Last edited by devnull (2017-07-26 07:52:33)

Offline

#13 2017-07-25 13:54:44

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,028

Re: File Manager Custom Actions

AWESOME.  I didn't know you could do something like that
Gotta see if I can convert that to use www.scrot.moe.

Our very own mrneilypop is hosting scrot.moe for BunsenLabs  big_smile

Would there be a way to use a template type file with two line or two fields for

username password

or

username
password

So one could share that without the 'vitals' ?

Like this for my email:

conkyEmail -t /media/5/Conky/email/S

where S is:

[--servername=somethinghere --servertype=somethinghere --port=somethinghere --username=somethinghere --password=somethinghere]

Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#14 2017-07-25 14:48:36

devnull
Member
Registered: 2017-06-29
Posts: 69

Re: File Manager Custom Actions

I don't know how the api works for scrot.moe, I'm not sure that a simple curl would do. If you know more I can try to write the script.

Sorry, I didn't understand your question, you want to create a custom action that uploads to scrot.moe but asks for password and username?


EDIT:

# wipes a file, asking for a confirmation before. Needs wipe installed. I did yad a bit more eye-candy for you all smile

yad --center --on-top --image=dialog-question --question --text "\tAre you sure you want to wipe %F?" && wipe -rf %F

Last edited by devnull (2017-07-25 15:05:11)

Offline

#15 2017-07-25 15:51:20

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,028

Re: File Manager Custom Actions

^ It does if you want to create an account and have "Albums"  If not there is no need.
2017-07-25_124144_Scrot11.th.jpg
I'll check with mrneilypop see what he thinks.  smile


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

#16 2017-07-25 19:00:42

damo
....moderator....
Registered: 2015-08-20
Posts: 6,734

Re: File Manager Custom Actions

devnull wrote:

This is one I use quite often

# Uploads the image to imgur and opens a yad dialog with the link

img=`curl -vH "Authorization: Client-ID 3e7a4deb7ac67da" -F image=@%f https://api.imgur.com/3/upload.xml | grep -Eo '<[a-z_]+>http[^<]+'|sed 's/^<.\|_./\U&/g;s/_/ /;s/<.*>//' | sed  's/^.*imgur\.com\//http:\/\/imgur.com\//g;s/\.[^.]*$//'` && yad --entry --text "your imgur link" --entry-text "$img"

Backticks can be bad news in bash. Better to use "$(......)"


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#17 2017-07-25 19:07:15

damo
....moderator....
Registered: 2015-08-20
Posts: 6,734

Re: File Manager Custom Actions

^ @Sector11

The basic construction for curl is

URL="your/url/here"
PASSWD="yourpassword"

curl -s -u "$PWORD" "$URL" ....

So if you use another file to keep $URL and $PASSWD, then read them into the variables from that file;
or have "URL= ..." and "PASSWD=..." in another file, source it in the script, and use them directly.


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#18 2017-07-26 03:57:01

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 12,654
Website

Re: File Manager Custom Actions

devnull wrote:

This is one I use quite often

# Uploads the image to imgur and opens a yad dialog with the link

img=`curl -vH "Authorization: Client-ID 3e7a4deb7ac67da" -F image=@%f https://api.imgur.com/3/upload.xml | grep -Eo '<[a-z_]+>http[^<]+'|sed 's/^<.\|_./\U&/g;s/_/ /;s/<.*>//' | sed  's/^.*imgur\.com\//http:\/\/imgur.com\//g;s/\.[^.]*$//'` && yad --entry --text "your imgur link" --entry-text "$img"

Thanks! I'd been thinking about switching to imgur since postimage.org stopped supporting their old api. I wanted BB code ready to paste into a forum post with a thumbnail, so I modified your code a bit. The links go straight to the image file, not the imgur page.
(@codehounds I was obliged to use an echo | sed pipe because the shell Thunar provides doesn't seem to support parameter substitutions or herestrings.)

img=$(curl -sH "Authorization: Client-ID 3e7a4deb7ac67da" -F image=@%f https://api.imgur.com/3/upload.xml | sed -rn "s/^.*<link>([^<]+).*$/\1/p"); tmb=$(echo "$img" | sed -r 's/(\.[^\.]+$)/t\1/' ); yad --entry --text " Imgur BB code:" --entry-text "[url=$img][img]$tmb[/img][/url]" --button "OK"

BTW I don't know whose ID that authorization string belongs to, but I hope his account doesn't get banned from overuse! If that happens, I guess we have to get our own from imgur.


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )

Introduction to the Bunsenlabs Boron Desktop

Offline

#19 2017-07-26 07:56:02

devnull
Member
Registered: 2017-06-29
Posts: 69

Re: File Manager Custom Actions

^^^
Awesome job, it actually looks better, direct links are more useful. Thanks for sharing it

damo wrote:

Backticks can be bad news in bash. Better to use "$(......)"

Thank you for pointing that out, I edited my message

Offline

Board footer

Powered by FluxBB