Definde bar in newbar.yuck with variables. Changed monitors.sh from jank echo to use bar variables.

This commit is contained in:
willifan 2024-03-14 17:58:07 +01:00
parent 8d5435ee8a
commit c8ac4b08ea
7 changed files with 37 additions and 197 deletions

View file

@ -34,14 +34,16 @@ generate() {
((i=i+1))
done < <(hyprctl monitors -j | jq -r '.[]|"\(.id) \(.name) \(.width) \(.height) \(.scale) \(.activeWorkspace.id) \(.transform)"')
if [[ $i > 1 ]]; then
displayMonitorID=true
else
displayMonitorID=false
fi
# if [[ $i > 1 ]]; then
# displayMonitorID=true
# else
# displayMonitorID=false
# fi
echo -n "" > $XDG_CONFIG_HOME/eww/bar.yuck
eww close-all
for ((i = 0; i < ${#id[@]}; i++)); do
scale_value=$(echo "${scale[$i]}" | bc -l)
@ -53,82 +55,12 @@ generate() {
monitorID=$(xrandr --listactivemonitors | grep +${name[$i]} | awk '{sub(/.$/,"",$1); print $1}')
echo "
(defwindow bar${id[$i]}
:monitor \"${monitorID}\"
:class \"bar\"
:geometry (geometry
:x \"0%\"
:y \"5px\"
:width \"${new_width}px\"
:height \"25px\"
:anchor \"top center\")
:stacking \"fg\"
:exclusive true
(bar${id[$i]}))
eww open bar --id bar${monitorID} --arg monitor=${monitorID} --arg width=${new_width} --arg height=25
(defwidget monitor${id[$i]} []
(box
:visible ${displayMonitorID}
(label
:width \"15\"
:text \"$((id[$i]+1))\")
(seperator)))
(defwidget workspaces${id[$i]} []
(box
:space-evenly false
:spacing 3
(for workspace in workspaces
(eventbox
:onclick \`/home/willifan/.config/scripts/workspaces.sh \${workspace.ID}\`
:class {workspace.activeID == \"${monitorID}\" ? \"activeWorkspace\" : \"smallBox\"}
:valign \"center\"
:halign \"center\"
:height 20
:width 20
(box
:halign \"center\"
:space-evenly false
(smallSpacer)
(label
:class {workspace.occupied == true ? \"\" : \"unoccupiedWorkspace\"}
:width 16
:text \"\${workspace.ID}\")
(imageDPI
:visible \"\${workspace.occupied}\"
:image \"\${workspace.clients[0].icon}\"
:size \"16\")
(smallSpacer))))))
(defwidget start${id[$i]} []
(box
:orientation \"h\"
:space-evenly false
:halign \"start\"
(space)
(monitor${id[$i]})
(workspaces${id[$i]})))
(defwidget bar${id[$i]} []
(centerbox :orientation \"h\"
(start${id[$i]})
(center)
(end)))
" >> $XDG_CONFIG_HOME/eww/bar.yuck
done
eww close-all
eww reload
for i in "${!id[@]}"; do
windows="${windows}bar${id[$i]} "
done
echo $windows
eww open-many $windows
}
generate
@ -139,40 +71,3 @@ socat -u UNIX-CONNECT:/tmp/hypr/"$HYPRLAND_INSTANCE_SIGNATURE"/.socket2.sock - |
fi
done
#(for monitor in monitors
# (defwindow bar2
# :monitor "${monitor.id}"
# :geometry (geometry
# :x "0%"
# :y "5px"
# :width "${(monitor.width / monitor.scale )-10}px"
# :height "${monitor.height / monitor.scale * 0.03}%"
# :anchor "top cemter")
# :stacking "fg"
# :exclusive true
# (bar)))
#(defwidget workspaces${id[$i]} []
# (box
# (for workspace in workspaces
# (eventbox
# :onclick `/home/willifan/.config/scripts/workspaces.sh ${workspace.num}`
# (label
# :width "15"
# :class {workspace.active == 1 ? "activeWorkspace" : workspace.occupied == 0 ? "unoccupiedWorkspace" : ""}
# ;;:visible {workspace.occupied == 1 ? "true" : "false"}
# :text "${workspace.num}")))))
#(defwidget start${id[$i]} []
# (box
# :orientation "h"
# :space-evenly false
# :halign "start"
# (space)
# (workspaces${id[$i]})))
#(defwidget bar${id[$i]} []
# (centerbox :orientation "h"
# (start${id[$i]})
# (center)
# (end)))