about summary refs log tree commit diff stats
path: root/bin
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
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')
-rwxr-xr-xbin/bother2
-rwxr-xr-xbin/catgirl-open.sh8
-rwxr-xr-xbin/comm-sel3
-rwxr-xr-xbin/kbsetup6
-rwxr-xr-xbin/lh8
-rwxr-xr-xbin/mbsync-cron4
-rwxr-xr-xbin/notif35
-rwxr-xr-xbin/rsschk4
8 files changed, 55 insertions, 15 deletions
diff --git a/bin/bother b/bin/bother
index a9d55ca..d3f5be9 100755
--- a/bin/bother
+++ b/bin/bother
@@ -20,5 +20,5 @@ if [ -f "$HOME"/today ]; then
 		:
 	done
 	sleep 0.5
-	notify-send -u critical "DO TODAY:" "$(cat "$HOME"/today)"
+	notif "DO TODAY:" "$(tr '\n' '\t'<"$HOME"/today)"
 fi
diff --git a/bin/catgirl-open.sh b/bin/catgirl-open.sh
index 3783422..fd1a939 100755
--- a/bin/catgirl-open.sh
+++ b/bin/catgirl-open.sh
@@ -5,14 +5,14 @@
 xidfile="$XDG_CACHE_HOME/catgirl/tabbed-catgirl.xid"
 
 choosenet() {
-	for network in $(ls $HOME_ETC/catgirl/*.conf|sed 's/.*\///');
+	for network in $HOME_ETC/catgirl/*.conf
 	do
-	printf '%s\n' $network;
+	printf '%s\n' $(basename ${network%.*});
 	done | dmenu -p "choose network:"
 }
 
 runtabbed() {
-	network=$(choosenet)
+	network=$(choosenet).conf
 	tabbed -cdn comm -r 2 $TERMINAL -into '' -e catgirl $network >"$xidfile" &
 }
 
@@ -23,7 +23,7 @@ else
 	xid=$(cat "$xidfile")
 	if xprop -id "$xid" >/dev/null 2>&1
 	then
-		$TERMINAL -into "$xid" -e catgirl $(choosenet) >/dev/null 2>&1 &
+		$TERMINAL -into "$xid" -e catgirl $(choosenet).conf >/dev/null 2>&1 &
 	else
 		runtabbed
 	fi
diff --git a/bin/comm-sel b/bin/comm-sel
index c5508cf..3dc1527 100755
--- a/bin/comm-sel
+++ b/bin/comm-sel
@@ -6,9 +6,8 @@ case "$TERMINAL" in
 	urxvt) CLASS='-name';;
 	alacritty|kitty) CLASS='--class';;
 esac
-case "$(dmenu_path|grep -E "catgirl$|cordless|scli$"|dmenu -p "choose chat app:")" in
+case "$(dmenu_path|grep -E "catgirl$|scli$"|dmenu -p "choose chat app:")" in
 	catgirl) catgirl-open.sh &;;
-	cordless) $TERMINAL $CLASS comm -e env TERM=xterm-256color cordless &;;
 	scli) $TERMINAL $CLASS comm -e scli&;;
 	*) return;;
 esac
diff --git a/bin/kbsetup b/bin/kbsetup
new file mode 100755
index 0000000..df100ff
--- /dev/null
+++ b/bin/kbsetup
@@ -0,0 +1,6 @@
+#!/bin/sh
+setxkbmap -option caps:shift -layout us -variant dvp
+xmodmap $HOME_ETC/betteresc
+xcape -e 'Hyper_L=Escape'
+xcape -e 'Control_L=Control_L|b'
+xset r rate 300 50
diff --git a/bin/lh b/bin/lh
index 331b358..71bc747 100755
--- a/bin/lh
+++ b/bin/lh
@@ -39,7 +39,7 @@ findredir() {
 			# return caught line
 			echo "$line"
 			# reset catch variable
-			unset -- catch
+			unset catch
 		fi
 		# set catch if the current line is location
 		if echo "$line"|grep -Fq 'ocation:'
@@ -61,7 +61,7 @@ URL=$(echo "$1"|findredir|tail -1|tr -d '[:cntrl:]')
 case "$URL" in
 	gemini://*|gopher://*)
 		$TERMINAL -e bombadillo "$URL" ;;
-	*.mkv*|*.webm*|*.mp4*)
+	*.mov*|*.mkv*|*.webm*|*.mp4*)
 		mpv --no-terminal "$URL" & ;;
 	*invidio.us/watch*|*youtube.com/watch*|*youtube.com/playlist*|*youtu.be*|*hooktube.com*|*bitchute.com*|*twitch.tv/videos/*|*twitch.tv/*/v/*)
 		mpv --no-terminal --ytdl "$URL" & ;;
@@ -73,8 +73,8 @@ case "$URL" in
 	*.png*|*.jpg*|*.jpe*|*.jpeg*|*.gif*)
 		IMGPATH="/tmp/$(lstrip "$URL" "*/")"
 		curl -sL "$URL" >"$IMGPATH"&&sxiv -pqa "$IMGPATH" & ;;
-	*.mp3*|*.m4a*|*.flac*|*.aiff*|*.opus*|*.ogg*|*.mp3?source*)
-		mpv --no-terminal "$URL"& ;;
+	*.mp3*|*.m4a*|*.flac*|*.aiff*|*.opus*|*.ogg*|*.mp3?source*|*.wav*)
+		$TERMINAL -e mpv "$URL"& ;;
 	*.epub*|*.pdf*|*.djvu*)
 		BOOKPATH="/tmp/$(lstrip "$URL" "*/")"
 		if [ -n "$READER" ]; then
diff --git a/bin/mbsync-cron b/bin/mbsync-cron
index fc611c2..711b60f 100755
--- a/bin/mbsync-cron
+++ b/bin/mbsync-cron
@@ -32,7 +32,7 @@ syncandnotify() {
     printf ' %s' "$newcount" > "$XDG_DATA_HOME/mail/$account/note"
     # don't notify if there isn't new mail
     if [ "$newcount" -gt "0" ]; then
-        notify-send --app-name="mbsync-cron" "mail fetcher" "new mail for profile $account! [$newcount]" &
+        notif "mail fetcher" "new mail for profile $account! [$newcount]" &
 	# reduce output if you have a lot of new mail
 	if [ "$newcount" -lt "16" ]; then
         for file in $new; do
@@ -41,7 +41,7 @@ syncandnotify() {
 	    from=$(awk '/^From: / && ++n ==1,/^\<.*\>:/' "$file" | awk '{ $1=""; if (NF>=3)$NF=""; print $0 }' | sed '1!d'| sed '1,/From/s/From: //')
 	    # modified version of broken $subject variable, only prints the first subject line (so forwards are slightly unclear)
             subject=$(awk '/^Subject: / && ++n == 1,/^\<.*\>: / && ++i == 2' "$file" | sed '$D' | grep -m 1 '^Subject: ' | sed 's/Subject: //')
-            notify-send --app-name="mbsync-cron" "$from:" "$subject" &
+            notif "$from:" "$subject" &
 	    # sleep for half a second to avoid notification clog
 	    sleep .5
         done
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
diff --git a/bin/rsschk b/bin/rsschk
index ab74169..92b8557 100755
--- a/bin/rsschk
+++ b/bin/rsschk
@@ -9,7 +9,7 @@ fi
 re_urls='https?://[[:alnum:].]*:?[[:alnum:]./@$&%?$#=_-]*\.(rss|xml)'
 
 ! echo "$1" | grep -Eq "$re_urls" &&
-	notify-send "Invalid input. rsschk takes http(s) URLs as input." && exit
+	notif "Invalid input. rsschk takes http(s) URLs as input." && exit
 RSSFILE="${XDG_CONFIG_HOME:=~/.config}/newsboat/urls"
 grep -q "^$1" "$RSSFILE" &&
-	{ echo "$1">>"$RSSFILE"&&notify-send "RSS feed added.";}
+	{ echo "$1">>"$RSSFILE"&&notif "RSS feed added.";}