From 04ea964440221a09d9a66af52749287ddbf49315 Mon Sep 17 00:00:00 2001
From: shmibs <shmibs@gmail.com>
Date: Mon, 15 Jun 2015 14:55:33 -0700
Subject: incremental update

changes i've let back up over time
---
 .config/herbstluftwm/autostart   |  2 +-
 .config/herbstluftwm/config_vars | 33 +++++++++++++---
 .config/herbstluftwm/panel.sh    | 83 +++++++++++++++++++++++++++++-----------
 3 files changed, 88 insertions(+), 30 deletions(-)

(limited to '.config/herbstluftwm')

diff --git a/.config/herbstluftwm/autostart b/.config/herbstluftwm/autostart
index 5c9841b..8963277 100755
--- a/.config/herbstluftwm/autostart
+++ b/.config/herbstluftwm/autostart
@@ -173,7 +173,7 @@ hc rule windowtype~'_NET_WM_WINDOW_TYPE_(NOTIFICATION|DOCK)' manage=off
 # set apppropriate things to pseudotile
 hc rule windowtype~'_NET_WM_WINDOW_TYPE_(DIALOG|UTILITY|SPLASH)' pseudotile=on focus=on
 hc rule class~'(VBoxSDL|SleepIsDeathApp|freeciv-sdl|milkytracker)' pseudotile=on focus=on
-hc rule class~'(FTL|Tegaki-recognize|PlayOnLinux|Pcsx2|Tilem2|Wine)' pseudotile=on focus=on
+hc rule class~'(FTL|Tegaki-recognize|PlayOnLinux|PCSX2|Tilem2|Wine)' pseudotile=on focus=on
 hc rule class~'(mednafen)' pseudotile=on focus=on
 
 # unlock, just to be sure
diff --git a/.config/herbstluftwm/config_vars b/.config/herbstluftwm/config_vars
index c736528..b910fed 100755
--- a/.config/herbstluftwm/config_vars
+++ b/.config/herbstluftwm/config_vars
@@ -37,6 +37,23 @@
 ###############
 #  Lain Blind #
 ###############
+#
+#bg_normal='#262626'
+#fg_normal='#c1b48e'
+#bg_focus='#d0758b'
+#fg_focus='#efefef'
+#bg_urgent='#ff4070'
+#fg_urgent='#efefef'
+#
+#fg_grey='#808080'
+#fg_red='#d0758b'
+#fg_green='#d0758b'
+#fg_yellow='#d0758b'
+#fg_blue='#d0758b'
+
+###########
+#  Aigis  #
+###########
 
 bg_normal='#262626'
 fg_normal='#c1b48e'
@@ -45,13 +62,17 @@ fg_focus='#efefef'
 bg_urgent='#ff4070'
 fg_urgent='#efefef'
 
-fg_grey='#808080'
-fg_red='#d0758b'
-fg_green='#d0758b'
-fg_yellow='#d0758b'
-fg_blue='#d0758b'
+fg_grey='#566a72'
+fg_red='#ba5654'
+fg_green='#badbb4'
+fg_yellow='#b9c780'
+fg_blue='#99cff3'
 
 bheight=18
 
-dfont='-*-stlarch-medium-r-*-*-10-*-*-*-*-*-*-*,-*-fixed-medium-*-*-*-12-*-*-*-*-*-*-*'
+#dfont='-*-stlarch-medium-r-*-*-10-*-*-*-*-*-*-*,-*-fixed-medium-*-*-*-12-*-*-*-*-*-*-*'
+bfont1='-*-stlarch-medium-r-*-*-10-*-*-*-*-*-*-*'
+bfont2='-*-fixed-medium-*-*-*-12-*-*-*-*-*-*-*'
 efont='-*-tamsyn-medium-*-*-*-14-*-*-*-*-*-*-*'
+
+
diff --git a/.config/herbstluftwm/panel.sh b/.config/herbstluftwm/panel.sh
index eff47cb..7588e54 100755
--- a/.config/herbstluftwm/panel.sh
+++ b/.config/herbstluftwm/panel.sh
@@ -34,6 +34,12 @@ fg_green=$(echo -n '#ff'; echo "$fg_green" | tr -d '#')
 fg_yellow=$(echo -n '#ff'; echo "$fg_yellow" | tr -d '#')
 fg_blue=$(echo -n '#ff'; echo "$fg_blue" | tr -d '#')
 
+# these are annoying, but i can't figure out a stateless way to handle rotation
+declare -i mpd_offset
+declare -i mpd_length
+declare mpd_current
+declare mpd_playing
+
 hc pad $monitor $bheight
 
 
@@ -45,6 +51,20 @@ hc pad $monitor $bheight
 # functions for retrieving and processing data
 # upon events
 
+update_mpd() {
+		echo -n "%{F${bg_focus}}|%{F${fg_normal} A:mpd:} "
+		echo -n "%{F${fg_green}}\uE05C%{F${fg_normal}} "
+		#echo -n "$mpd_current" | cut -c -$(expr 20 - "$mpd_offset")
+		echo "%{A}"
+		if [[ $mpd_length -gt 20 ]]; then
+			if [[ $mpd_offset -lt $[mpd_length-1] ]]; then
+				mpd_offset=$[mpd_offset+1]
+			else
+				mpd_offset=0
+			fi
+		fi
+}
+
 update_taglist() {
 	echo -n "%{l}%{B${bg_normal} F${fg_normal} U${fg_normal}}"
 	hc tag_status | tr '\t' '\n' | sed \
@@ -62,7 +82,7 @@ update_taglist() {
 update_winlist() {
 	focus_id=$(hc get_attr clients.focus.winid)
 
-	if [[ "$focus_id" == "" ]]; then
+	if [[ -z "$focus_id" ]]; then
 		return
 	fi
 
@@ -102,8 +122,7 @@ fields[5]=""
 fields[6]=""
 # date
 fields[7]=""
-# vertical separator and gap for tray
-#fields[8]="%{F${bg_focus}}|    %{F${fg_normal}}"
+
 
 
 ######################
@@ -123,6 +142,17 @@ get_date() {
 	} |	awk '$0 != l { print ; l=$0 ; fflush(); }'
 }
 
+get_mpd() {
+	while true; do
+		if [[ -z "$(mpc status | grep '\[playing\]')" ]]; then
+			echo -e "mpd\tpaused"
+		else
+			echo -e "mpd\tplaying"
+		fi
+		mpc idle player
+	done
+}
+
 get_stat() {
 	{
 		conky -c ~/.config/herbstluftwm/panel/conky_stats
@@ -132,7 +162,7 @@ get_stat() {
 get_when() {
 	{
 		while true; do
-			if [[ "$(when --future=2 | sed '1,2d')" == "" ]]; then
+			if [[ -z "$(when --future=2 | sed '1,2d')" ]]; then
 				echo -e 'when\t0'
 			else
 				echo -e 'when\t1'
@@ -142,12 +172,6 @@ get_when() {
 	} |	awk '$0 != l { print ; l=$0 ; fflush(); }'
 }
 
-get_mpd() {
-	while true; do
-		mpc current -f "mpd\t%artist%\t%album%\t%title%" --wait
-	done
-}
-
 
 
 #######################
@@ -164,8 +188,8 @@ get_mpd() {
 	child[2]=$!
 	get_when &
 	child[3]=$!
-	#get_mpd &
-	#child[4]=$!
+	get_mpd &
+	child[4]=$!
 	
 	hc --idle
 	
@@ -173,7 +197,7 @@ get_mpd() {
 		kill $id
 	done
 
-	pkill bar
+	pkill lemonbar
 	
 } 2> /dev/null | {
 
@@ -198,6 +222,24 @@ get_mpd() {
 		case "${event[0]}" in
 			date)
 				fields[7]="%{F${bg_focus}}|%{F${fg_normal} A:date:} \uE015 ${event[@]:1} %{A}"
+				if [[ $mpd_playing ]]; then
+					fields[5]=$(update_mpd)
+				fi
+				;;
+				
+			mpd)
+				if [[ "${event[1]}" == "playing" ]]; then
+					mpd_offset=0
+					mpd_current="$(mpc current) "
+					mpd_length=${#mpd_current}
+					mpd_playing=true
+					fields[5]=$(update_mpd)
+				else
+					mpd_offset=0
+					mpd_length=0
+					mpd_current=""
+					mpd_playing=false
+				fi
 				;;
 				
 			stats)
@@ -245,7 +287,8 @@ get_mpd() {
 	done
 	
 	# pass the events into bar
-} 2> /dev/null | bar -f $dfont -g${width}x${bheight}+${xpos}+${ypos} \
+} 2> /dev/null | lemonbar -f "$bfont1" -f "$bfont2" \
+	-g${width}x${bheight}+${xpos}+${ypos} \
 	-B ${bg_normal} -F ${fg_normal} | \
 {
 
@@ -259,15 +302,9 @@ get_mpd() {
 			date)
 				notify-send "$(cal)"
 				;;
-			#mpd)
-			#	artist=$(mpc current -f '%artist%')  
-			#	albumartist=$(mpc current -f '%albumartist%')
-			#	if [[ "$artist" != "$albumartist" ]]; then
-			#		artist=$(echo -e "album artist: $albumartist\nartist: $artist")
-			#	else
-			#		artist=$(echo "artist: $artist")
-			#	fi
-			#	file="/home/shmibs/music/$(mpc current -f '%file%')"
+			mpd)
+				notify-send "$(mpc status)"
+				;;
 			stats)
 				urxvt -e htop &
 				;;
-- 
cgit v1.2.3