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

3
.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
scripts/clients/build/CMakeFiles/clients.dir/src/main.cpp.o.d
scripts/clients/build/CMakeFiles/clients.dir/src/main.cpp.o
scripts/clients/build/clients

View file

@ -1,63 +0,0 @@
(defwindow bar0
:monitor "0"
:class "bar"
:geometry (geometry
:x "0%"
:y "5px"
:width "1400px"
:height "25px"
:anchor "top center")
:stacking "fg"
:exclusive true
(bar0))
(defwidget monitor0 []
(box
:visible false
(label
:width "15"
:text "1")
(seperator)))
(defwidget workspaces0 []
(box
:space-evenly false
:spacing 3
(for workspace in workspaces
(eventbox
:onclick `/home/willifan/.config/scripts/workspaces.sh ${workspace.ID}`
:class {workspace.activeID == "0" ? "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 start0 []
(box
:orientation "h"
:space-evenly false
:halign "start"
(space)
(monitor0)
(time)))
(defwidget bar0 []
(centerbox :orientation "h"
(start0)
(center)
(end)))

View file

@ -1,12 +1,17 @@
(defwindow bar
:monitor "0"
;;1400 x 25 laptopWindow
;;(defvar windows '[{"monitor":"0","width":"1400","height":"25"}]')
(defwindow bar [monitor width height]
:monitor "${monitor}"
:class "bar"
:geometry (geometry
:x "0%"
:y "5px"
:width "1400px"
:height "25px"
:width "${width}px"
:height "${height}px"
:anchor "top center")
:stacking "fg"
:exclusive true

View file

@ -128,17 +128,21 @@ CMakeFiles/clients.dir/src/main.cpp.o: \
/usr/include/c++/13.2.1/bits/locale_facets.tcc \
/usr/include/c++/13.2.1/bits/basic_ios.tcc \
/usr/include/c++/13.2.1/bits/ostream.tcc /usr/include/c++/13.2.1/istream \
/usr/include/c++/13.2.1/bits/istream.tcc /usr/include/c++/13.2.1/cstring \
/usr/include/string.h /usr/include/strings.h \
/usr/include/c++/13.2.1/sstream /usr/include/c++/13.2.1/bits/sstream.tcc \
/usr/include/sys/socket.h /usr/include/bits/types/struct_iovec.h \
/usr/include/bits/socket.h /usr/include/bits/socket_type.h \
/usr/include/bits/sockaddr.h /usr/include/asm/socket.h \
/usr/include/asm-generic/socket.h /usr/include/linux/posix_types.h \
/usr/include/linux/stddef.h /usr/include/asm/posix_types.h \
/usr/include/asm/posix_types_64.h /usr/include/asm-generic/posix_types.h \
/usr/include/asm/bitsperlong.h /usr/include/asm-generic/bitsperlong.h \
/usr/include/asm/sockios.h /usr/include/asm-generic/sockios.h \
/usr/include/c++/13.2.1/bits/istream.tcc /usr/include/c++/13.2.1/fstream \
/usr/include/c++/13.2.1/bits/codecvt.h \
/usr/include/c++/13.2.1/x86_64-pc-linux-gnu/bits/basic_file.h \
/usr/include/c++/13.2.1/x86_64-pc-linux-gnu/bits/c++io.h \
/usr/include/c++/13.2.1/bits/fstream.tcc /usr/include/c++/13.2.1/sstream \
/usr/include/c++/13.2.1/bits/sstream.tcc /usr/include/c++/13.2.1/cstring \
/usr/include/string.h /usr/include/strings.h /usr/include/sys/socket.h \
/usr/include/bits/types/struct_iovec.h /usr/include/bits/socket.h \
/usr/include/bits/socket_type.h /usr/include/bits/sockaddr.h \
/usr/include/asm/socket.h /usr/include/asm-generic/socket.h \
/usr/include/linux/posix_types.h /usr/include/linux/stddef.h \
/usr/include/asm/posix_types.h /usr/include/asm/posix_types_64.h \
/usr/include/asm-generic/posix_types.h /usr/include/asm/bitsperlong.h \
/usr/include/asm-generic/bitsperlong.h /usr/include/asm/sockios.h \
/usr/include/asm-generic/sockios.h \
/usr/include/bits/types/struct_osockaddr.h /usr/include/sys/un.h \
/usr/include/unistd.h /usr/include/bits/posix_opt.h \
/usr/include/bits/environments.h /usr/include/bits/confname.h \
@ -217,10 +221,6 @@ CMakeFiles/clients.dir/src/main.cpp.o: \
/usr/include/c++/13.2.1/ctime \
/usr/include/c++/13.2.1/x86_64-pc-linux-gnu/bits/time_members.h \
/usr/include/c++/13.2.1/x86_64-pc-linux-gnu/bits/messages_members.h \
/usr/include/libintl.h /usr/include/c++/13.2.1/bits/codecvt.h \
/usr/include/libintl.h \
/usr/include/c++/13.2.1/bits/locale_facets_nonio.tcc \
/usr/include/c++/13.2.1/bits/locale_conv.h \
/usr/include/c++/13.2.1/fstream \
/usr/include/c++/13.2.1/x86_64-pc-linux-gnu/bits/basic_file.h \
/usr/include/c++/13.2.1/x86_64-pc-linux-gnu/bits/c++io.h \
/usr/include/c++/13.2.1/bits/fstream.tcc
/usr/include/c++/13.2.1/bits/locale_conv.h

Binary file not shown.

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)))