Good evening,
unless you are using only terminals with dwm, you sooner or later get
in touch with xdg-open. It's a tool which manages your default
applications by assigning applications to mime-types.
My colleague and I thought that it would be awesome to press a
youtube-link in Skype to have it directly played back in youtube-viewer
or a link to a gif, automatically downloaded and opened in gifview.
Given xdg-open doesn't allow this flexibility, I wrote a C-program
which does just that and can fall back to xdg-open.
The functionality is simple and builds on the proven
config.h-principle, allowing to check incoming requests with regexes
and executing commands respectively.
A configuration can look like this:
{ "\.mp3", "st -e mplayer %s" },
{ "\.(jpg|png|tiff)$", "feh %s" },
{ "\.gif", "wget -O /tmp/tmp.gif %s && gifview -a /tmp/tmp.gif" },
{ "^(
http://|https://)?(www\.)?(youtube.com/watch\?|youtu\.be/)", "youtube-viewer %s" }
where %s is the _shell-escaped_ argument given to xdg-open.
Also included is a fully-functional Makefile, which manages a backup of
xdg-open in /usr/bin/xdg-open_.
Thus you can easily test it out via make install and go back with make
uninstall.
You can find the full source-code in the git-repository[0], published
under the MIT/X Consortium License.
Please let me know what you think!
Cheers
FRIGN
[0]:
https://github.com/FRIGN/soap
--
FRIGN <dev_AT_frign.de>
Received on Sat May 03 2014 - 17:18:59 CEST