about summary refs log tree commit diff stats
path: root/bin/notif
diff options
context:
space:
mode:
authorensa <psii@riseup.net>2021-09-16 17:37:41 -0700
committerensa <psii@riseup.net>2021-09-16 17:37:41 -0700
commitebae3707b36e9a83014ef08271d75bd9826bb999 (patch)
tree9a9a0b3d9a7c6a4475a5394f2bd25848ebadb552 /bin/notif
parent3f4e930385675a4613db5f12b19557b126c29559 (diff)
downloadcfg-ebae3707b36e9a83014ef08271d75bd9826bb999.tar.gz
organization and replacements, fixes
bin/
	bother, mbsync-cron, rsschk: notify-send switched to notif
	catgirl-open.sh: simplified
	comm-sel: removed cordless
	kbsetup: sets up keyboard stuff
	lh: cleanup
		added mov and wav support
		audio files now create a terminal mpv
	notif: sends notification to xnotify
config/
	X11/
		xprofile: replaced keyboard lines with kbsetup
			replaced dunst with xnotify/tiramisu
			added a line for cleaning up catgirl-open.sh
		xresources: xnotify resources
	betteresc: xmodmap file for easy-to-access hyper key
	color/colors.sh: cleaned up
	dunst/dunstrc: removed
	lf/lfrc: fixed prompt
		replaced notify-send with notif
	shrc: moved MEDNAFEN_HOME to $HOME_EXT
	vis/visrc.lua: add ctags, fix hyper|esc issue
Diffstat (limited to 'bin/notif')
-rwxr-xr-xbin/notif35
1 files changed, 35 insertions, 0 deletions
diff --git a/bin/notif b/bin/notif
new file mode 100755
index 0000000..5e75fd8
--- /dev/null
+++ b/bin/notif
@@ -0,0 +1,35 @@
+#!/bin/sh
+# sends xnotify a notification
+unset TAG SEC
+exec > ${XNOTIFY_FIFO:=$HOME_CACHE/xnotify$DISPLAY.fifo}
+ug_err()
+{
+	echo "${1}" 1>&2 && return "${2:-1}"
+}
+usage()
+{
+	ug_err "usage: ${0##*/} [ -s seconds ] [ -t tag ] <TITLE> [BODY]
+	-s seconds	seconds for notification to live
+	-t tag		category of notification"
+	exit
+}
+while getopts s:t: arg; do
+	case ${arg} in
+	s)	SEC=${OPTARG};;
+	t)	TAG=${OPTARG};;
+	*)	usage;;
+	esac
+done
+if [ -n "$SEC" ]; then
+	printf 'SEC:%s\t' "$SEC"
+	shift 2
+fi
+if [ -n "$TAG" ]; then
+	printf 'TAG:%s\t' "$TAG"
+	shift 2
+fi
+case "$#" in
+	1) printf '%s\n' "$1";;
+	2) printf '%s\t%s\n' "$1" "$2";;
+	*) exit;;
+esac