Added externalpipe and plumber scripts

This commit is contained in:
Ashish Kumar Yadav 2021-08-12 19:14:21 +05:30
parent 27802337dd
commit 450b4f1638
3 changed files with 12 additions and 0 deletions

View file

@ -24,6 +24,8 @@ build() {
package() {
cd "$srcdir/$_pkgname"
make PREFIX=/usr DESTDIR="$pkgdir" install
install -m644 -D st-pager "$pkgdir/usr/bin/st-pager"
install -m644 -D st-plumber "$pkgdir/usr/bin/st-plumber"
install -m644 -D LICENSE "$pkgdir/usr/share/doc/$_pkgname/LICENSE"
install -m644 -D README "$pkgdir/usr/share/doc/$_pkgname/README"
install -m644 -D "$srcdir/$_pkgname.desktop" "$pkgdir/usr/share/applications/$_pkgname.desktop"

4
st/st-pager Executable file
View file

@ -0,0 +1,4 @@
#!/bin/sh
tmpfile="$(mktemp /tmp/st-XXXXXX)"
cat >"$tmpfile"
exec st -e sh -c "nvim -c 'normal G' -R '$tmpfile'; rm -f '$tmpfile'"

6
st/st-plumber Executable file
View file

@ -0,0 +1,6 @@
#!/bin/sh
# requires https://metacpan.org/pod/Regexp::Common::URI
[ -f "$1" ] && { setsid -f xdg-open "$1"; exit ;}
url="$(echo "$1" | perl -M'Regexp::Common=URI' -ne 'if (/($RE{URI})/) {print $1; exit}')"
[ -n "$url" ] && { setsid -f "${BROWSER:-xdg-open}" "$url"; exit ;}
notify-send -t 2000 -u critical st-plumber "Selection is not a valid file or url!"