Xfce Forum

Sub domains
 

You are not logged in.

#1 2019-10-14 19:06:17

johnywhy
Member
Registered: 2011-10-09
Posts: 283

How to Expand String Function in Launcher Command?

run at command line, this works.

xfce4-screenshooter -f -s "/mnt/Docs/Pictures/Screenshots/shot-$(date +%Y%m%d%H%M).png" -d 10

I get an output file like:
shot-201910141202.png

Trying to run from a launcher, the date isn't expanding. I get:
shot-$(date +).png

I tried preceding with exec, preceding each quote with escape \, and wrapping the whole thing in single-quotes. Nothing works-- date won't expand.

How to execute this from a launcher?


arch xfce x86_64

Offline

#2 2019-10-14 20:48:59

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,000

Re: How to Expand String Function in Launcher Command?

The launcher command interpreter is pretty basic and can't handle special characters well. It is best to put commands like these in a shell script and execute that shell script from the launcher.


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#3 2019-10-14 20:52:03

johnywhy
Member
Registered: 2011-10-09
Posts: 283

Re: How to Expand String Function in Launcher Command?

any workaround, besides a script?

thx


arch xfce x86_64

Offline

#4 2019-10-15 13:05:58

Misko_2083
Member
Registered: 2015-10-13
Posts: 191
Website

Re: How to Expand String Function in Launcher Command?

Run it with the shell

sh -c 'command here'


Do you want to exit the Circus?
https://www.youtube.com/watch?v=ZJwQicZHp_c

Offline

#5 2019-10-15 18:09:04

johnywhy
Member
Registered: 2011-10-09
Posts: 283

Re: How to Expand String Function in Launcher Command?

Thx @Misko_2083, but didn't seem to work. I got
shot-.png

so the whole date portion was removed. I didn't get the codes or the expansion. Here's what i put into the launcher:

sh -c 'xfce4-screenshooter -f -s "/mnt/Docs/Pictures/Screenshots/shot-$(date +%Y%m%d%H%M).png" -d 10'

arch xfce x86_64

Offline

#6 2019-10-16 12:03:02

Misko_2083
Member
Registered: 2015-10-13
Posts: 191
Website

Re: How to Expand String Function in Launcher Command?

Maybe scrot is better.
install scrot and try:

sh -c "scrot 'shot-%Y%m%d%H%M.png' -e 'mv $f /mnt/Docs/Pictures/Screenshots/' -d 10"

After making the screenshot it will be moved to /mnt/Docs/Pictures/Screenshots/.


Do you want to exit the Circus?
https://www.youtube.com/watch?v=ZJwQicZHp_c

Offline

Board footer

Powered by FluxBB