added the changes to the no battery version of the top bar

main
The_miro 2025-05-08 18:53:50 +02:00
parent e5a999465f
commit 0da34f318e
7 changed files with 94 additions and 43 deletions

View File

@ -0,0 +1 @@
/home/themiro/Dotfiles/desktopenvs/hyprland/eww/

View File

@ -1,6 +1,7 @@
(defwindow bar [monitor] (defwindow bar [monitor]
:monitor monitor :monitor monitor
:class "ewwbar"
:windowtype "dock" :windowtype "dock"
:geometry (geometry :x "0%" :geometry (geometry :x "0%"
:y "1%" :y "1%"
@ -10,10 +11,6 @@
:exclusive true :exclusive true
(bar :monitor_ monitor)) (bar :monitor_ monitor))
(defpoll battery :interval "2s"
"scripts/batteryperc")
(defwidget bar [monitor_] (defwidget bar [monitor_]
(centerbox :orientation "h" (centerbox :orientation "h"
@ -24,13 +21,13 @@
(defwidget winsworks [monitor] (defwidget winsworks [monitor]
(box :orientation "h" :space-evenly false :halign "start" (box :orientation "h" :space-evenly false :halign "start"
(workspaceWidget :monitor monitor) (workspaceWidget :monitor monitor)
(box :onclick "scripts/windowswitcher" :class "music" {" ${activewindow}"}) (button :onclick "scripts/drawer.sh" :class "music" {" ${activewindow}"})
) )
) )
(defwidget sidestuff [] (defwidget sidestuff []
(box :class "sidestuff" :orientation "h" :space-evenly false :halign "end" (box :class "sidestuff" :orientation "h" :space-evenly false :halign "end"
(box :class "music" {"󰛳 ${IP}"}) (box :class "music" {"󰛳 ${IP}"})
(metric :label "󰓃" (metric :label "󰓃"
:value volume :value volume
:onchange "pactl set-sink-volume @DEFAULT_SINK@ {}%") :onchange "pactl set-sink-volume @DEFAULT_SINK@ {}%")
@ -41,10 +38,11 @@
)) ))
(defwidget music [] (defwidget music []
(box :class "music" (button :class "music"
:orientation "h" :orientation "h"
:space-evenly false :space-evenly false
:halign "center" :halign "center"
:onclick "scripts/playpause.sh"
{music != "" ? " ${music}" : " None"})) {music != "" ? " ${music}" : " None"}))
@ -85,9 +83,9 @@
(defpoll activewindow :interval "0.5s" (defpoll activewindow :interval "0.5s"
"scripts/activewindow") "scripts/activewindow")
(defpoll IP :interval "600s"
"hostname -i")
(defpoll IP :interval "5s"
"scripts/ip")
(defpoll volume :interval "0.5s" (defpoll volume :interval "0.5s"
"scripts/getvol") "scripts/getvol")

View File

@ -1,37 +1,44 @@
#!/bin/bash #!/bin/bash
perc=$(upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep percentage | awk -F: '{print $2}' | xargs) # Get percentage and remove the % sign cleanly
state=$(upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep state | awk -F: '{print $2}' | xargs) perc=$(upower -i /org/freedesktop/UPower/devices/battery_BAT0 | awk '/percentage/ {gsub("%",""); print $2}')
state=$(upower -i /org/freedesktop/UPower/devices/battery_BAT0 | awk '/state/ {print $2}')
num=$(echo ${perc::-1}) # Check if values are not empty
if [ -z "$perc" ] || [ -z "$state" ]; then
if [ $state == "charging" ]; then echo "Battery info unavailable"
echo "󰂄 ${perc}" exit 1
else
#echo "󰁹 ${perc}"
if [ $num -gt 95 ]; then
echo "󰁹 ${perc}"
elif [ $num -gt 90 ]; then
echo "󰂂 ${perc}"
elif [ $num -gt 80 ]; then
echo "󰂁 ${perc}"
elif [ $num -gt 70 ]; then
echo "󰂀 ${perc}"
elif [ $num -gt 60 ]; then
echo "󰁿 ${perc}"
elif [ $num -gt 50 ]; then
echo "󰁾 ${perc}"
elif [ $num -gt 40 ]; then
echo "󰁽 ${perc}"
elif [ $num -gt 30 ]; then
echo "󰁼 ${perc}"
elif [ $num -gt 20 ]; then
echo "󰁻 ${perc}"
elif [ $num -gt 10 ]; then
echo "󰁺 ${perc}"
else
notify-send --urgency=critical -t 2000 "󱃍 low battery, please charge"
echo "󰂎 ${perc}"
fi
fi fi
# Convert to integer
num=${perc%%.*} # In case perc is float
if [ "$state" == "charging" ]; then
echo "󰂄 ${perc}%"
else
if [ "$num" -gt 95 ]; then
echo "󰁹 ${perc}%"
elif [ "$num" -gt 90 ]; then
echo "󰂂 ${perc}%"
elif [ "$num" -gt 80 ]; then
echo "󰂁 ${perc}%"
elif [ "$num" -gt 70 ]; then
echo "󰂀 ${perc}%"
elif [ "$num" -gt 60 ]; then
echo "󰁿 ${perc}%"
elif [ "$num" -gt 50 ]; then
echo "󰁾 ${perc}%"
elif [ "$num" -gt 40 ]; then
echo "󰁽 ${perc}%"
elif [ "$num" -gt 30 ]; then
echo "󰁼 ${perc}%"
elif [ "$num" -gt 20 ]; then
echo "󰁻 ${perc}%"
elif [ "$num" -gt 10 ]; then
echo "󰁺 ${perc}%"
else
notify-send --urgency=critical -t 2000 "󱃍 low battery, please charge"
echo "󰂎 ${perc}%"
fi
fi

View File

@ -0,0 +1,37 @@
#!/bin/bash
perc=$(upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep percentage | awk -F: '{print $2}' | xargs)
state=$(upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep state | awk -F: '{print $2}' | xargs)
num=$(echo ${perc::-1})
if [ $state == "charging" ]; then
echo "󰂄 ${perc}"
else
#echo "󰁹 ${perc}"
if [ $num -gt 95 ]; then
echo "󰁹 ${perc}"
elif [ $num -gt 90 ]; then
echo "󰂂 ${perc}"
elif [ $num -gt 80 ]; then
echo "󰂁 ${perc}"
elif [ $num -gt 70 ]; then
echo "󰂀 ${perc}"
elif [ $num -gt 60 ]; then
echo "󰁿 ${perc}"
elif [ $num -gt 50 ]; then
echo "󰁾 ${perc}"
elif [ $num -gt 40 ]; then
echo "󰁽 ${perc}"
elif [ $num -gt 30 ]; then
echo "󰁼 ${perc}"
elif [ $num -gt 20 ]; then
echo "󰁻 ${perc}"
elif [ $num -gt 10 ]; then
echo "󰁺 ${perc}"
else
notify-send --urgency=critical -t 2000 "󱃍 low battery, please charge"
echo "󰂎 ${perc}"
fi
fi

View File

@ -0,0 +1,3 @@
#!/bin/bash
nwg-drawer -fm "kitty -e yazi" -term kitty -wm hyprland -mb 20 -ml 20 -mr 20 -mt 20 -pblock hyprlock -pbpoweroff poweroff -pbexit "hyprctl dispatch exit" -pbreboot reboot

View File

@ -0,0 +1,3 @@
#!/bin/bash
hostname -i | tr ' ' '\n' | head -n1 | tail -n1

View File

@ -0,0 +1,2 @@
#!/bin/bash
playerctl play-pause -p spotify, vlc, firefox