dotfiles

configuration files for shell, text editor, graphical environment, etc.
git clone git://src.adamsgaard.dk/dotfiles
Log | Files | Refs | README | LICENSE Back to index

commit 2be2a4708feaff0fac8c94c19fc9acbd5b6af2f1
parent 50fc9890d5685ede4be8637429f346a204ce15f9
Author: Anders Damsgaard <anders.damsgaard@geo.au.dk>
Date:   Tue,  4 Feb 2014 19:22:34 +0100

Added conky to bar, incl. time left on battery, wifi

Diffstat:
M.config/bspwm/bspwmrc | 3+--
A.config/bspwm/panel/panel | 36++++++++++++++++++++++++++++++++++++
Rbin/panel_bar -> .config/bspwm/panel/panel_bar | 0
A.config/bspwm/panel/panel_battery | 64++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Rbin/panel_colors -> .config/bspwm/panel/panel_colors | 0
A.config/bspwm/panel/panel_conky | 10++++++++++
A.config/bspwm/panel/panel_wifi | 33+++++++++++++++++++++++++++++++++
Mbin/install_bspwm.sh | 9++++++++-
Dbin/panel | 35-----------------------------------
9 files changed, 152 insertions(+), 38 deletions(-)

diff --git a/.config/bspwm/bspwmrc b/.config/bspwm/bspwmrc @@ -57,5 +57,4 @@ bspc config rule_command "$(which rule_command)" # Move focus to the primary monitor bspc monitor -f primary -/home/adc/bin/panel & -#/home/adc/.config/bspwm/panel/panel & +/home/adc/.config/bspwm/panel/panel & diff --git a/.config/bspwm/panel/panel b/.config/bspwm/panel/panel @@ -0,0 +1,36 @@ +#!/bin/sh + +if [ $(pgrep -cx panel) -gt 1 ] ; then + printf "%s\n" "The panel is already running." >&2 + exit 1 +fi + +trap 'trap - TERM; kill 0' INT TERM QUIT EXIT + +flavor=${1:-bar} + +[ -e "$PANEL_FIFO" ] && rm "$PANEL_FIFO" +mkfifo "$PANEL_FIFO" + +bspc config top_padding $PANEL_HEIGHT + +bspc control --put-status + +bspc control --subscribe > "$PANEL_FIFO" & +xtitle -sf 'T%s' > "$PANEL_FIFO" & +#clock -sf 'S%Y-%m-%d %H:%M' > "$PANEL_FIFO" & +conky -c ~/.config/bspwm/panel/panel_conky > "$PANEL_FIFO" & + +case "$flavor" in + bar) + cat "$PANEL_FIFO" | ~/.config/bspwm/panel/panel_bar | bar & + ;; + dzen2) + . panel_colors + FONT_FAMILY='DejaVu Sans' + FONT_SIZE=11 + cat "$PANEL_FIFO" | panel_dzen2 -f "$FONT_FAMILY" -s "$FONT_SIZE" | dzen2 -h $PANEL_HEIGHT -dock -ta l -title-name panel -fn "${FONT_FAMILY}:pixelsize=${FONT_SIZE}" -fg "$COLOR_FOREGROUND" -bg "$COLOR_BACKGROUND" & + ;; +esac + +wait diff --git a/bin/panel_bar b/.config/bspwm/panel/panel_bar diff --git a/.config/bspwm/panel/panel_battery b/.config/bspwm/panel/panel_battery @@ -0,0 +1,64 @@ +#!/bin/bash + +# BATTERY ICONS: +#      + +BAT=`acpi -b | awk '{gsub(/%,/,""); print $4}' | sed 's/%//g'` +STATUS=`acpi -b | awk '{gsub(/,/,""); print $3}'` +REMAINING=`acpi -b | awk '{print $5}'` + +# Set Icon +icon="" +if [[ $STATUS != "Discharging" ]]; then + icon="" +elif [[ $BAT -lt 10 ]]; then + icon="" +elif [[ $BAT -lt 40 ]]; then + icon="" +elif [[ $BAT -lt 70 ]]; then + icon="" +else + icon="" +fi + +bar="" +case $BAT in + 100) + bar="" + ;; + [0-5]) + bar="\f8—————————" + ;; + [5-9]) + bar="\f3—\f8————————" + ;; + [1-2]*) + bar="——\f8———————" + ;; + 3*) + bar="———\f8——————" + ;; + 4*) + bar="————\f8—————" + ;; + 5*) + bar="—————\f8————" + ;; + 6*) + bar="——————\f8———" + ;; + 7*) + bar="———————\f8——" + ;; + 8*) + bar="————————\f8—" + ;; + *) + bar="—————————" + ;; +esac + +# Create Bar + +#echo "$icon \f9$bar" +echo "$REMAINING \f9$bar" diff --git a/bin/panel_colors b/.config/bspwm/panel/panel_colors diff --git a/.config/bspwm/panel/panel_conky b/.config/bspwm/panel/panel_conky @@ -0,0 +1,10 @@ +short_units yes +background yes +out_to_console yes +out_to_x no +# Update interval in seconds +update_interval 3 +update_interval_on_battery 3 + +TEXT +S \f8${execi 1 ~/.config/bspwm/panel/panel_wifi} \f9${wireless_essid wlan0} \f8${execi 20 ~/.config/bspwm/panel/panel_battery} \fr${time %Y-%m-%d %H:%M } diff --git a/.config/bspwm/panel/panel_wifi b/.config/bspwm/panel/panel_wifi @@ -0,0 +1,33 @@ +#!/bin/bash + +# WIFI ICONS +#  + +QUAL=`iwconfig wlan0 | grep 'Link Quality=' | awk '{gsub(/[=/]/," "); print $3}'` +MAX=`iwconfig wlan0 | grep 'Link Quality=' | awk '{gsub(/[=/]/," "); print $4}'` +PERC=`echo $QUAL*100/$MAX | bc` + +icon="" +case $PERC in + [0-4]) + icon="" + ;; + [4-9]) + icon="" + ;; + [2-3]*) + icon="" + ;; + [4-5]*) + icon="" + ;; + [6-7]*) + icon="" + ;; + *) + icon="" + ;; +esac + +#echo "$icon" +echo "$PERC" diff --git a/bin/install_bspwm.sh b/bin/install_bspwm.sh @@ -6,7 +6,14 @@ # Debian dependencies sudo apt-get install xcb libxcb-util0-dev libxcb-ewmh-dev libxcb-randr0-dev \ libxcb-icccm4-dev libxcb-keysyms1-dev libxcb-xinerama0-dev xfonts-terminus \ - hsetroot compton unclutter + xfonts-artwiz hsetroot compton unclutter + +# Fonts: search for artwiz-aleczapka fonts, download from sourceforce. +# Extract fonts to /home/adc/.fonts +# Run `sudo rm /etc/fonts/conf.d/70-no-bitmaps.conf +# Clear the font cache: +# sudo fc-cache -f -v +# fc-cache -f -v # Core folder FOLDER=~/code diff --git a/bin/panel b/bin/panel @@ -1,35 +0,0 @@ -#!/bin/sh - -if [ $(pgrep -cx panel) -gt 1 ] ; then - printf "%s\n" "The panel is already running." >&2 - exit 1 -fi - -trap 'trap - TERM; kill 0' INT TERM QUIT EXIT - -flavor=${1:-bar} - -[ -e "$PANEL_FIFO" ] && rm "$PANEL_FIFO" -mkfifo "$PANEL_FIFO" - -bspc config top_padding $PANEL_HEIGHT - -bspc control --put-status - -bspc control --subscribe > "$PANEL_FIFO" & -xtitle -sf 'T%s' > "$PANEL_FIFO" & -clock -sf 'S%Y-%m-%d %H:%M' > "$PANEL_FIFO" & - -case "$flavor" in - bar) - cat "$PANEL_FIFO" | panel_bar | bar & - ;; - dzen2) - . panel_colors - FONT_FAMILY='DejaVu Sans' - FONT_SIZE=11 - cat "$PANEL_FIFO" | panel_dzen2 -f "$FONT_FAMILY" -s "$FONT_SIZE" | dzen2 -h $PANEL_HEIGHT -dock -ta l -title-name panel -fn "${FONT_FAMILY}:pixelsize=${FONT_SIZE}" -fg "$COLOR_FOREGROUND" -bg "$COLOR_BACKGROUND" & - ;; -esac - -wait