Multiple commands in a pcmanfm-qt custom action?

538 views Asked by At

SOLUTION AND THE COMPLETE EXEC LINE

Exec=sh -c 'sed -i "1s:.*:<body background=%f>:" /home/burak/Not/Shortcuts.mkd && pandoc -f markdown /home/burak/Not/Shortcuts.mkd --css /home/burak/Public/CSS/pandoc2.css -s -S -w html -o /home/burak/Not/Shortcuts.html && phantomjs /home/burak/bin/shortcuts.js file:///home/burak/Not/Shortcuts.html /home/burak/Not/shortcuts.jpg 1920px*1080px && feh --bg-fill /home/burak/Not/shortcuts.jpg'

This is likely relevant to other file managers using the same (DES-EMA) scheme.

I've got four commands all working individually, yet I stuck just at adding the second command to the Exec line of the custom action. If I overcome this, the other two remaining commands can be added accordingly (or by piping) I suppose.

Here are my commands and infos about what they're meant to do (the %f, obviously, to be expanded to the file clicked on in the file manager):

sed -i "1s:.*:<body background=%f>:" /home/burak/Not/Shortcuts.mkd

The above command replaces the first line of that markdown file which changes the background image of html file to be produced by pandoc with the following second command:

pandoc -f markdown /home/burak/Not/Shortcuts.mkd --css /home/burak/Public/CSS/pandoc2.css -s -S -w html -o /home/burak/Not/Shortcuts.html

The below third command converts that Shortcuts.html to shortcuts.jpg

phantomjs shortcuts.js file:///home/burak/Not/Shortcuts.html shortcuts.jpg 1920px*1080px

And finally the below fourth command sets the above shortcuts.jpg image as the desktop wallpaper (with all the shortcuts, bash aliases and some other commands embedded into the desktop).

feh --bg-fill %f

So at the end I would easly change wallpaper and embed my keyboard shortcuts and aliases etc. into every new wallpaper like so:

wallpaper with shortcuts embeded

Now, as said previously, I've stuck at the begining, that is, can't add the second command to the first. I've tried this without success:

Exec=sed -i "1s:.*:<body background=%f>:" /home/burak/Not/Shortcuts.mkd && pandoc -f markdown /home/burak/Not/Shortcuts.mkd --css /home/burak/Public/CSS/pandoc2.css -s -S -w html -o /home/burak/Not/Shortcuts.html

And neither this has worked:

Exec=sh -c "sed -i "1s:.*:<body background=%f>:" /home/burak/Not/Shortcuts.mkd && pandoc -f markdown /home/burak/Not/Shortcuts.mkd --css /home/burak/Public/CSS/pandoc2.css -s -S -w html -o /home/burak/Not/Shortcuts.html"

And piping (|) those two commands works in terminal, but not in custom action desktop file.

What should I do (on Arch Linux with Fluxbox if that matters)?

1

There are 1 answers

0
LyXTeX On

Damn!.. Thought I've tried this before, but seemingly not in this way. Well, piping in this manner works:

Exec:sh -c 'sed "1s:.*:<body background=%f>:" < /home/burak/Not/Shortcuts.mkd | pandoc --css /home/burak/Public/CSS/pandoc2.css -s -S -w html -o /home/burak/Not/Shortcuts.html'