Based on a suggestion, I've now got the following call in rc.lua:
awful.util.spawn_with_shell('vlc $(xclip -o)')
How do I ensure that the output of xclip
is escaped so that space characters are not taken as parameter separators? For example, if I select the string "foo bar" (without the quotes) and press Mod4+v VLC complains about being unable to open both "foo" and "bar".
To illustrate, in a shell context I would validate the issue as follows:
$ params() {
for param
do
echo "$param"
done
}
$ params $(xclip -o)
params
$(xclip
-o)
And fix it like this:
$ params "$(xclip -o)"
params "$(xclip -o)"
However, if I change the Lua call to this, it does nothing:
awful.util.spawn_with_shell('vlc "$(xclip -o)"')
xclip
output throughsed
and escape the “unsafe” letters manually or write a small python script and use one of the shell escaping libraries. – Marco Mar 16 '13 at 17:09