shithub: rc

ref: 5a4afb116aebf9d351283566a84f0e54e358cc65
dir: /plumbing/

View raw version
# to update: cp $home/lib/plumbing /mnt/plumb/rules
# don't fucking append to the file

editor = jam
browser = mothra

# man index entries are synthesized
type is text
data matches '([a-zA-Z¡-￿0-9_\-./]+)\(([0-9])\)'
plumb	start	window -dy 800 man $2 $1 '; read'

# images
type	is text
data	matches '[a-zA-Z¡-￿0-9_\-.,/]+'
data	matches '([a-zA-Z¡-￿0-9_\-.,/]+)\.(svg|SVG)'
arg	isfile $0
plumb	start svg -9 $0 | plumb -id image

# audio

plumb	to	audio

type	is	text
data	matches	'[a-zA-Z¡-￿0-9_\-.,/ ]+'
data	matches	'([a-zA-Z¡-￿0-9_\-.,/ ]+)\.(mp3|MP3|ogg|OGG|flac|FLAC|wav|WAV|au|AU|mid|MID|mus|MUS|m3u|M3U|pls|PLS|opus|OPUS|aac|AAC|m4a|M4A|mod|MOD)'
arg	isfile	$0
plumb start window play -o /fd/1 $file >[2]/dev/null | audio/pplay

type is text
data matches '[a-zA-Z¡-￿0-9_\-.,/]+'
data matches '([a-zA-Z¡-￿0-9_\-.,/]+)\.(pcm|PCM)'
arg isfile	$0
plumb start window audio/pplay $file

type is text
data matches '[a-zA-Z¡-￿0-9_\-.,/]+'
data matches '([a-zA-Z¡-￿0-9_\-.,/]+)\.(xm|XM)'
arg isfile	$0
plumb start window audio/ft2 $file

# treason/yt

dst	is	video
plumb	to	video
plumb	client	window	treason

type	is	text
data	matches	'.+\.(mkv|MKV|mp4|MP4|webm|WEBM)'
data	set	$file
plumb	to	video
plumb	client	window -dx 480 -dy 360 echo ''''rc -c ''''''''treason ''''''''''''$file''''''''''''''''| rc

#type	is	text
#data	matches	'https?://(www\.youtube\.com/watch\?v=|youtu\.be/)...........'
#plumb	start	window -scroll 'ssh qwx@tcp!u11!17666 ''DISPLAY=:0 mpv 2>/dev/null '$0''''

type	is text
data	matches	'https?://www.youtube\.com/watch\?v=[^ "]+|https?://youtu\.be/[^ "]+'
plumb	start window yv ''''$0''''

type	is text
data	matches	'youtube\.com/watch\?v=([^ "]+)|youtu\.be/([^ "]+)'
plumb	start window yv ''''https://$0''''

# emu

type	is	text
data	matches	'.+\.(2600|bin|BIN|gb|GB|gbc|GBC|gba|GBA|nes|NES|smc|SMC)'
data	set	$file
plumb	start	window echo ''''rc -c ''''''''pemu ''''''''''''$file''''''''''''''''| rc

# docs

type	is	text
data	matches	'[a-zA-Z¡-￿0-9_\-.,/]+\.[Zz][Ii][Pp]'
plumb	to	image
plumb	client	page -wi

# notes

type	is text
data	matches	'\[[^\]]*\]\(([^/][^\)]*)\)'
plumb	start	note/add $wdir/$1

type	is text
data	matches	'\[[^\]]*\]\((/[^\)]+)\)'
plumb	start	note/add $1

# web

#data matches 'https?://.+|/tmp/webshit.*|[₀-₉]+|hpost.*'
#plumb to webshit
#plumb client window webshit

type	is	text
data	matches	'file:/[^ ]+'
plumb	to	web
plumb	client	window $browser

type	is	text
data	matches	'\[[^\]]*\]\((https?://[^\)]*)\)'
data	set	$1
plumb	to	web
plumb	client	window $browser

# thanks cinap
type is text
data matches 'https?://twitter.com/(.*)'
data set https://nitter.eu/$1
plumb to web
plumb client window $browser

# thanks khm/umbraticus
type is text
data matches https?://imgur.com/a/[a-zA-Z0-9]+
plumb start rc -c 'hget '$data' | sed -n ''s/.*<meta property="og:image"[^>]+content="([^"?]+).*/\1/p'' | xargs -n 1 plumb'

# gemnine
type	is	text
data	matches	'gemini://[^ ]+'
plumb	to	gemini
plumb	client	window gemnine -w $0

# screenshots: show window image in page (thanks sigrid)
# probably would be better to save to /tmp/scr.png automatically and page that
type	is	text
data	matches	'/dev/wsys/.*/window$'
plumb	start	page -wi $0

# open debugger for suicides (thanks kvik, ori)
type	is	text
data	matches	'[^ ]+ ([0-9]+): suicide:.*'
plumb	to	none
plumb	start	window lstk $1

type	is	text
data	matches	'[^ ]+ +([0-9]+) +[0-9]+ +[0-9:]+ +[0-9:]+ +[0-9]+K +[A-Z][^ ]+ +[^ ]+'
plumb	to	none
plumb	start	window lstk $1

type	is	text
data	matches	'[^ ]+ +([0-9]+) +[0-9:]+ +[0-9:]+ +[0-9]+K +[A-Z][^ ]+ +[^ ]+'
plumb	to	none
plumb	start	window lstk $1

# overwrite default mail rules
type is text
data matches '[a-zA-Z0-9_+.\-]+@[a-zA-Z0-9_+.\-]*'
plumb to sendmail
plumb start window rc -c '''fo; echo -n ''''>> '''' ; s=`"{read -n 1 | ssam ,s,\n,,}; mail -s $s '''$0

type	is	text
data	matches	'[a-zA-Z¡-￿0-9_\-./]+'
data	matches	'/mail/fs/[a-zA-Z¡-￿0-9/]+/[0-9]+'
plumb	to	showmail
plumb	start	window -noscroll -r 4 120 750 1000 upas/nedmail -s $0

# vdir/fm

# insane?
#src is vdir
#data	matches	'(.*)‡(.*)'
#type is text
#plumb start window -cd $1 rc -c ''$2''

src is vdir
type is text
arg isdir $data
plumb start window -cd $data f

src is vdirw
type is text
arg isdir $data
plumb start window -cd $data rc

include basic