Popups mit dzen2 hinzugefügt yay
This commit is contained in:
parent
b6efa6ffd7
commit
66ad0da9c9
2 changed files with 88 additions and 21 deletions
|
@ -1,5 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
cd $(dirname $0)
|
||||||
|
|
||||||
icon_color="#A0A57E"
|
icon_color="#A0A57E"
|
||||||
icon() { echo -n "%{F$icon_color}"; printf '%b' "\ue$1"; echo -n "%{F-}"; }
|
icon() { echo -n "%{F$icon_color}"; printf '%b' "\ue$1"; echo -n "%{F-}"; }
|
||||||
|
|
||||||
|
@ -18,14 +20,16 @@ color_battery_good="white"
|
||||||
color_battery_low="#C37561"
|
color_battery_low="#C37561"
|
||||||
|
|
||||||
music() {
|
music() {
|
||||||
info=$(mpc current -f '[%artist%] - [%title%]')
|
info=$(mpc current -f '[%title%]')
|
||||||
icon=$icon_music
|
icon=$icon_music
|
||||||
if [ -z "$info" ]; then
|
if [ -n "$info" ]; then
|
||||||
info="(-)"
|
if [ -n "$(mpc status | grep paused)" ]; then
|
||||||
elif [ -n "$(mpc status | grep paused)" ]; then
|
icon=$icon_music_paused
|
||||||
icon=$icon_music_paused
|
fi
|
||||||
|
echo -n "%{A:I "music 20":}$icon $info%{A}"
|
||||||
|
else
|
||||||
|
echo -n "$icon (-)"
|
||||||
fi
|
fi
|
||||||
echo -n "$icon $info"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
serviceinfo() {
|
serviceinfo() {
|
||||||
|
@ -44,43 +48,53 @@ services() {
|
||||||
}
|
}
|
||||||
|
|
||||||
diskspace() {
|
diskspace() {
|
||||||
echo -n "$icon_diskspace "
|
info=$(df -h / | awk '{if($6 == "/") { print $5 }}')
|
||||||
df -h | awk '{if($6 == "/") { print $3 " / " $2 }}'
|
echo -n "%{A:I "filesystem 30":}$icon_diskspace $info%{A}"
|
||||||
}
|
}
|
||||||
|
|
||||||
wifi() {
|
wifi() {
|
||||||
echo -n "$icon_wifi "
|
info=$(wicd-cli --wireless --status | perl -e 'foreach $line (<>) { if($line =~ /Connected to (.+) at .+IP: ([0-9.]+)/ ) { print $1; break; } elsif($line =~ /Connecting to wireless network \"(.+)\"/) { print $1 . " - connecting"; break; } }')
|
||||||
info=$(wicd-cli --wireless --status | perl -e 'foreach $line (<>) { if($line =~ /Connected to (.+) at .+IP: ([0-9.]+)/ ) { print $1 . " - " . $2; break; } elsif($line =~ /Connecting to wireless network \"(.+)\"/) { print $1 . " - connecting"; break; } }')
|
|
||||||
if [ -z "$info" ]; then
|
if [ -z "$info" ]; then
|
||||||
info="(-)"
|
info="(-)"
|
||||||
fi
|
fi
|
||||||
echo -n $info
|
echo -n "%{A:I "network 1061":}$icon_wifi $info%{A}"
|
||||||
}
|
}
|
||||||
|
|
||||||
battery() {
|
battery() {
|
||||||
level=$(acpi -b | awk -F, 'BEGIN { s=0 } { s+=$2 } END { print int(s/NR) }')
|
level=$(acpi -b | awk -F, 'BEGIN { s=0 } { s+=$2 } END { print int(s/NR) }')
|
||||||
charging=$(acpi -b | grep Charging)
|
charging=$(acpi -a | grep on-line)
|
||||||
|
|
||||||
|
icon=$icon_battery
|
||||||
if [ -n "$charging" ]; then
|
if [ -n "$charging" ]; then
|
||||||
echo -n "$icon_battery_charging "
|
echo -n "$icon_battery_charging "
|
||||||
else
|
|
||||||
echo -n "$icon_battery "
|
|
||||||
fi
|
fi
|
||||||
|
info="%{F$color_battery_good}$level%%{F-}"
|
||||||
if [ "$level" -lt 20 ]; then
|
if [ "$level" -lt 20 ]; then
|
||||||
echo -n "%{F$color_battery_low}$level%%{F-}"
|
echo -n "%{F$color_battery_low}$level%%{F-}"
|
||||||
else
|
|
||||||
echo -n "%{F$color_battery_good}$level%%{F-}"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo -n "%{A:I "battery 1061":}$icon $info%{A}"
|
||||||
}
|
}
|
||||||
|
|
||||||
clock() {
|
clock() {
|
||||||
echo -n "$icon_clock "
|
info=$(date +"%H:%M")
|
||||||
date +"%a %d.%m (%V) %H:%M"
|
echo -n "%{A:I "clock 1061":}$icon_clock $info%{A}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
run_handler() {
|
||||||
|
while read type param; do
|
||||||
|
case $type in
|
||||||
|
I)
|
||||||
|
pkill dzen2
|
||||||
|
./barinfo.sh $param &
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
echo "%{l} $(music) $(services) $(diskspace)%{r}$(wifi) $(battery) $(clock) "
|
echo "%{l} $(music) $(services) $(diskspace)%{r}$(wifi) $(battery) $(clock) "
|
||||||
sleep 1
|
sleep 1
|
||||||
done | lemonbar -g 1366x15 -f "Terminus:size=8","Stlarch:size=6:style=regular" -B "#88000000"
|
done | lemonbar -g 1366x15 -f "Terminus:size=8","Stlarch:size=6:style=regular" -B "#88000000" | run_handler
|
||||||
|
|
||||||
|
|
||||||
|
|
53
scripts/barinfo.sh
Executable file
53
scripts/barinfo.sh
Executable file
|
@ -0,0 +1,53 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
HEADER_COLOR="#A0A57E"
|
||||||
|
|
||||||
|
header(){
|
||||||
|
echo "^fg($HEADER_COLOR)$1^fg()"
|
||||||
|
}
|
||||||
|
|
||||||
|
### 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%"
|
||||||
|
}
|
||||||
|
|
||||||
|
### Battery info
|
||||||
|
battery() {
|
||||||
|
header "Battery"
|
||||||
|
acpi -abt
|
||||||
|
}
|
||||||
|
|
||||||
|
### Clock info
|
||||||
|
clock() {
|
||||||
|
header "Clock"
|
||||||
|
date +"%A %d.%m.%Y"
|
||||||
|
date +"$(header KW:) %V"
|
||||||
|
}
|
||||||
|
|
||||||
|
### RUN CODE
|
||||||
|
|
||||||
|
if [ $# -lt 2 ]; then
|
||||||
|
echo "$0 <display> <x>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
DATA=`$1`
|
||||||
|
LINES=$[ $(echo "$DATA" | wc -l)-1 ]
|
||||||
|
|
||||||
|
echo "$DATA" | dzen2 -p -e 'onstart=uncollapse;button1=exit' -x "$2" -y 20 -w 300 -l $LINES -ta left
|
Loading…
Reference in a new issue