Modified bar

This commit is contained in:
madmaurice 2015-10-11 16:10:56 +02:00
parent 28a456c0e6
commit f0cff41068
3 changed files with 23 additions and 91 deletions

View file

@ -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

View file

@ -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

View file

@ -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 <display> <x>: Run bar"
echo "$0 kill: Kill bar"
exit 1
fi
$1 | popup -g 300x10+$2+20 -B "#88000000"