salman-abedin / devour

X11 window swallower
GNU General Public License v2.0
415 stars 30 forks source link

Devour can handle files with spaces now #1

Closed Jack-O-Brian closed 4 years ago

Jack-O-Brian commented 4 years ago

While using this program, I realized devour cannot handle arguments with spaces that are usually handled. zathura "File Space.pdf" works in the command line, but devour zathura "File Space.pdf" does not, same with devour zathura File\ Space.pdf. You can combine the two, doing devour zathura "File\ Space.pdf", but that's a bit tedious. So using some google-fu I found a way to open files with a space.

sbuller commented 4 years ago

I ran into the same problem. I recommend a simpler approach:

- sh ...
+ "$@" >/dev/null 2>&1
salman-abedin commented 4 years ago

I ran into the same problem. I recommend a simpler approach:

- sh ...
+ "$@" >/dev/null 2>&1

This was not completely valid but it did give me the right idea to resolve the issue. Thanks man.

salman-abedin commented 4 years ago

While using this program, I realized devour cannot handle arguments with spaces that are usually handled. zathura "File Space.pdf" works in the command line, but devour zathura "File Space.pdf" does not, same with devour zathura File\ Space.pdf. You can combine the two, doing devour zathura "File\ Space.pdf", but that's a bit tedious. So using some google-fu I found a way to open files with a space.

While using this program, I realized devour cannot handle arguments with spaces that are usually handled. zathura "File Space.pdf" works in the command line, but devour zathura "File Space.pdf" does not, same with devour zathura File\ Space.pdf. You can combine the two, doing devour zathura "File\ Space.pdf", but that's a bit tedious. So using some google-fu I found a way to open files with a space.

I would have merged your request but I managed to solve the porblem in one line. Thanks for pointing out the issue though.

sbuller commented 4 years ago

My version was correct; the shell expands and executes the form properly. If you prefer to make it explicit, instead do something like this:

cmd="$1"; shift
"$cmd" "$@"

The $("$@") form re-evaluates the output of the command, you can see the error by running devour.sh echo notify-send error.

edits: I missed quotes in a couple places.

salman-abedin commented 4 years ago

When I said your one was not completely valid, I meant to say it didn't work. If it did, I would have preferred yours as it was even terser than mine and I am a sucker for terse code. But I will give it another shot to see if I can work it out or not.

salman-abedin commented 4 years ago

Appreciate the feedback guys. Added both of you as contributors.