tInitial commit. - plumber - simple plumber tool
HTML git clone https://git.parazyd.org/plumber
DIR Log
DIR Files
DIR Refs
---
DIR commit 441dba74c01bfbfcccbdac039a7e178311e97200
HTML Author: parazyd <parazyd@dyne.org>
Date: Thu, 7 Feb 2019 22:31:28 +0100
Initial commit.
Diffstat:
A Makefile | 15 +++++++++++++++
A p | 46 +++++++++++++++++++++++++++++++
2 files changed, 61 insertions(+), 0 deletions(-)
---
DIR diff --git a/Makefile b/Makefile
t@@ -0,0 +1,15 @@
+.POSIX:
+
+PREFIX = /usr/local
+
+BIN = p
+
+all:
+ @echo Run "make install" to install to $(DESTDIR)$(PREFIX)
+
+install:
+ cp -f $(BIN) $(DESTDIR)$(PREFIX)/bin
+ chmod 755 $(DESTDIR)$(PREFIX)/bin/$(BIN)
+
+uninstall:
+ rm -f $(DESTDIR)$(PREFIX)/bin/$(BIN)
DIR diff --git a/p b/p
t@@ -0,0 +1,46 @@
+#!/bin/sh
+#
+# Copy me if you can.
+# By parazyd
+#
+
+clip="$(xclip -o)"
+
+[ -n "$clip" ] || {
+ echo "plubmer: Nothing to plumb." >&2
+ exit 1
+}
+
+termcmd="st -e"
+
+case "$clip" in
+
+ gopher://*/I/*)
+ curl "$clip" | feh -
+ ;;
+
+ gopher://*)
+ $termcmd sacc "$clip"
+ ;;
+
+ https://www.youtube.com/*|ytdl://)
+ mpv "$clip"
+ ;;
+
+ *.jpg|*.png|*.JPG|*.JPEG|*.PNG)
+ feh "$clip"
+ ;;
+
+ *.mp4|*.webm)
+ mpv "$clip"
+ ;;
+
+ *.gif|*.GIF)
+ mpv --loop "$clip"
+ ;;
+
+ *)
+ printf "plumber: no plumber for %s\n" "$clip" >&2
+ exit 1
+ ;;
+esac