about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorensa <psii@riseup.net>2020-07-08 15:32:24 -0700
committerensa <psii@riseup.net>2020-07-08 15:32:24 -0700
commiteec480ccb22f3166d723befc9522e8a25eabf8c1 (patch)
tree28ec200089f6d5797a06590defcb1c4ccf254c7c
parent4606fd8469199d5497b4b2fa4ea74d237ec9688b (diff)
downloadcfg-eec480ccb22f3166d723befc9522e8a25eabf8c1.tar.gz
catgirl-open.sh simplified, lh now handles stdin
bin/
	bar.sh: doesn't specify width (defaults to display width)
	bother: incorrectly used last, now uses tail
		uses : instead of true (telling the shell to do nothing)
	catgirl-open.sh: tabbed now called with -c, network chosen
		before invoking tabbed
		just tests xprop instead of hacky $? handling
	comm-sel: no longer specifies config directory for cordless
		(cordless does this correctly now)
	lh: if no arguments are given, set $1 to standard input.
		turned actual link handling into a loop, lh can now be
		sent multiple links and handle them all in sequence.
-rwxr-xr-xbin/bar.sh2
-rwxr-xr-xbin/bother4
-rwxr-xr-xbin/catgirl-open.sh12
-rwxr-xr-xbin/comm-sel4
-rwxr-xr-xbin/lh13
5 files changed, 23 insertions, 12 deletions
diff --git a/bin/bar.sh b/bin/bar.sh
index 6a0a04d..8dfbc7b 100755
--- a/bin/bar.sh
+++ b/bin/bar.sh
@@ -1,4 +1,4 @@
 #!/bin/sh
 # loads color envs, pipes spoon to dzen
 . $HOME_ETC/color/colors.sh
-spoon -t|dzen2 -ta r -fg "$foreground" -bg "$background" -fn "Terminus:style=Regular:pixelsize=12" -u -h 13 -w 1366 -l 0 -p
+spoon -t|dzen2 -ta r -fg "$foreground" -bg "$background" -fn "Terminus:style=Regular:pixelsize=12" -u -h 13 -l 0 -p
diff --git a/bin/bother b/bin/bother
index d63d899..a9d55ca 100755
--- a/bin/bother
+++ b/bin/bother
@@ -12,12 +12,12 @@ if grep -q "dwm" $XFILE; then
 elif grep -q 'exec' $XFILE; then
 	WM=$(grep 'exec' $XFILE|cut -f 2 -d ' ' -)
 else
-	WM=$(last -1 $XFILE)
+	WM=$(tail -1 $XFILE)
 fi
 if [ -f "$HOME"/today ]; then
 	until pgrep $WM>/dev/null
 	do
-		true
+		:
 	done
 	sleep 0.5
 	notify-send -u critical "DO TODAY:" "$(cat "$HOME"/today)"
diff --git a/bin/catgirl-open.sh b/bin/catgirl-open.sh
index 76673ec..3783422 100755
--- a/bin/catgirl-open.sh
+++ b/bin/catgirl-open.sh
@@ -12,20 +12,20 @@ choosenet() {
 }
 
 runtabbed() {
-	tabbed -fdn comm -r 2 $TERMINAL -into '' -e catgirl $(choosenet) >"$xidfile" &
+	network=$(choosenet)
+	tabbed -cdn comm -r 2 $TERMINAL -into '' -e catgirl $network >"$xidfile" &
 }
 
 if [ ! -r "$xidfile" ];
 then
 	runtabbed
 else
-	xid=$(<"$xidfile")
-	xprop -id "$xid" >/dev/null 2>&1
-	if [ $? -gt 0 ];
+	xid=$(cat "$xidfile")
+	if xprop -id "$xid" >/dev/null 2>&1
 	then
-		runtabbed
-	else
 		$TERMINAL -into "$xid" -e catgirl $(choosenet) >/dev/null 2>&1 &
+	else
+		runtabbed
 	fi
 fi
 
diff --git a/bin/comm-sel b/bin/comm-sel
index ce2e99b..c5508cf 100755
--- a/bin/comm-sel
+++ b/bin/comm-sel
@@ -1,6 +1,6 @@
 #!/bin/sh
 # sends a list of communication TUIs (e.g catgirl) to dmenu and allows the user to choose one.
-# class "comm" is added to enable window managers (e.g dwm) to do specific things with them.
+# class "comm" is added to enable window managers (e.g ewm) to do specific things with them.
 case "$TERMINAL" in
 	xterm) CLASS='-class';;
 	urxvt) CLASS='-name';;
@@ -8,7 +8,7 @@ case "$TERMINAL" in
 esac
 case "$(dmenu_path|grep -E "catgirl$|cordless|scli$"|dmenu -p "choose chat app:")" in
 	catgirl) catgirl-open.sh &;;
-	cordless) $TERMINAL $CLASS comm -e env TERM=xterm-256color cordless -config-dir "$XDG_CONFIG_HOME/cordless" &;;
+	cordless) $TERMINAL $CLASS comm -e env TERM=xterm-256color cordless &;;
 	scli) $TERMINAL $CLASS comm -e scli&;;
 	*) return;;
 esac
diff --git a/bin/lh b/bin/lh
index 40d747d..331b358 100755
--- a/bin/lh
+++ b/bin/lh
@@ -2,6 +2,12 @@
 # lh: the Link Handler
 # takes one path or URL as its argument, launches the appropriate program for it
 
+# set argument 1 to stdin if there are no args
+if [ $# -eq 0 ]
+then
+	set -- "$(cat)"
+fi
+
 # if $1 isn't provided, spawn $BROWSER and exit. this allows lh to be used as a pseudo-browser.
 [ -z "$1" ] && exec "$BROWSER"
 #from pure-sh-bible
@@ -43,6 +49,9 @@ findredir() {
 	done
 }
 
+# while loop for multiple urls
+while [ $# -ne 0 ]
+do
 # handle redirects. tr removes control characters, so the case statement below works as expected.
 URL=$(echo "$1"|findredir|tail -1|tr -d '[:cntrl:]')
 
@@ -54,7 +63,7 @@ case "$URL" in
 		$TERMINAL -e bombadillo "$URL" ;;
 	*.mkv*|*.webm*|*.mp4*)
 		mpv --no-terminal "$URL" & ;;
-	*youtube.com/watch*|*youtube.com/playlist*|*youtu.be*|*hooktube.com*|*bitchute.com*|*twitch.tv/videos/*|*twitch.tv/*/v/*)
+	*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" & ;;
 	*twitch.tv/*)
 		STREAMQUAL="$(split "$(streamlink "$URL"|grep 'Available streams')" ", "|\
@@ -80,3 +89,5 @@ case "$URL" in
 			$BROWSER "$URL" >/dev/null 2>&1 &
 		fi ;;
 esac
+shift
+done