.
This commit is contained in:
parent
e9ea8df013
commit
15044d4e1b
4 changed files with 11 additions and 23 deletions
|
|
@ -10,24 +10,12 @@ fg="#a39ef1" # foreground colour
|
|||
hi="#00aaaa" # highlight colour
|
||||
ul=2 # underline thickness
|
||||
sep="┃" # separator text
|
||||
font="-xos4-terminus-medium-r-normal--12-240-72-72-c-120-iso10646-1"
|
||||
fifo="/tmp/bar.fifo"
|
||||
|
||||
# adjust font size based on resolution DPI
|
||||
px=$(xrandr | grep ' connected' | tail -n1 | grep -o '[0-9]\+x[0-9]\+' | cut -d'x' -f2)
|
||||
mm=$(xrandr | grep ' connected' | tail -n1 | grep -o '[0-9]\+mm' | tail -n1 | sed 's/mm//')
|
||||
dpi=$(( (px / mm) * 25 ))
|
||||
if (( dpi >= 140 )); then
|
||||
font="-xos4-terminus-medium-r-normal--20-240-72-72-c-120-iso10646-1"
|
||||
elif (( dpi >= 120 )); then
|
||||
font="-xos4-terminus-medium-r-normal--16-240-72-72-c-120-iso10646-1"
|
||||
elif (( dpi >= 100 )); then
|
||||
font="-xos4-terminus-medium-r-normal--12-240-72-72-c-120-iso10646-1"
|
||||
fi
|
||||
font="Iosevka:size=11"
|
||||
|
||||
clock()
|
||||
{
|
||||
date +"T %a %H:%M $sep"
|
||||
date +"T %a %H:%M "
|
||||
|
||||
# sync up the clock to the minute mark
|
||||
min=$(date +"%M")
|
||||
|
|
@ -36,7 +24,7 @@ clock()
|
|||
done
|
||||
|
||||
while :; do
|
||||
date +"T %a %H:%M $sep"
|
||||
date +"T %a %H:%M "
|
||||
sleep 60
|
||||
done
|
||||
}
|
||||
|
|
@ -45,7 +33,7 @@ battery()
|
|||
{
|
||||
while :; do
|
||||
perc="$(cat /sys/class/power_supply/BAT0/capacity)"
|
||||
printf 'B Bat: %s%%%s\n' " ${perc}"
|
||||
echo "B bat: ${perc}%"
|
||||
sleep 60
|
||||
done
|
||||
}
|
||||
|
|
@ -53,7 +41,7 @@ battery()
|
|||
volume()
|
||||
{
|
||||
vol="$(amixer sget Master | awk -F"[][]" '/(Mono|Left):/ { print $2 }')"
|
||||
printf 'V vol: %s%%\n' "$vol"
|
||||
echo "V vol: ${vol}"
|
||||
}
|
||||
|
||||
workspaces()
|
||||
|
|
@ -73,7 +61,6 @@ workspaces()
|
|||
if $focused; then
|
||||
# clicking the layout symbol will cycle the layout
|
||||
lyt="%{A:dkcmd set layout cycle:}${layouts[$layout]}%{A}"
|
||||
WIN="${title:0:50}"
|
||||
f="$hi"
|
||||
fi
|
||||
# clicking on a workspace name will view it
|
||||
|
|
@ -82,13 +69,13 @@ workspaces()
|
|||
# turn the dk JSON output into lines that can be `eval`ed one by one,
|
||||
# filling out the following fields: name, focused, active, layout, title
|
||||
done < <(dkcmd -p <<< "$1" | sed '/.*\[\|]/d; /[{}],\?/d; s/^\s*\|,$//g; /"monitor":\|"number":\|"id":/d; s/"\(.*\)": /\1=/; s/\$(/\\\$(/g; s/`/\\`/g')
|
||||
WS="$WS $sep $lyt"
|
||||
WS="$WS $lyt"
|
||||
}
|
||||
|
||||
parsefifo()
|
||||
{
|
||||
# globals to simplify the workspaces call
|
||||
declare -g WS WIN
|
||||
declare -g WS
|
||||
|
||||
local time vol bat net
|
||||
|
||||
|
|
@ -100,7 +87,7 @@ parsefifo()
|
|||
N*) net="${line#?}" ;;
|
||||
'{'*) workspaces "$line" ;;
|
||||
esac
|
||||
printf "%s\n" "%{l}$sep ${WS}%{c}${WIN}%{r}${net}${bat}${vol}${time}"
|
||||
echo "%{l} ${WS}%{c}${time}%{r}${bat}${vol} "
|
||||
done
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue