This commit is contained in:
kento2 2026-02-02 23:36:49 +01:00
parent e9ea8df013
commit 15044d4e1b
4 changed files with 11 additions and 23 deletions

View file

@ -10,24 +10,12 @@ fg="#a39ef1" # foreground colour
hi="#00aaaa" # highlight colour hi="#00aaaa" # highlight colour
ul=2 # underline thickness ul=2 # underline thickness
sep="┃" # separator text sep="┃" # separator text
font="-xos4-terminus-medium-r-normal--12-240-72-72-c-120-iso10646-1"
fifo="/tmp/bar.fifo" fifo="/tmp/bar.fifo"
font="Iosevka:size=11"
# 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
clock() clock()
{ {
date +"T %a %H:%M $sep" date +"T %a %H:%M "
# sync up the clock to the minute mark # sync up the clock to the minute mark
min=$(date +"%M") min=$(date +"%M")
@ -36,7 +24,7 @@ clock()
done done
while :; do while :; do
date +"T %a %H:%M $sep" date +"T %a %H:%M "
sleep 60 sleep 60
done done
} }
@ -45,7 +33,7 @@ battery()
{ {
while :; do while :; do
perc="$(cat /sys/class/power_supply/BAT0/capacity)" perc="$(cat /sys/class/power_supply/BAT0/capacity)"
printf 'B Bat: %s%%%s\n' " ${perc}" echo "B bat: ${perc}%"
sleep 60 sleep 60
done done
} }
@ -53,7 +41,7 @@ battery()
volume() volume()
{ {
vol="$(amixer sget Master | awk -F"[][]" '/(Mono|Left):/ { print $2 }')" vol="$(amixer sget Master | awk -F"[][]" '/(Mono|Left):/ { print $2 }')"
printf 'V vol: %s%%\n' "$vol" echo "V vol: ${vol}"
} }
workspaces() workspaces()
@ -73,7 +61,6 @@ workspaces()
if $focused; then if $focused; then
# clicking the layout symbol will cycle the layout # clicking the layout symbol will cycle the layout
lyt="%{A:dkcmd set layout cycle:}${layouts[$layout]}%{A}" lyt="%{A:dkcmd set layout cycle:}${layouts[$layout]}%{A}"
WIN="${title:0:50}"
f="$hi" f="$hi"
fi fi
# clicking on a workspace name will view it # 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, # 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 # 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') 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() parsefifo()
{ {
# globals to simplify the workspaces call # globals to simplify the workspaces call
declare -g WS WIN declare -g WS
local time vol bat net local time vol bat net
@ -100,7 +87,7 @@ parsefifo()
N*) net="${line#?}" ;; N*) net="${line#?}" ;;
'{'*) workspaces "$line" ;; '{'*) workspaces "$line" ;;
esac esac
printf "%s\n" "%{l}$sep ${WS}%{c}${WIN}%{r}${net}${bat}${vol}${time}" echo "%{l} ${WS}%{c}${time}%{r}${bat}${vol} "
done done
} }

View file

@ -7,5 +7,5 @@ d="$(date -I)"
grep "$d" "$JOURNAL" || printf "%s\n" "$d" > "$tmp" grep "$d" "$JOURNAL" || printf "%s\n" "$d" > "$tmp"
nvi "$tmp" nvi "$tmp"
(printf "\n"; cat "$tmp" | tee -a "$JOURNAL") && rm "$tmp"
tail "$JOURNAL" tail "$JOURNAL"
(printf "\n"; cat "$tmp" | tee -a "$JOURNAL") && rm "$tmp"

View file

@ -1,5 +1,5 @@
export ENV="$HOME/.shrc" export ENV="$HOME/.shrc"
export PATH="$HOME/.local/bin/":"$PATH" export PATH="$HOME/.local/bin":"$PATH"
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/:/usr/lib/pkgconfig export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/:/usr/lib/pkgconfig
export XKB_DEFAULT_LAYOUT=de export XKB_DEFAULT_LAYOUT=de
export XBPS_DISTDIR="$HOME/void-packages" export XBPS_DISTDIR="$HOME/void-packages"

View file

@ -13,6 +13,7 @@ fzy
gcc gcc
grub-x86_64-efi grub-x86_64-efi
keyd keyd
lemonbar-xft
libdrm-devel libdrm-devel
libinput-devel libinput-devel
libxkbcommon-devel libxkbcommon-devel