Rewrite lemonbar config
This commit is contained in:
parent
1bc46b484a
commit
294594421b
3
os/arch/.config/panel/lemons/bspwm.sh
Executable file
3
os/arch/.config/panel/lemons/bspwm.sh
Executable file
|
@ -0,0 +1,3 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
bspc subscribe report > "$PANEL_FIFO" &
|
6
os/arch/.config/panel/lemons/datetime.sh
Executable file
6
os/arch/.config/panel/lemons/datetime.sh
Executable file
|
@ -0,0 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
date_icon="\ue267"
|
||||
clock_icon="\ue016"
|
||||
|
||||
clock -sf "T${date_icon} %A, %b %d::${clock_icon} %I:%M %p"
|
|
@ -4,4 +4,4 @@ while :
|
|||
do
|
||||
echo "U"$(checkupdates | wc -l)
|
||||
sleep 3600
|
||||
done > "$PANEL_FIFO" &
|
||||
done
|
||||
|
|
|
@ -1,7 +1,19 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
while :
|
||||
do
|
||||
echo "V$(volume.sh)" > "$PANEL_FIFO" &
|
||||
sleep 3
|
||||
done > "$PANEL_FIFO" &
|
||||
muted="\ue202"
|
||||
speaker="\ue203"
|
||||
|
||||
data=$(amixer get Master)
|
||||
vol=0
|
||||
if echo "$data" | grep '\[on\]' >/dev/null
|
||||
then
|
||||
vol=$(echo "$data" | sed -n 's/^.*\[\([0-9]\+\)%.*$/\1/p' | uniq)
|
||||
fi
|
||||
|
||||
case "$vol" in
|
||||
0) text="%{F$COLOR_FREE_FG}${muted}%{F-}"
|
||||
;;
|
||||
*) text="${speaker} ${vol}%"
|
||||
;;
|
||||
esac
|
||||
echo "V%{A:volume.sh toggle:} ${text} %{A}"
|
||||
|
|
|
@ -1,7 +1,27 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
wifioff="\ue21a"
|
||||
wifi0="\ue25d"
|
||||
wifi1="\ue25e"
|
||||
wifi2="\ue25f"
|
||||
wifi3="\ue260"
|
||||
wifi4="\ue261"
|
||||
|
||||
while :
|
||||
do
|
||||
echo "I"$(awk 'NR==3 {print $3}' /proc/net/wireless)
|
||||
signal=$(awk 'NR==3 {print $3}' /proc/net/wireless)
|
||||
if [ -n "$signal" ]
|
||||
then
|
||||
icon=$wifi0
|
||||
case "$signal" in
|
||||
100|[6-9][0-9]*) icon=$wifi4 ;;
|
||||
[4-5][0-9]*) icon=$wifi3 ;;
|
||||
[2-3][0-9]*) icon=$wifi2 ;;
|
||||
*) icon=$wifi1 ;;
|
||||
esac
|
||||
echo "I$icon $(iwgetid -r)"
|
||||
else
|
||||
echo "I%{F$COLOR_FREE_FG}${wifioff}%{F-} "
|
||||
fi
|
||||
sleep 5
|
||||
done > "$PANEL_FIFO" &
|
||||
done
|
||||
|
|
|
@ -1,34 +1,37 @@
|
|||
#!/usr/bin/env dash
|
||||
|
||||
# Quit if already running
|
||||
if [ $(pgrep -cx "$(basename $0)") -gt 1 ]
|
||||
then
|
||||
echo "Lemonbar already running"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
PWD=$(dirname $0)
|
||||
|
||||
. $PWD/scripts/config.sh
|
||||
|
||||
trap 'trap - TERM; kill 0' INT TERM QUIT EXIT
|
||||
|
||||
# Bootstrap
|
||||
[ -e "$PANEL_FIFO" ] && rm "$PANEL_FIFO"
|
||||
mkfifo "$PANEL_FIFO"
|
||||
# trap "trap - TERM; kill 0" INT TERM QUIT EXIT
|
||||
|
||||
#
|
||||
bspc config top_padding $(( $PANEL_HEIGHT - 2 ))
|
||||
bspc subscribe report > "$PANEL_FIFO" &
|
||||
clock -sf 'T%A, %b %d::%I:%M %p' > "$PANEL_FIFO" &
|
||||
PANEL_FIFO=/tmp/panel-fifo
|
||||
PWD=$(dirname $0)
|
||||
THEME="hax"
|
||||
LEMONBAR="$(pgrep -cx lemonbar)"
|
||||
|
||||
for comp in $PWD/lemons/*.sh
|
||||
do
|
||||
. $PWD/themes/$THEME.sh
|
||||
|
||||
if [ "$#" -eq 0 ]; then
|
||||
[ -e "$PANEL_FIFO" ] && rm "$PANEL_FIFO"
|
||||
mkfifo "$PANEL_FIFO"
|
||||
|
||||
if [ "$LEMONBAR" -gt 0 ]
|
||||
then
|
||||
echo "Lemonbar already running"
|
||||
exit
|
||||
fi
|
||||
|
||||
# Load all lemons (components)
|
||||
for comp in $PWD/lemons/*.sh
|
||||
do
|
||||
echo "INIT: $(basename $comp)"
|
||||
. "$comp"
|
||||
done
|
||||
. "$comp" > "$PANEL_FIFO" &
|
||||
done
|
||||
|
||||
$PWD/scripts/parse.sh < "$PANEL_FIFO" | \
|
||||
#
|
||||
# Bootstrap panel(s)
|
||||
#
|
||||
|
||||
$PWD/panel_parse.sh $THEME < "$PANEL_FIFO" | \
|
||||
lemonbar \
|
||||
-a 32 \
|
||||
-g x$PANEL_HEIGHT \
|
||||
|
@ -38,4 +41,12 @@ $PWD/scripts/parse.sh < "$PANEL_FIFO" | \
|
|||
-B "$COLOR_DEFAULT_BG" \
|
||||
| sh &
|
||||
|
||||
wait
|
||||
wait
|
||||
elif [ -e "$PANEL_FIFO" ] && [ "$LEMONBAR" -gt 0 ]
|
||||
then
|
||||
if [ -f "$PWD/lemons/$1.sh" ]
|
||||
then
|
||||
. "$PWD/lemons/$1.sh" > "$PANEL_FIFO" &
|
||||
fi
|
||||
fi
|
||||
|
||||
|
|
|
@ -1,19 +1,20 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
. $(dirname $0)/config.sh
|
||||
theme="$1"
|
||||
|
||||
num_mon=$(bspc query -M | wc -l)
|
||||
. $(dirname $0)/themes/${theme}.sh
|
||||
|
||||
declare -A ICONS
|
||||
ICONS[desktop]='\ue1d7'
|
||||
ICONS[code]='\ue1ec'
|
||||
ICONS[art]='\ue1c7'
|
||||
ICONS[web]='\ue26d'
|
||||
ICONS[chat]='\ue19f'
|
||||
ICONS[file]='\ue1e1'
|
||||
ICONS[music]='\ue1a6'
|
||||
ICONS[misc]='\ue140'
|
||||
ICONS[desktop]="\ue1d7"
|
||||
ICONS[code]="\ue1ec"
|
||||
ICONS[art]="\ue1c7"
|
||||
ICONS[web]="\ue26d"
|
||||
ICONS[chat]="\ue19f"
|
||||
ICONS[file]="\ue1e1"
|
||||
ICONS[music]="\ue1a6"
|
||||
ICONS[misc]="\ue140"
|
||||
|
||||
num_mon=$(bspc query -M | wc -l)
|
||||
while read -r line
|
||||
do
|
||||
data="${line#?}"
|
||||
|
@ -21,23 +22,11 @@ do
|
|||
E*) # TODO ethernet
|
||||
;;
|
||||
T*) # clock output
|
||||
date=" \ue267 ${data%::*} "
|
||||
clock=" \ue016 ${data#*::} "
|
||||
date=" ${data%::*} "
|
||||
clock=" ${data#*::} "
|
||||
;;
|
||||
I*) # wifi
|
||||
if [[ $data ]]
|
||||
then
|
||||
signal="\ue25d"
|
||||
case "$data" in
|
||||
100|[6-9][0-9]*) signal="\ue261" ;;
|
||||
[4-5][0-9]*) signal="\ue260" ;;
|
||||
[2-3][0-9]*) signal="\ue25f" ;;
|
||||
*) signal="\ue25e" ;;
|
||||
esac
|
||||
wifi=" $signal $(iwgetid -r) "
|
||||
else
|
||||
wifi=" %{F$COLOR_FREE_FG}\ue21a%{F-} "
|
||||
fi
|
||||
wifi=" $data "
|
||||
;;
|
||||
M*) # TODO mail
|
||||
mail=" \ue1a8 2 "
|
||||
|
@ -55,7 +44,7 @@ do
|
|||
while [[ $# > 0 ]]
|
||||
do
|
||||
id=$1
|
||||
name=${id#??}
|
||||
name=${id#???}
|
||||
case $id in
|
||||
[mM]*)
|
||||
[[ $num_mon < 2 ]] && shift && continue
|
||||
|
@ -108,14 +97,7 @@ do
|
|||
updates=" \ue00f $data updates "
|
||||
;;
|
||||
V*) # volume
|
||||
case "$data" in
|
||||
0|off)
|
||||
vol="%{F$COLOR_FREE_FG}\ue202%{F-}"
|
||||
;;
|
||||
*) vol="\ue203"
|
||||
;;
|
||||
esac
|
||||
vol="%{A:volume.sh toggle:} $vol %{A}"
|
||||
vol="$data"
|
||||
;;
|
||||
esac
|
||||
echo -e "%{l}${wm}${playing}%{r}${mail} ${wifi} ${date} ${clock} ${bt}${vol}"
|
|
@ -1,7 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
PANEL_HEIGHT=24
|
||||
PANEL_FIFO=/tmp/panel-fifo
|
||||
PANEL_FONT="gohufont:size=11:antialias=false"
|
||||
ICON_FONT="siji:size=9:antialias=false"
|
||||
|
0
os/arch/.config/panel/tst
Normal file
0
os/arch/.config/panel/tst
Normal file
Loading…
Reference in a new issue