├── .dzenbarrc.dist ├── .gitignore ├── README.md ├── dzenbar ├── killdzenbar ├── mod_battery ├── mod_cpu ├── mod_filesystem ├── mod_mail ├── mod_mcabber ├── mod_memory ├── mod_mpd ├── mod_network ├── mod_nvidia_smi_gpu_temp ├── mod_ping ├── mod_rhythmbox ├── mod_sensors ├── mod_volume ├── mod_weather └── xbm ├── battery.xbm ├── cpu.xbm ├── down.xbm ├── filesystem.xbm ├── headphone.xbm ├── mail.xbm ├── memory.xbm ├── mpd.xbm ├── ping.xbm ├── temp.xbm ├── up.xbm ├── volume-mute.xbm ├── volume.xbm ├── weather.xbm ├── wired.xbm └── wireless.xbm /.dzenbarrc.dist: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # available scrpts (mod_*): 4 | # battery, cpu, filesystem, mail, mcabber, memory, mpd, rhythmbox, network, sensors, volume, weather, ping, mod_nvidia_smi_gpu_temp 5 | 6 | # for one monitor 7 | SCRPTS=( 8 | [0]="cpu memory sensors filesystem battery volume network mail ping" 9 | ) 10 | 11 | # for multiple monitors, where key is monitor number 12 | #SCRPTS=( 13 | # [0]="sensors memory network ping" 14 | # [3]="filesystem volume mpd" 15 | #) 16 | 17 | # mod_battery 18 | BATTERY="/sys/class/power_supply/BAT0" 19 | # callback functions; comment for disable 20 | BATTERY__callback_on_battery() { 21 | notify-send -i battery-good "power" "on battery" 22 | backlight-brightness-control --set 6 > /dev/null 23 | } 24 | BATTERY__callback_on_cable() { 25 | notify-send -i battery-good-charging "power" "on cable" 26 | backlight-brightness-control --set 8 > /dev/null 27 | } 28 | BATTERY_UPDATE=10 29 | # mod_cpu 30 | CPU_UPDATE=1 31 | # mod_filesystem 32 | declare -A FILESYSTEM_DISK_LIST 33 | FILESYSTEM_DISK_LIST=(["root:"]="/dev/nvme0n1p2" ["strg1:"]="/dev/sdb4") # grep of `df` 34 | FILESYSTEM_UPDATE=2m 35 | # mod_mail 36 | MAIL_DIR="${HOME}/Mail" 37 | MAIL_UPDATE=30 38 | # mod_mcabber 39 | MCABBER_STATE="${HOME}/.mcabber/mcabber.state" 40 | MCABBER_UPDATE=10 41 | # mod_memory 42 | MEMORY_UPDATE=10 43 | # mod_mpd, mod_rhythmbox 44 | MUSIC_UPDATE=5 45 | # mod_network 46 | NETWORK_UPDATE=2 47 | # mod_ping 48 | PING_DESTINATION="1.1.1.1" 49 | PING_UPDATE=30 50 | # mod_sensors 51 | declare -A SENSORS 52 | SENSORS=(["CPU:"]=12 ["M2:"]=7 ["GPU:"]=3) # line of `sensors` 53 | SENSORS_UPDATE=2m 54 | # mod_volume 55 | VOLUME_MIXER="Master" 56 | VOLUME_UPDATE=5 57 | # mod_weather 58 | WEATHER_SEARCH="UIII" 59 | WEATHER_UPDATE=30m 60 | 61 | #WIDTH=1366 62 | WIDTH=$(xdpyinfo | grep dimensions | cut -d ' ' -f7 | cut -d 'x' -f 1) 63 | HEIGHT=20 64 | X=0 65 | #Y=748 66 | Y=$(echo "$(xdpyinfo | grep dimensions | cut -d ' ' -f7 | cut -d 'x' -f 1) - ${HEIGHT}" | bc) 67 | FONT="Hack:size=10" 68 | BG_COLOR="#002B36" 69 | FG_COLOR="#657B83" 70 | ICON_PATH="xbm\/" 71 | ICON_COLOR="#268BD2" 72 | TEXT_COLOR="#839496" 73 | PIPE_FILE_DIR="/tmp/" 74 | PIDS_FILE="/tmp/dzenbarpids" 75 | 76 | putLineToPipeFile() { 77 | local MONITOR=${1} 78 | local PIPE_LINE=${2} 79 | local TEXT=${3} 80 | local PIPE_FILE=$(getPipeFilePath ${MONITOR}) 81 | sed -i "${PIPE_LINE}s/.*/${TEXT}/" ${PIPE_FILE} 82 | } 83 | 84 | getPipeFilePath() { 85 | local MONITOR=${1} 86 | echo "${PIPE_FILE_DIR}dzenbarpipe_${MONITOR}" 87 | } 88 | 89 | icon() { 90 | local ICON=${1} 91 | echo -n "^i(${ICON_PATH}${ICON}.xbm)" 92 | } 93 | 94 | iconColor() { 95 | local ICON=${1} 96 | local COLOR="${2:-$ICON_COLOR}" 97 | echo -n "^fg(${COLOR})$(icon ${ICON})^fg()" 98 | } 99 | 100 | textColor() { 101 | local TEXT=${1} 102 | local COLOR=${2:-$TEXT_COLOR} 103 | echo -n "^fg(${COLOR})${TEXT}^fg()" 104 | } 105 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .dzenbarrc 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | dzenbar 2 | ======= 3 | 4 | dzen2 bar \w multiple monitors support. 5 | 6 | ![qbbr-dzenbar](https://i.imgur.com/QQZwleh.png) 7 | 8 | Requirements 9 | ------------ 10 | 11 | * [lm-sensors](https://github.com/groeck/lm-sensors) 12 | * [weather-util](http://fungi.yuggoth.org/weather/) 13 | * [mpc](https://www.musicpd.org/clients/mpc/) 14 | 15 | Installation 16 | ------------ 17 | 18 | ```bash 19 | cd ~/sft/ 20 | git clone git@github.com:qbbr/dzenbar.git 21 | cd dzenbar/ 22 | cp .dzenbarrc.dist .dzenbarrc 23 | ``` 24 | 25 | add to .xinitrc 26 | 27 | ```bash 28 | ~/sft/dzenbar/dzenbar & 29 | ``` 30 | 31 | for kill all pids, run scrpt: 32 | 33 | ``` 34 | ./killdzenbar 35 | ``` 36 | 37 | Configuration 38 | ------------- 39 | 40 | see `.dzenbarrc` 41 | 42 | Mods 43 | ---- 44 | 45 | * multi core CPU usage 46 | * memory usage 47 | * dev temperature (sensors) 48 | * fs percent usage / free 49 | * network interface down/up speed in kB/s 50 | * weather (weather-util) 51 | * battery 52 | * volume (amixer) 53 | * mpd (mpc) 54 | * mcabber msg counter (statefile) 55 | * email counter 56 | * ping 57 | -------------------------------------------------------------------------------- /dzenbar: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # ./dzenbar 4 | # 5 | # deps: dzen2 6 | # cfg: .dzenbarrc 7 | # author: @qbbr 8 | 9 | SOURCE="${BASH_SOURCE[0]}" 10 | 11 | while [[ -h "${SOURCE}" ]]; do 12 | DIR="$(cd -P "$(dirname "${SOURCE}")" && pwd)" 13 | SOURCE="$(readlink "${SOURCE}")" 14 | [[ $SOURCE != /* ]] && SOURCE="${DIR}/${SOURCE}" 15 | done 16 | 17 | cd "$(dirname "${SOURCE}")" 18 | 19 | . .dzenbarrc 20 | 21 | preparePipeFile() { 22 | # $1 - monitor 23 | local PIPE_FILE=$(getPipeFilePath $1) 24 | local MAX_LINES=32 25 | # erase pipe file 26 | > ${PIPE_FILE} 27 | # fill empty lines for sed 28 | for ((LINE = 0; LINE < ${MAX_LINES}; LINE++)); do 29 | echo "" >> ${PIPE_FILE} 30 | done 31 | } 32 | 33 | echo "" > ${PIDS_FILE} 34 | 35 | for monitor in ${!SCRPTS[@]}; do 36 | PIPE_FILE=$(getPipeFilePath ${monitor}) 37 | preparePipeFile "${monitor}" 38 | 39 | line=1 40 | for SCRIPT in ${SCRPTS[${monitor}]}; do 41 | . ./mod_${SCRIPT} ${monitor} ${line} & 42 | echo $! >> ${PIDS_FILE} 43 | ((++line)) 44 | done 45 | 46 | ((xs = monitor + 1)) 47 | (while true; do CONTENT=$(sed -e ':a' -e 'N' -e '$!ba' -e 's/\n//g' ${PIPE_FILE}); echo -e ${CONTENT}; sleep 1; done) | dzen2 -xs $xs -e 'button3=;' -w $WIDTH -h $HEIGHT -x $X -y $Y -fn $FONT -bg $BG_COLOR -fg $FG_COLOR -p -title-name dzenbar & 48 | echo $! >> ${PIDS_FILE} 49 | done 50 | -------------------------------------------------------------------------------- /killdzenbar: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | SOURCE="${BASH_SOURCE[0]}" 4 | 5 | while [[ -h "${SOURCE}" ]]; do 6 | DIR="$(cd -P "$(dirname "${SOURCE}")" && pwd)" 7 | SOURCE="$(readlink "${SOURCE}")" 8 | [[ $SOURCE != /* ]] && SOURCE="${DIR}/${SOURCE}" 9 | done 10 | 11 | cd "$(dirname "${SOURCE}")" 12 | 13 | . .dzenbarrc 14 | 15 | $(kill $(cat ${PIDS_FILE})) 16 | -------------------------------------------------------------------------------- /mod_battery: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | . .dzenbarrc 4 | 5 | MONITOR=${1} 6 | PIPE_LINE=${2} 7 | 8 | prev_status="" 9 | 10 | while true; do 11 | capacity="$(cat "${BATTERY}/capacity")" 12 | status=$(sed "s/Discharging/-/;s/Charging/+/;s/Not charging/n/;s/Unknown/u/;s/Full//" "${BATTERY}/status") 13 | 14 | if [[ "${status}" != "${prev_status}" ]]; then 15 | if [[ "$(type -t BATTERY__callback_on_battery)" == "function" ]] && [[ "${status}" == "-" ]]; then 16 | BATTERY__callback_on_battery 17 | elif [[ "$(type -t BATTERY__callback_on_cable)" == "function" ]]; then 18 | BATTERY__callback_on_cable 19 | fi 20 | fi 21 | 22 | prev_status="${status}" 23 | 24 | if [[ "${capacity}" -le 25 ]] && [[ "${status}" == "-" ]]; then 25 | status="!${status}" 26 | fi 27 | 28 | if [[ "${status}" != "" ]]; then 29 | status="[${status}] " 30 | fi 31 | 32 | putLineToPipeFile ${MONITOR} ${PIPE_LINE} " $(iconColor 'battery') ${status}${capacity}%" 33 | sleep ${BATTERY_UPDATE} 34 | done 35 | -------------------------------------------------------------------------------- /mod_cpu: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | . .dzenbarrc 4 | 5 | MONITOR=${1} 6 | PIPE_LINE=${2} 7 | 8 | stat_before=$(cat /proc/stat | head -n 5) 9 | cpu_cores=$(nproc) # number of cpu cores 10 | 11 | sleep 0.01 12 | getCoreLoadPercent() { 13 | local core=${1} 14 | 15 | before=$(echo "${stat_before}" | grep "^cpu${core} ") 16 | after=$(echo "${stat_after}" | grep "^cpu${core} ") 17 | 18 | user0=$(echo "${before}" | awk '{ print $2 }') 19 | user1=$(echo "${after}" | awk '{ print $2 }') 20 | nice0=$(echo "${before}" | awk '{ print $3 }') 21 | nice1=$(echo "${after}" | awk '{ print $3 }') 22 | syst0=$(echo "${before}" | awk '{ print $4 }') 23 | syst1=$(echo "${after}" | awk '{ print $4 }') 24 | idle0=$(echo "${before}" | awk '{ print $5 }') 25 | idle1=$(echo "${after}" | awk '{ print $5 }') 26 | 27 | user=$(expr ${user1} - ${user0}) 28 | nice=$(expr ${nice1} - ${nice0}) 29 | syst=$(expr ${syst1} - ${syst0}) 30 | idle=$(expr ${idle1} - ${idle0}) 31 | 32 | total=$(expr ${user} + ${nice} + ${syst} + ${idle}) 33 | used=$(expr ${user} + ${nice} + ${syst}) 34 | 35 | echo "${used} * 100 / ${total}" | bc 36 | } 37 | 38 | while true; do 39 | stat_after=`cat /proc/stat | head -n 5` 40 | output=" $(iconColor 'cpu') " 41 | 42 | let "last = ${cpu_cores} - 1" 43 | for ((i=0; i < ${cpu_cores}; i++)); do 44 | output="${output}$(textColor "$(getCoreLoadPercent ${i})")%" 45 | 46 | if [[ "${i}" != "${last}" ]]; then 47 | output="${output} \/ " 48 | fi 49 | done 50 | 51 | #echo $output 52 | putLineToPipeFile ${MONITOR} ${PIPE_LINE} "${output}" 53 | 54 | stat_before=${stat_after} 55 | sleep ${CPU_UPDATE} 56 | done 57 | -------------------------------------------------------------------------------- /mod_filesystem: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | . .dzenbarrc 4 | 5 | MONITOR=${1} 6 | PIPE_LINE=${2} 7 | 8 | while true; do 9 | output=" $(iconColor 'filesystem') " 10 | cache=$(df -h) 11 | 12 | count=${#FILESYSTEM_DISK_LIST[@]} 13 | ((--count)) 14 | i=0 15 | 16 | for key in ${!FILESYSTEM_DISK_LIST[@]}; do 17 | output="${output}${key}" 18 | fs_dfc=$(echo "${cache}" | grep "${FILESYSTEM_DISK_LIST[${key}]}") 19 | 20 | output="${output} $(textColor "$(echo ${fs_dfc} | awk '{ print $5 }')")" 21 | output="${output} (" 22 | output="${output}$(echo ${fs_dfc} | awk '{ print $4 }')" 23 | output="${output})" 24 | 25 | if [[ "${i}" != "${count}" ]]; then 26 | output="${output}$(textColor ', ')" 27 | fi 28 | 29 | ((i++)) 30 | done 31 | 32 | putLineToPipeFile ${MONITOR} ${PIPE_LINE} "${output}" 33 | sleep ${FILESYSTEM_UPDATE} 34 | done 35 | -------------------------------------------------------------------------------- /mod_mail: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | . .dzenbarrc 4 | 5 | MONITOR=${1} 6 | PIPE_LINE=${2} 7 | 8 | while true; do 9 | count=$(find ${MAIL_DIR}/*/INBOX/new/ -type f | wc -l) 10 | 11 | if [[ "${count}" = 0 ]]; then 12 | output="0" 13 | else 14 | output=$(textColor ${count}) 15 | fi 16 | 17 | putLineToPipeFile ${MONITOR} ${PIPE_LINE} " $(iconColor 'mail') ${output}" 18 | sleep ${MAIL_UPDATE} 19 | done 20 | -------------------------------------------------------------------------------- /mod_mcabber: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | . .dzenbarrc 4 | 5 | MONITOR=${1} 6 | PIPE_LINE=${2} 7 | 8 | while true; do 9 | if [[ -f ${MCABBER_STATE} ]]; then 10 | count=$(textColor $(cat ${MCABBER_STATE} | wc -l)) 11 | else 12 | count="0" 13 | fi 14 | 15 | putLineToPipeFile ${MONITOR} ${PIPE_LINE} " $(iconColor 'mail') ${count}" 16 | sleep ${MCABBER_UPDATE} 17 | done 18 | -------------------------------------------------------------------------------- /mod_memory: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | . .dzenbarrc 4 | 5 | MONITOR=${1} 6 | PIPE_LINE=${2} 7 | 8 | while true; do 9 | cache=$(free -m) 10 | mem_usage_percent=$(echo -e "$cache" | awk '/Mem:/ {print int($3 * 100 / $2)}') 11 | mem_usage_mb=$(echo -e "$cache" | awk '/Mem:/ {print $3}') 12 | 13 | output=" $(iconColor 'memory') $(textColor "${mem_usage_percent}")% ("${mem_usage_mb}"M)" 14 | 15 | putLineToPipeFile ${MONITOR} ${PIPE_LINE} "${output}" 16 | sleep ${MEMORY_UPDATE} 17 | done 18 | -------------------------------------------------------------------------------- /mod_mpd: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | . .dzenbarrc 4 | 5 | MONITOR=${1} 6 | PIPE_LINE=${2} 7 | 8 | while true; do 9 | if [ "$(mpc | head -c 6)" = "volume" ]; then 10 | output="[stopped]" 11 | elif [ "$(mpc | sed -n '2p' | head -c 8)" = "[paused]" ]; then 12 | output="[paused] $(mpc | head -n 1)" 13 | else 14 | output="[playing] $(textColor "$(mpc | head -n 1)")" 15 | fi 16 | 17 | output="$(echo ${output} | sed 's;/;\\/;g' | sed 's;&;\\&;g')" 18 | 19 | putLineToPipeFile ${MONITOR} ${PIPE_LINE} " $(iconColor 'mpd') ${output}" 20 | 21 | sleep ${MUSIC_UPDATE} 22 | done 23 | -------------------------------------------------------------------------------- /mod_network: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | . .dzenbarrc 4 | 5 | MONITOR=${1} 6 | PIPE_LINE=${2} 7 | 8 | calculate() { 9 | local sum=0 10 | 11 | for arg; do 12 | read -r i < "${arg}" 13 | sum=$(( sum + i )) 14 | done 15 | 16 | cache="/tmp/cache_${1##*/}" 17 | [[ -f "${cache}" ]] && read -r old < "${cache}" || old=0 18 | echo "${sum}" > "${cache}" 19 | 20 | echo $(( sum - old )) 21 | } 22 | 23 | # 1st call for cache 24 | rxb=$(calculate /sys/class/net/[ew]*/statistics/rx_bytes) 25 | txb=$(calculate /sys/class/net/[ew]*/statistics/tx_bytes) 26 | 27 | while true; do 28 | rxb=$(echo "$(calculate /sys/class/net/[ew]*/statistics/rx_bytes) / 1024 / ${NETWORK_UPDATE}" | bc -l | xargs printf "%.2f") 29 | txb=$(echo "$(calculate /sys/class/net/[ew]*/statistics/tx_bytes) / 1024 / ${NETWORK_UPDATE}" | bc -l | xargs printf "%.2f") 30 | 31 | # wireless check 32 | wstatus="$(cat /sys/class/net/w*/operstate 2>/dev/null)" 33 | if [[ "$wstatus" == "up" ]]; then 34 | icon="$(iconColor 'wireless') $(awk '/^\s*w/ { print int($3 * 100 / 70) }' /proc/net/wireless)%" 35 | else 36 | icon="$(iconColor 'wired')" 37 | fi 38 | 39 | output=" ${icon} $(iconColor 'down' '#859900') $(textColor "${rxb}")kBs $(iconColor 'up' '#B58900') $(textColor "${txb}")kBs" 40 | 41 | putLineToPipeFile ${MONITOR} ${PIPE_LINE} "${output}" 42 | sleep ${NETWORK_UPDATE} 43 | done 44 | -------------------------------------------------------------------------------- /mod_nvidia_smi_gpu_temp: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | . .dzenbarrc 4 | 5 | MONITOR=${1} 6 | PIPE_LINE=${2} 7 | 8 | while true; do 9 | output="$(textColor "$(nvidia-smi --query-gpu=temperature.gpu --format=csv,noheader)")°C" 10 | 11 | putLineToPipeFile ${MONITOR} ${PIPE_LINE} "$(textColor ',') GPU: ${output}" 12 | sleep ${SENSORS_UPDATE} 13 | done 14 | -------------------------------------------------------------------------------- /mod_ping: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | . .dzenbarrc 4 | 5 | MONITOR=${1} 6 | PIPE_LINE=${2} 7 | 8 | while true; do 9 | output=$(ping -c 3 ${PING_DESTINATION} 2> /dev/null | awk -F '/' 'END {printf "%d", $5}') 10 | 11 | if [[ "${output}" = "0" ]]; then 12 | output="" 13 | else 14 | output=" $(iconColor 'ping') $(textColor "${output}")ms" 15 | fi 16 | 17 | putLineToPipeFile ${MONITOR} ${PIPE_LINE} "${output}" 18 | sleep ${PING_UPDATE} 19 | done 20 | -------------------------------------------------------------------------------- /mod_rhythmbox: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # depends: qdbus 4 | 5 | . .dzenbarrc 6 | 7 | MONITOR=${1} 8 | PIPE_LINE=${2} 9 | 10 | while true; do 11 | if rhythmbox-client --check-running; then 12 | pstatus="$(qdbus org.mpris.MediaPlayer2.rhythmbox /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlaybackStatus | tr '[:upper:]' '[:lower:]')" # stopped|paused|playing 13 | output="[${pstatus}]" 14 | if [[ "${pstatus}" != "stopped" ]]; then 15 | output="${output} $(textColor "$(rhythmbox-client --print-playing)")" 16 | fi 17 | else 18 | output="[stopped]" 19 | fi 20 | 21 | output="$(echo ${output} | sed 's;/;\\/;g' | sed 's;&;\\&;g')" 22 | 23 | putLineToPipeFile ${MONITOR} ${PIPE_LINE} " $(iconColor 'mpd') ${output}" 24 | 25 | sleep ${MUSIC_UPDATE} 26 | done 27 | -------------------------------------------------------------------------------- /mod_sensors: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | . .dzenbarrc 4 | 5 | MONITOR=${1} 6 | PIPE_LINE=${2} 7 | 8 | while true; do 9 | output='' 10 | cache=$(sensors) 11 | 12 | count=${#SENSORS[@]} 13 | i=0 14 | let "count = ${count} - 1" 15 | for key in ${!SENSORS[@]}; do 16 | output="${output}${key}" 17 | _temp=$(echo "${cache}" | sed "${SENSORS[${key}]}!D" | sed -ne 's/[^:]*: \+[-+]\([0-9]\+\).*/\1/p') 18 | output="${output} $(textColor "${_temp}")°C" 19 | if [ "${i}" != "${count}" ]; then 20 | output="${output}$(textColor ',') " 21 | fi 22 | let "i = ${i} + 1" 23 | done 24 | 25 | putLineToPipeFile ${MONITOR} ${PIPE_LINE} " $(iconColor 'temp') ${output}" 26 | sleep ${SENSORS_UPDATE} 27 | done 28 | -------------------------------------------------------------------------------- /mod_volume: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | . .dzenbarrc 4 | 5 | MONITOR=${1} 6 | PIPE_LINE=${2} 7 | 8 | is_headphone_plugged() { 9 | command -v pactl > /dev/null && pactl list sinks | grep 'analog-output-headphones' | grep -q 'not available' && echo '0' || echo '1' 10 | } 11 | 12 | while true; do 13 | volume=$(amixer get ${VOLUME_MIXER} | tail -n1 | sed -r 's/.*\[(.*)%\].*/\1/') 14 | volume_on=$(amixer get ${VOLUME_MIXER} | sed -ne 's/.*\ \[\([^]]*\).*/\1/p' | head -n1) 15 | 16 | if [[ "${volume_on}" = "on" ]]; then 17 | output=" $(iconColor 'volume')" 18 | else 19 | output=" $(iconColor 'volume-mute')" 20 | fi 21 | 22 | if [[ "1" == "$(is_headphone_plugged)" ]]; then 23 | output="${output} $(iconColor 'headphone' '#586e75')" 24 | fi 25 | 26 | putLineToPipeFile ${MONITOR} ${PIPE_LINE} "${output} $(textColor "${volume}")%" 27 | sleep ${VOLUME_UPDATE} 28 | done 29 | -------------------------------------------------------------------------------- /mod_weather: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | . .dzenbarrc 4 | 5 | MONITOR=${1} 6 | PIPE_LINE=${2} 7 | 8 | while true; do 9 | cache='/tmp/weather.cache' 10 | weather ${WEATHER_SEARCH} -q -m --no-cache-data > ${cache} 2> /dev/null 11 | if [[ $? == 0 ]]; then 12 | w_temp=$(cat ${cache} | awk '/Temperature/ {print $2}') 13 | w_humidity=$(cat ${cache} | awk '/Humidity/ {print $3}') 14 | w_sky="" 15 | #w_sky=$(cat ${cache} | awk '/Sky conditions/ {for(i=3;i<=NF;i++) print $i}' | sed ':a;N;$!ba;s/\n/ /g') 16 | # 17 | #if [[ -n ${w_sky} ]]; then 18 | # w_sky="${w_sky}, " 19 | #fi 20 | 21 | w_wind=$(cat ${cache} | awk -F KPH '/Wind/ {print $1}' | awk '{print $NF}') 22 | 23 | if [[ "${w_wind}" =~ ^[0-9]+$ ]]; then 24 | w_wind="${w_wind} kph, " 25 | elif [[ -n ${w_wind} ]]; then 26 | w_wind="${w_wind,,}, " 27 | fi 28 | 29 | output=" $(iconColor 'weather') ${w_wind}$(textColor 't:') ${w_temp}°C$(textColor ', h:') ${w_humidity}" 30 | putLineToPipeFile ${MONITOR} ${PIPE_LINE} "${output}" 31 | sleep ${WEATHER_UPDATE} 32 | else 33 | sleep 1m 34 | fi 35 | done 36 | -------------------------------------------------------------------------------- /xbm/battery.xbm: -------------------------------------------------------------------------------- 1 | #define battery_width 16 2 | #define battery_height 16 3 | static unsigned char battery_bits[] = { 4 | 0x00, 0x00, 0xc0, 0x03, 0xc0, 0x03, 0xf0, 0x0f, 0xf0, 0x0f, 0x10, 0x08, 5 | 0x10, 0x08, 0x10, 0x08, 0x10, 0x08, 0xf0, 0x0f, 0xf0, 0x0f, 0xf0, 0x0f, 6 | 0xf0, 0x0f, 0xf0, 0x0f, 0xf0, 0x0f, 0x00, 0x00 }; 7 | -------------------------------------------------------------------------------- /xbm/cpu.xbm: -------------------------------------------------------------------------------- 1 | #define cpu_width 16 2 | #define cpu_height 16 3 | static unsigned char cpu_bits[] = { 4 | 0x00, 0x00, 0x48, 0x12, 0x48, 0x12, 0xfc, 0x3f, 0xfc, 0x3f, 0xfe, 0x7f, 5 | 0x1c, 0x38, 0x1c, 0x38, 0x1e, 0x78, 0x1c, 0x38, 0xfc, 0x3f, 0xfe, 0x7f, 6 | 0xfc, 0x3f, 0x48, 0x12, 0x48, 0x12, 0x00, 0x00 }; 7 | -------------------------------------------------------------------------------- /xbm/down.xbm: -------------------------------------------------------------------------------- 1 | #define down_width 12 2 | #define down_height 12 3 | static unsigned char down_bits[] = { 4 | 0x00, 0x00, 0xe0, 0x00, 0xe0, 0x00, 0xe0, 0x00, 0xe0, 0x00, 0xe0, 0x00, 5 | 0xe0, 0x00, 0xf8, 0x03, 0xf0, 0x01, 0xe0, 0x00, 0x40, 0x00, 0x00, 0x00 }; 6 | -------------------------------------------------------------------------------- /xbm/filesystem.xbm: -------------------------------------------------------------------------------- 1 | #define filesystem_width 12 2 | #define filesystem_height 12 3 | static unsigned char filesystem_bits[] = { 4 | 0x00, 0x00, 0x00, 0x00, 0x7e, 0x07, 0x7e, 0x07, 0x7e, 0x00, 0x7e, 0x07, 5 | 0x7e, 0x07, 0x7e, 0x00, 0x7e, 0x07, 0x7e, 0x07, 0x00, 0x00, 0x00, 0x00 }; 6 | -------------------------------------------------------------------------------- /xbm/headphone.xbm: -------------------------------------------------------------------------------- 1 | #define headphone1_new_width 12 2 | #define headphone1_new_height 12 3 | static unsigned char headphone1_new_bits[] = { 4 | 0x00, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x08, 0x01, 0x04, 0x02, 0x04, 0x02, 5 | 0x04, 0x02, 0x9c, 0x03, 0x9c, 0x03, 0x98, 0x01, 0x00, 0x00, 0x00, 0x00 }; 6 | -------------------------------------------------------------------------------- /xbm/mail.xbm: -------------------------------------------------------------------------------- 1 | #define mail_width 15 2 | #define mail_height 15 3 | static unsigned char mail_bits[] = { 4 | 0x00, 0x00, 0x00, 0x00, 0xfe, 0x3f, 0x06, 0x30, 0x0e, 0x38, 0x1a, 0x2c, 5 | 0x32, 0x26, 0xc2, 0x21, 0x82, 0x20, 0x02, 0x20, 0x02, 0x20, 0xfe, 0x3f, 6 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; 7 | -------------------------------------------------------------------------------- /xbm/memory.xbm: -------------------------------------------------------------------------------- 1 | #define memory_width 16 2 | #define memory_height 16 3 | static unsigned char memory_bits[] = { 4 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x12, 0x48, 0x12, 0xfc, 0x3f, 5 | 0xfc, 0x3f, 0xfc, 0x3f, 0xfc, 0x3f, 0xfc, 0x3f, 0xfc, 0x3f, 0x48, 0x12, 6 | 0x48, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; 7 | -------------------------------------------------------------------------------- /xbm/mpd.xbm: -------------------------------------------------------------------------------- 1 | #define mpd_width 16 2 | #define mpd_height 16 3 | static unsigned char mpd_bits[] = { 4 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x1f, 0x40, 0x10, 5 | 0x40, 0x10, 0x40, 0x10, 0x40, 0x10, 0x40, 0x10, 0x70, 0x1c, 0x78, 0x1e, 6 | 0x30, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; 7 | -------------------------------------------------------------------------------- /xbm/ping.xbm: -------------------------------------------------------------------------------- 1 | #define ping_width 16 2 | #define ping_height 16 3 | static unsigned char ping_bits[] = { 4 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x98, 0x0f, 0x30, 0x08, 5 | 0x60, 0x08, 0xe0, 0x08, 0xc0, 0x09, 0xe0, 0x03, 0x70, 0x07, 0x38, 0x0c, 6 | 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; 7 | -------------------------------------------------------------------------------- /xbm/temp.xbm: -------------------------------------------------------------------------------- 1 | #define temp_width 16 2 | #define temp_height 16 3 | static unsigned char temp_bits[] = { 4 | 0x00, 0x00, 0x80, 0x01, 0xc0, 0x0b, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x0b, 5 | 0x40, 0x02, 0x40, 0x02, 0x40, 0x0a, 0x40, 0x02, 0x40, 0x02, 0x60, 0x06, 6 | 0x20, 0x04, 0x60, 0x06, 0xc0, 0x03, 0x00, 0x00 }; 7 | -------------------------------------------------------------------------------- /xbm/up.xbm: -------------------------------------------------------------------------------- 1 | #define up_width 12 2 | #define up_height 12 3 | static unsigned char up_bits[] = { 4 | 0x00, 0x00, 0x40, 0x00, 0xe0, 0x00, 0xf0, 0x01, 0xf8, 0x03, 0xe0, 0x00, 5 | 0xe0, 0x00, 0xe0, 0x00, 0xe0, 0x00, 0xe0, 0x00, 0xe0, 0x00, 0x00, 0x00 }; 6 | -------------------------------------------------------------------------------- /xbm/volume-mute.xbm: -------------------------------------------------------------------------------- 1 | #define volume_mute_width 16 2 | #define volume_mute_height 16 3 | static unsigned char volume_mute_bits[] = { 4 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x01, 0xc0, 0x01, 0xfc, 0x01, 5 | 0xfc, 0x01, 0xfc, 0x29, 0xfc, 0x11, 0xfc, 0x29, 0xfc, 0x01, 0xc0, 0x01, 6 | 0x80, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00 }; 7 | -------------------------------------------------------------------------------- /xbm/volume.xbm: -------------------------------------------------------------------------------- 1 | #define volume_width 16 2 | #define volume_height 16 3 | static unsigned char volume_bits[] = { 4 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x80, 0x21, 0xc0, 0x49, 0xfc, 0x51, 5 | 0xfc, 0x55, 0xfc, 0x55, 0xfc, 0x55, 0xfc, 0x55, 0xfc, 0x51, 0xc0, 0x49, 6 | 0x80, 0x21, 0x00, 0x11, 0x00, 0x00, 0x00, 0x00 }; 7 | -------------------------------------------------------------------------------- /xbm/weather.xbm: -------------------------------------------------------------------------------- 1 | #define weather_width 16 2 | #define weather_height 16 3 | static unsigned char weather_bits[] = { 4 | 0x00, 0x00, 0xfe, 0x7f, 0x02, 0x40, 0x02, 0x40, 0x02, 0x40, 0x02, 0x40, 5 | 0x02, 0x44, 0x02, 0x4a, 0x02, 0x71, 0x8e, 0x40, 0x52, 0x40, 0x22, 0x40, 6 | 0x02, 0x40, 0x02, 0x40, 0xfe, 0x7f, 0x00, 0x00 }; 7 | -------------------------------------------------------------------------------- /xbm/wired.xbm: -------------------------------------------------------------------------------- 1 | #define wired_width 16 2 | #define wired_height 16 3 | static unsigned char wired_bits[] = { 4 | 0x00, 0x00, 0xfe, 0x7f, 0x02, 0x40, 0x02, 0x40, 0xc2, 0x43, 0xc2, 0x43, 5 | 0xc2, 0x43, 0xf2, 0x4f, 0xf2, 0x4f, 0xf2, 0x4f, 0xf2, 0x4f, 0xf2, 0x4f, 6 | 0x02, 0x40, 0x02, 0x40, 0xfe, 0x7f, 0x00, 0x00 }; 7 | -------------------------------------------------------------------------------- /xbm/wireless.xbm: -------------------------------------------------------------------------------- 1 | #define wireless_width 16 2 | #define wireless_height 16 3 | static unsigned char wireless_bits[] = { 4 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x10, 0x00, 0x12, 0x00, 0x12, 5 | 0x40, 0x12, 0x40, 0x12, 0x48, 0x12, 0x48, 0x12, 0x48, 0x12, 0x40, 0x12, 6 | 0x00, 0x12, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00 }; 7 | --------------------------------------------------------------------------------