added window title indicator

main
The_miro 2024-11-27 19:39:05 +01:00
parent b171775f4a
commit afb2ccea53
2 changed files with 32 additions and 8 deletions

View File

@ -15,20 +15,22 @@
(defwidget bar [monitor_]
(centerbox :orientation "h"
(workspaceWidget :monitor monitor_)
(winsworks :monitor monitor_)
(music)
(sidestuff)))
(defwidget winsworks [monitor]
(box :orientation "h" :space-evenly false :halign "start"
(workspaceWidget :monitor monitor)
(box :class "music" activewindow)
)
)
(defwidget sidestuff []
(box :class "sidestuff" :orientation "h" :space-evenly false :halign "end"
(metric :label "󰓃"
:value volume
:onchange "amixer -D pulse sset Master {}%")
(metric :label ""
:value {EWW_RAM.used_mem_perc}
:onchange "")
:onchange "pactl set-sink-volume @DEFAULT_SINK@ {}%")
(metric :label ""
:value {round((1 - (EWW_DISK["/"].free / EWW_DISK["/"].total)) * 100, 0)}
:onchange "")
@ -74,9 +76,13 @@
(literal :content workspace-old))
(deflisten music :initial ""
"playerctl --follow metadata --format '{{ artist }} - {{ title }}' || true")
"playerctl --follow metadata --format '{{ title }}' || true")
(defpoll volume :interval "1s"
(defpoll activewindow :interval "0.5s"
"scripts/activewindow")
(defpoll volume :interval "0.5s"
"scripts/getvol")
(defpoll time :interval "1s"

View File

@ -0,0 +1,18 @@
#!/bin/bash
trunc=32
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/$/.../'