From f0cff41068a5220e3cb21ee5a9de4c2aca3b8c4e Mon Sep 17 00:00:00 2001 From: Valentin Gehrke Date: Sun, 11 Oct 2015 16:10:56 +0200 Subject: [PATCH] Modified bar --- bspwm/.config/bspwm/bspwmrc | 2 +- bspwm/.config/scripts/bar.sh | 48 +++++++++++------------- bspwm/.config/scripts/barinfo.sh | 64 -------------------------------- 3 files changed, 23 insertions(+), 91 deletions(-) delete mode 100755 bspwm/.config/scripts/barinfo.sh diff --git a/bspwm/.config/bspwm/bspwmrc b/bspwm/.config/bspwm/bspwmrc index c60ba0d..93fa4db 100755 --- a/bspwm/.config/bspwm/bspwmrc +++ b/bspwm/.config/bspwm/bspwmrc @@ -9,7 +9,7 @@ bspc monitor $EXTERN -d 1 2 3 4 5 6 7 8 9 bspc control --adopt-orphans bspc config border_width 1 -bspc config -m $INTERN top_padding 14 +bspc config -m $INTERN top_padding 16 bspc config window_gap 2 bspc config split_ratio 0.5 bspc config borderless_monocle true diff --git a/bspwm/.config/scripts/bar.sh b/bspwm/.config/scripts/bar.sh index 3c8e2fd..623efd2 100755 --- a/bspwm/.config/scripts/bar.sh +++ b/bspwm/.config/scripts/bar.sh @@ -2,7 +2,7 @@ FIFO="/tmp/bar.fifo" -FORMAT=" %(music)s %(services)s %(diskspace)s %%{c} %(debug)s %%{r} %(updates)s %(wifi)s %(battery)s %(clock)s " +FORMAT=" %(music)s %(services)s %(diskspace)s %%{c} %(debug)s %%{r} %(updates)s %(wifi)s %(batterysymbol)s %(battery)s %(clock)s " icon_color="#AAAAAA" icon() { echo -n "%{F$icon_color}"; printf '%b' "\ue$1"; echo -n "%{F-}"; } @@ -24,13 +24,13 @@ color_battery_low="#C37561" music() { while true; do - info=$(mpc current -f '[%title%]') + info=$(mpc current -f '[%artist%] - [%title%]') icon=$icon_music if [ -n "$info" ]; then if [ -n "$(mpc status | grep paused)" ]; then icon=$icon_music_paused fi - echo music "%{A:I music 20:}$icon $info%{A}" > $FIFO; + echo music "$icon $info" > $FIFO; else echo music "$icon (-)" > $FIFO; fi @@ -61,7 +61,7 @@ services() { diskspace() { while true; do info=$(df -h / | awk '{if($6 == "/") { print $5 }}') - echo diskspace "%{A:I filesystem 30:}$icon_diskspace $info%{A}" > $FIFO; + echo diskspace "$icon_diskspace $info" > $FIFO; sleep 20; done; @@ -73,7 +73,7 @@ wifi() { if [ -z "$info" ]; then info="(-)" fi - echo wifi "%{A:I network 1061:}$icon_wifi $info%{A}" > $FIFO; + echo wifi "$icon_wifi $info" > $FIFO; sleep 1; done; @@ -88,26 +88,32 @@ battery() { info="%{F$color_battery_low}$level%%{F-}" fi - icon=$icon_battery - if [ -n "$(acpi -a | grep on-line )" ]; then - icon=$icon_battery_charging - fi - - echo battery "%{A:I battery 1061:}$icon $info%{A}" > $FIFO + echo battery "$info" > $FIFO sleep 2m; done; } +batterysymbol() { + while true; do + icon=$icon_battery + [ -n "$(acpi -a | grep on-line)" ] && icon=$icon_battery_charging + + echo batterysymbol "$icon" > $FIFO + + sleep 5; + done +} + clock() { while true; do - info=$(date +"%H:%M") + info=$(date +"%d.%m. %H:%M") #Bad hack: convert to int to remove leading 0s seconds_to_wait=$[ 61 - $(date +"%S" | awk '{print int($0)}') ]; if [ "$seconds_to_wait" -gt 10 ]; then seconds_to_wait=10 fi - echo clock "%{A:I "clock 1061":}$icon_clock $info%{A}" > $FIFO; + echo clock "$icon_clock $info" > $FIFO; sleep $seconds_to_wait done; @@ -128,7 +134,7 @@ updates() { while true; do internet=$(wicd-cli --status | grep Connected) - if [ -z "internet" ]; then + if [ -z "$internet" ]; then if [ -z "$pac" ]; then pac=? fi @@ -149,17 +155,6 @@ updates() { done } -run_handler() { - while read type param; do - case $type in - I) - ./barinfo.sh kill - ./barinfo.sh $param & - ;; - esac - done -} - cd $(dirname $0) #Trap magic @@ -172,12 +167,13 @@ mkfifo $FIFO #start workers clock & battery & +batterysymbol & music & services & diskspace & wifi & updates & -( while true; do cat $FIFO; done ) | python ./barformatter.py "$FORMAT" | lemonbar -g 1366x15 -f "Stlarch:size=6:style=regular" -f "Terminus:size=8" -B "#88000000" | run_handler +( while true; do cat $FIFO; done ) | python ./barformatter.py "$FORMAT" | lemonbar -g 1366x16 -f "Stlarch:size=6:style=regular" -f "Inconsolata:size=8" -B "#88000000" exit 0 diff --git a/bspwm/.config/scripts/barinfo.sh b/bspwm/.config/scripts/barinfo.sh deleted file mode 100755 index 5f9de1d..0000000 --- a/bspwm/.config/scripts/barinfo.sh +++ /dev/null @@ -1,64 +0,0 @@ -#!/bin/bash - -HEADER_COLOR="#A0A57E" - -header(){ - echo "%{F$HEADER_COLOR}$1%{F-}" -} - -tag() { - echo -n "%{F#HEADER_COLOR}$1:${F-}%{r}" -} - -### Filesystem info - -filesystem() { - header "Diskspace" - for d in / /boot; do - df -h $d | tail -n 1 | awk '{printf "%-15s%10s%10s/%s\n",$6, $5, $3, $2}' - done -} - -### Network info -network() { - header "Network" - wicd-cli --status -} - -### Music info -music() { - header "Music" - #mpc current -f "$(header Artist:) %artist%\n$(header Album:) %album%\n$(header Title:) %title%" - tag "Artist"; mpc current -f "%artist%" - tag "Album"; mpc current -f "%album%" - tag "Title"; mpc current -f "%title%" -} - -### Battery info -battery() { - header "Battery" - acpi -abt -} - -### Clock info -clock() { - header "Clock" - date +"%A %d.%m.%Y" - date +"$(header KW:) %V" -} - -### RUN CODE - -if [ "$1" == "kill" ]; then - pkill popup - exit 0 -fi - -if [ $# -lt 2 ]; then - echo "$0 : Run bar" - echo "$0 kill: Kill bar" - exit 1 -fi - -$1 | popup -g 300x10+$2+20 -B "#88000000" -