added eww-nobattery as a se

main
The_miro 2025-04-05 12:11:34 +02:00
parent c688a411b1
commit 68b575c72c
8 changed files with 317 additions and 0 deletions

View File

@ -0,0 +1,70 @@
* {
all: unset; // Unsets everything so you can style everything from scratch
font-family: Agave Nerd Font Mono, sans-serif;
font-size: 14pt;
}
// Global Styles
.bar {
color: #b0b4bc;
padding: 10px;
}
// Styles on classes (see eww.yuck for more information)
.sidestuff slider {
all: unset;
color: #ffd5cd;
}
.metric scale trough highlight {
all: unset;
background: #E40046;
color: #000000;
border-radius: 10px;
}
.metric scale trough {
all: unset;
background-color: #5018dd;
border-radius: 50px;
min-height: 3px;
min-width: 50px;
margin-left: 10px;
margin-right: 20px;
}
.label-ram {
font-size: large;
}
.music,.metric,.clock,.workspace-button {
border: solid;
border-width: 3px;
background: #1a1a1a;
color: #5018dd;
padding-top:5px;
margin-top:1px;
padding-bottom:5px;
margin-bottom:1px;
padding-left:5px;
margin-left:4px;
padding-right:5px;
margin-right:4px;
border-radius: 25px;
}
.workspace-active {
color: #E40046;
}

View File

@ -0,0 +1,102 @@
(defwindow bar [monitor]
:monitor monitor
:windowtype "dock"
:geometry (geometry :x "0%"
:y "1%"
:width "99%"
:height "20px"
:anchor "top center")
:exclusive true
(bar :monitor_ monitor))
(defpoll battery :interval "2s"
"scripts/batteryperc")
(defwidget bar [monitor_]
(centerbox :orientation "h"
(winsworks :monitor monitor_)
(music)
(sidestuff)))
(defwidget winsworks [monitor]
(box :orientation "h" :space-evenly false :halign "start"
(workspaceWidget :monitor monitor)
(box :onclick "scripts/windowswitcher" :class "music" {" ${activewindow}"})
)
)
(defwidget sidestuff []
(box :class "sidestuff" :orientation "h" :space-evenly false :halign "end"
(box :class "music" {"󰛳 ${IP}"})
(metric :label "󰓃"
:value volume
:onchange "pactl set-sink-volume @DEFAULT_SINK@ {}%")
(metric :label ""
:value {round((1 - (EWW_DISK["/"].free / EWW_DISK["/"].total)) * 100, 0)}
:onchange "")
(clock)
))
(defwidget music []
(box :class "music"
:orientation "h"
:space-evenly false
:halign "center"
{music != "" ? " ${music}" : " None"}))
(defwidget metric [label value onchange]
(box :orientation "h"
:class "metric"
:space-evenly false
(box :class "label" label)
(scale :min 0
:max 101
:active {onchange != ""}
:value value
:onchange onchange)))
(deflisten workspaces "hyprland-workspaces _")
(defwidget workspaceWidget [monitor]
(eventbox :onscroll "hyprctl dispatch workspace `echo {} | sed 's/up/+/\' | sed 's/down/-/'`1"
(box :class "workspaces"
:space-evenly false
:width 20
(for i in {workspaces[monitor].workspaces}
(button
:width 20
:onclick "hyprctl dispatch workspace ${i.id}"
:class "${i.class}"
{i.name == "special:magic" ? "󱂬" : "󱂬${i.name}"})))))
(deflisten workspace-old "scripts/workspace")
(defwidget workspaces-old []
(literal :content workspace-old))
(defpoll music :interval "0.5s"
"scripts/playerget")
(defpoll activewindow :interval "0.5s"
"scripts/activewindow")
(defpoll IP :interval "600s"
"hostname -i")
(defpoll volume :interval "0.5s"
"scripts/getvol")
(defpoll time :interval "1s"
"date '+%H:%M:%S|%d.%m.%Y'")
(defwidget clock []
(box :class "clock"
(label :text {"${time}"})
)
)

View File

@ -0,0 +1,18 @@
#!/bin/bash
trunc=16
sample=$(hyprctl activewindow | grep title: | awk -F: '{print $2}')
#echo ${sample}
if [ ${#sample} -gt $trunc ]; then
echo $sample | head -c $trunc | sed 's/$/…/'
else
if [ ${#sample} -ne 0 ]; then
echo $sample
else
echo None
fi
fi
#hyprctl activewindow | grep title: | awk -F: '{print $2}' | head -c $trunc | sed 's/$/.../'

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,5 @@
#!/bin/sh
perc=$(pactl get-sink-volume @DEFAULT_SINK@ | awk -F/ '{print $2}' | xargs)
num=$(echo ${perc::-1})
echo $num

View File

@ -0,0 +1,31 @@
#!/bin/bash
truncs=13
trunca=10
song=$(playerctl metadata --format '{{ title }}')
artist=$(playerctl metadata --format '{{ artist }}')
#echo ${sample}
if [ ${#song} -gt $truncs ]; then
songt=$(echo $song | head -c $truncs | sed 's/$/…/')
else
if [ ${#song} -ne 0 ]; then
songt=$(echo ${song})
else
songt=$(echo None)
fi
fi
if [ ${#artist} -gt $trunca ]; then
artistt=$(echo $artist | head -c $trunca | sed 's/$/…/')
else
if [ ${#artist} -ne 0 ]; then
artistt=$(echo ${artist})
else
artistt=$(echo None)
fi
fi
echo "${songt}|${artistt}"
#hyprctl activewindow | grep title: | awk -F: '{print $2}' | head -c $trunc | sed 's/$/.../'

View File

@ -0,0 +1,2 @@
#!/bin/bash
hyprctl dispatch focuswindow address:"$(hyprctl -j clients | jq 'map("\(.workspace.id) ∴ \(.workspace.name) ┇ \(.title) ┇ \(.address)")' | sed "s/,$//; s/^\[//; s/^\]//; s/^[[:blank:]]*//; s/^\"//; s/\"$//" | grep -v "^$" | wofi -dO alphabetical | grep -o "0x.*$")"

View File

@ -0,0 +1,52 @@
#!/bin/bash
#define icons for workspaces 1-9
ic=("W0" "W1" "W2" "W3" "W4" "W5" "W6" "W7" "W8" "W9")
#initial check for occupied workspaces
for num in $(hyprctl workspaces | grep ID | sed 's/()/(1)/g' | awk 'NR>1{print $1}' RS='(' FS=')'); do
export o"$num"="$num"
done
#initial check for focused workspace
for num in $(hyprctl monitors | grep active | sed 's/()/(1)/g' | awk 'NR>1{print $1}' RS='(' FS=')'); do
export f"$num"="$num"
export fnum=f"$num"
done
workspaces() {
if [[ ${1:0:9} == "workspace" ]]; then #set focused workspace
unset -v "$fnum"
num=${1:11}
export f"$num"="$num"
export fnum=f"$num"
elif [[ ${1:0:15} == "createworkspace" ]]; then #set Occupied workspace
num=${1:17}
export o"$num"="$num"
export f"$num"="$num"
elif [[ ${1:0:16} == "destroyworkspace" ]]; then #unset unoccupied workspace
num=${1:18}
unset -v o"$num" f"$num"
fi
#output eww widget
echo "(eventbox :onscroll \"echo {} | sed -e 's/up/-1/g' -e 's/down/+1/g' | xargs hyprctl dispatch workspace\" \
(box :class \"works\" :orientation \"h\" :spacing 5 :space-evenly \"true\" \
(button :onclick \"hyprctl dispatch workspace 1\" :onrightclick \"hyprctl dispatch workspace 1 && /home/taylor/.config/hypr/default_app\" :class \"0$o1$f1\" \"${ic[1]}\") \
(button :onclick \"hyprctl dispatch workspace 2\" :onrightclick \"hyprctl dispatch workspace 2 && /home/taylor/.config/hypr/default_app\" :class \"0$o2$f2\" \"${ic[2]}\") \
(button :onclick \"hyprctl dispatch workspace 3\" :onrightclick \"hyprctl dispatch workspace 3 && /home/taylor/.config/hypr/default_app\" :class \"0$o3$f3\" \"${ic[3]}\") \
(button :onclick \"hyprctl dispatch workspace 4\" :onrightclick \"hyprctl dispatch workspace 4 && /home/taylor/.config/hypr/default_app\" :class \"0$o4$f4\" \"${ic[4]}\") \
(button :onclick \"hyprctl dispatch workspace 5\" :onrightclick \"hyprctl dispatch workspace 5 && /home/taylor/.config/hypr/default_app\" :class \"0$o5$f5\" \"${ic[5]}\") \
(button :onclick \"hyprctl dispatch workspace 6\" :onrightclick \"hyprctl dispatch workspace 6 && /home/taylor/.config/hypr/default_app\" :class \"0$o6$f6\" \"${ic[6]}\") \
(button :onclick \"hyprctl dispatch workspace 7\" :onrightclick \"hyprctl dispatch workspace 7 && /home/taylor/.config/hypr/default_app\" :class \"0$o7$f7\" \"${ic[7]}\") \
)\
)"
}
workspaces
socat -u UNIX-CONNECT:/tmp/hypr/"$HYPRLAND_INSTANCE_SIGNATURE"/.socket2.sock - | while read -r event; do
workspaces "$event"
done