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
|
do
|
||||||
echo "U"$(checkupdates | wc -l)
|
echo "U"$(checkupdates | wc -l)
|
||||||
sleep 3600
|
sleep 3600
|
||||||
done > "$PANEL_FIFO" &
|
done
|
||||||
|
|
|
@ -1,7 +1,19 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
while :
|
muted="\ue202"
|
||||||
do
|
speaker="\ue203"
|
||||||
echo "V$(volume.sh)" > "$PANEL_FIFO" &
|
|
||||||
sleep 3
|
data=$(amixer get Master)
|
||||||
done > "$PANEL_FIFO" &
|
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
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
wifioff="\ue21a"
|
||||||
|
wifi0="\ue25d"
|
||||||
|
wifi1="\ue25e"
|
||||||
|
wifi2="\ue25f"
|
||||||
|
wifi3="\ue260"
|
||||||
|
wifi4="\ue261"
|
||||||
|
|
||||||
while :
|
while :
|
||||||
do
|
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
|
sleep 5
|
||||||
done > "$PANEL_FIFO" &
|
done
|
||||||
|
|
|
@ -1,34 +1,37 @@
|
||||||
#!/usr/bin/env dash
|
#!/usr/bin/env dash
|
||||||
|
|
||||||
# Quit if already running
|
# trap "trap - TERM; kill 0" INT TERM QUIT EXIT
|
||||||
if [ $(pgrep -cx "$(basename $0)") -gt 1 ]
|
|
||||||
then
|
|
||||||
echo "Lemonbar already running"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
#
|
||||||
|
PANEL_FIFO=/tmp/panel-fifo
|
||||||
PWD=$(dirname $0)
|
PWD=$(dirname $0)
|
||||||
|
THEME="hax"
|
||||||
|
LEMONBAR="$(pgrep -cx lemonbar)"
|
||||||
|
|
||||||
. $PWD/scripts/config.sh
|
. $PWD/themes/$THEME.sh
|
||||||
|
|
||||||
trap 'trap - TERM; kill 0' INT TERM QUIT EXIT
|
if [ "$#" -eq 0 ]; then
|
||||||
|
|
||||||
# Bootstrap
|
|
||||||
[ -e "$PANEL_FIFO" ] && rm "$PANEL_FIFO"
|
[ -e "$PANEL_FIFO" ] && rm "$PANEL_FIFO"
|
||||||
mkfifo "$PANEL_FIFO"
|
mkfifo "$PANEL_FIFO"
|
||||||
|
|
||||||
#
|
if [ "$LEMONBAR" -gt 0 ]
|
||||||
bspc config top_padding $(( $PANEL_HEIGHT - 2 ))
|
then
|
||||||
bspc subscribe report > "$PANEL_FIFO" &
|
echo "Lemonbar already running"
|
||||||
clock -sf 'T%A, %b %d::%I:%M %p' > "$PANEL_FIFO" &
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Load all lemons (components)
|
||||||
for comp in $PWD/lemons/*.sh
|
for comp in $PWD/lemons/*.sh
|
||||||
do
|
do
|
||||||
echo "INIT: $(basename $comp)"
|
echo "INIT: $(basename $comp)"
|
||||||
. "$comp"
|
. "$comp" > "$PANEL_FIFO" &
|
||||||
done
|
done
|
||||||
|
|
||||||
$PWD/scripts/parse.sh < "$PANEL_FIFO" | \
|
#
|
||||||
|
# Bootstrap panel(s)
|
||||||
|
#
|
||||||
|
|
||||||
|
$PWD/panel_parse.sh $THEME < "$PANEL_FIFO" | \
|
||||||
lemonbar \
|
lemonbar \
|
||||||
-a 32 \
|
-a 32 \
|
||||||
-g x$PANEL_HEIGHT \
|
-g x$PANEL_HEIGHT \
|
||||||
|
@ -39,3 +42,11 @@ $PWD/scripts/parse.sh < "$PANEL_FIFO" | \
|
||||||
| sh &
|
| 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
|
#!/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
|
declare -A ICONS
|
||||||
ICONS[desktop]='\ue1d7'
|
ICONS[desktop]="\ue1d7"
|
||||||
ICONS[code]='\ue1ec'
|
ICONS[code]="\ue1ec"
|
||||||
ICONS[art]='\ue1c7'
|
ICONS[art]="\ue1c7"
|
||||||
ICONS[web]='\ue26d'
|
ICONS[web]="\ue26d"
|
||||||
ICONS[chat]='\ue19f'
|
ICONS[chat]="\ue19f"
|
||||||
ICONS[file]='\ue1e1'
|
ICONS[file]="\ue1e1"
|
||||||
ICONS[music]='\ue1a6'
|
ICONS[music]="\ue1a6"
|
||||||
ICONS[misc]='\ue140'
|
ICONS[misc]="\ue140"
|
||||||
|
|
||||||
|
num_mon=$(bspc query -M | wc -l)
|
||||||
while read -r line
|
while read -r line
|
||||||
do
|
do
|
||||||
data="${line#?}"
|
data="${line#?}"
|
||||||
|
@ -21,23 +22,11 @@ do
|
||||||
E*) # TODO ethernet
|
E*) # TODO ethernet
|
||||||
;;
|
;;
|
||||||
T*) # clock output
|
T*) # clock output
|
||||||
date=" \ue267 ${data%::*} "
|
date=" ${data%::*} "
|
||||||
clock=" \ue016 ${data#*::} "
|
clock=" ${data#*::} "
|
||||||
;;
|
;;
|
||||||
I*) # wifi
|
I*) # wifi
|
||||||
if [[ $data ]]
|
wifi=" $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
|
|
||||||
;;
|
;;
|
||||||
M*) # TODO mail
|
M*) # TODO mail
|
||||||
mail=" \ue1a8 2 "
|
mail=" \ue1a8 2 "
|
||||||
|
@ -55,7 +44,7 @@ do
|
||||||
while [[ $# > 0 ]]
|
while [[ $# > 0 ]]
|
||||||
do
|
do
|
||||||
id=$1
|
id=$1
|
||||||
name=${id#??}
|
name=${id#???}
|
||||||
case $id in
|
case $id in
|
||||||
[mM]*)
|
[mM]*)
|
||||||
[[ $num_mon < 2 ]] && shift && continue
|
[[ $num_mon < 2 ]] && shift && continue
|
||||||
|
@ -108,14 +97,7 @@ do
|
||||||
updates=" \ue00f $data updates "
|
updates=" \ue00f $data updates "
|
||||||
;;
|
;;
|
||||||
V*) # volume
|
V*) # volume
|
||||||
case "$data" in
|
vol="$data"
|
||||||
0|off)
|
|
||||||
vol="%{F$COLOR_FREE_FG}\ue202%{F-}"
|
|
||||||
;;
|
|
||||||
*) vol="\ue203"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
vol="%{A:volume.sh toggle:} $vol %{A}"
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
echo -e "%{l}${wm}${playing}%{r}${mail} ${wifi} ${date} ${clock} ${bt}${vol}"
|
echo -e "%{l}${wm}${playing}%{r}${mail} ${wifi} ${date} ${clock} ${bt}${vol}"
|
|
@ -1,7 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
PANEL_HEIGHT=24
|
PANEL_HEIGHT=24
|
||||||
PANEL_FIFO=/tmp/panel-fifo
|
|
||||||
PANEL_FONT="gohufont:size=11:antialias=false"
|
PANEL_FONT="gohufont:size=11:antialias=false"
|
||||||
ICON_FONT="siji:size=9: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