dots

Personal dotfiles
git clone git://git.gormless.xyz/dots.git
Log | Files | Refs

bar (2400B)


      1 #!/bin/sh
      2 
      3 geom="$(xdpyinfo | awk '/dimensions:/ { print $2 }' | cut -f 1 -d x)x14"
      4 
      5 BG=#3b4252
      6 FG=#d8dee9
      7 
      8 
      9 clock() {
     10 	printf 'C  %s ' "$(date '+%D %I:%M %p')"
     11 }
     12 
     13 sound() {
     14 	test "$(sndioctl input.mute)" = "input.mute=1" && mic="Mic" || mic=""
     15 	level="$mic $(sndioctl output.level | cut -f 2 -d '=')"
     16 	test "$(sndioctl output.mute | cut -c 13)" == 1 && printf 'A %s ' "$mic Mute" || printf 'A  %s ' "$level"
     17 }
     18 
     19 battery()
     20 {
     21    bat=$(apm -l)
     22    stat=$(apm -a)
     23    case $stat in
     24       1)
     25          test "$bat" = 100 && st="=" || st="+"
     26          ;;
     27       0)
     28          test "$bat" = 100 && st="=" || st="-"
     29          ;;
     30    esac
     31 	printf "ϟ  %s " "$st$bat%"
     32 }
     33 
     34 net() {
     35 inter="$(ifconfig | awk '/ieee80211:/ { print $3" " "(" $8 ")" }')"
     36 test "$(ifconfig | awk '/ieee80211:/ { print $8}')" == "psk" && printf '%s ' "N/a" || printf 'N  %s ' "$inter"
     37 }
     38 
     39 news() {
     40 newsstatus="$(cat /home/anon/etc/newsboat/newsupdate)"
     41 printf "N  %s " "$newsstatus"
     42 }
     43 
     44 playing() {
     45 state="$(cmus-remote -C status | grep status | cut -f 2 -d " ")"
     46 test -z "$state" && np="Nothing"
     47 test "$state" = stopped && np=". $(showmus)"
     48 test "$state" = playing && np="> $(showmus)"
     49 test "$state" = paused && np="| $(showmus)"
     50 printf "M  %s " "$np"
     51 }
     52 
     53 todonum() {
     54 todo="$(export TODO=$HOME/usr/notes/todo; todo | wc -l)"
     55 printf "T  %s " "$todo"
     56 }
     57 
     58 email() {
     59 unread="$(find "${XDG_DATA_HOME}"/mail/*/[Ii][Nn][Bb][Oo][Xx]/new/* -type f 2>/dev/null | wc -l 2>/dev/null)"
     60 test -z "$(pgrep -f mbsync)" || icon="..."
     61 printf "E  %s " "$unread$icon"
     62 }
     63 
     64 weather() {
     65 weather="$(curl -s "wttr.in/Saint John?format=%l:+%C+%t+(%f)")"
     66 printf "W %s " "$weather"
     67 }
     68 
     69 while :; do
     70 	BUF="%{T2}%{S1}"
     71 	BUF="${BUF}%{r} %{A:cmus-remote -r:}%{A2:cmus-remote -u:}%{A3:cmus-remote -n:}$(playing)%{A}%{A}%{A} |
     72 	$(weather) |
     73 	%{A:dmenuwireless >/dev/null &:}$(net)%{A} |
     74 	%{A:todmenu >/dev/null &:}$(todonum)%{A} |
     75 	%{A:stmux 'new' 'var/newsboat' 'newsboat':}%{A3:newsup >/dev/null &:}$(news)%{A}%{A} |
     76 	%{A:stmux 'ema' 'var/mail' 'mutt':}%{A3:mbsync \"${1:--a}\" >/dev/null &:}$(email)%{A}%{A} |
     77 	$(battery) |
     78 	%{A4:sndioctl output.level=+0.031:}%{A5:sndioctl output.level=-0.031:}%{A:sndioctl output.mute=!:}%{A3:sndioctl input.mute=!:}$(sound)%{A}%{A}%{A}%{A} |
     79 	$(clock)" 
     80 	echo $BUF
     81 	sleep 1
     82 done | lemonbar-xft -f "Ttyp0 bold:pixelsize=11.3:antialias=true:autohint=true" -f 'ibm plex serif:pixelsize=13:antialias=true:autohint=true' -dg $geom -B${BG} -F${FG} -a 19