i can now actually see my battery percentage

main
The_miro 2024-11-28 10:22:27 +01:00
parent e72e03b557
commit b726f61296
4 changed files with 10 additions and 3 deletions

View File

@ -21,6 +21,7 @@
(defwidget winsworks [monitor] (defwidget winsworks [monitor]
(box :orientation "h" :space-evenly false :halign "start" (box :orientation "h" :space-evenly false :halign "start"
(box :class "music" {"󰁹 ${battery}"})
(workspaceWidget :monitor monitor) (workspaceWidget :monitor monitor)
(box :class "music" {" ${activewindow}"}) (box :class "music" {" ${activewindow}"})
) )
@ -85,6 +86,9 @@
(defpoll volume :interval "0.5s" (defpoll volume :interval "0.5s"
"scripts/getvol") "scripts/getvol")
(defpoll battery :interval "2s"
"scripts/batteryperc")
(defpoll time :interval "1s" (defpoll time :interval "1s"
"date '+%H:%M:%S|%d.%m.%Y'") "date '+%H:%M:%S|%d.%m.%Y'")

View File

@ -5,7 +5,7 @@ sample=$(hyprctl activewindow | grep title: | awk -F: '{print $2}')
#echo ${sample} #echo ${sample}
if [ ${#sample} -gt $trunc ]; then if [ ${#sample} -gt $trunc ]; then
echo $sample | head -c $trunc | sed 's/$/.../' echo $sample | head -c $trunc | sed 's/$//'
else else
if [ ${#sample} -ne 0 ]; then if [ ${#sample} -ne 0 ]; then
echo $sample echo $sample

View File

@ -0,0 +1,3 @@
#!/bin/bash
upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep percentage | awk -F: '{print $2}' | tail -c4

View File

@ -6,7 +6,7 @@ artist=$(playerctl metadata --format '{{ artist }}')
#echo ${sample} #echo ${sample}
if [ ${#song} -gt $truncs ]; then if [ ${#song} -gt $truncs ]; then
songt=$(echo $song | head -c $truncs | sed 's/$/.../') songt=$(echo $song | head -c $truncs | sed 's/$//')
else else
if [ ${#song} -ne 0 ]; then if [ ${#song} -ne 0 ]; then
songt=$(echo ${song}) songt=$(echo ${song})
@ -16,7 +16,7 @@ else
fi fi
if [ ${#artist} -gt $trunca ]; then if [ ${#artist} -gt $trunca ]; then
artistt=$(echo $artist | head -c $trunca | sed 's/$/.../') artistt=$(echo $artist | head -c $trunca | sed 's/$//')
else else
if [ ${#artist} -ne 0 ]; then if [ ${#artist} -ne 0 ]; then
artistt=$(echo ${artist}) artistt=$(echo ${artist})