init project #1

Merged
Hare merged 2 commits from dev into main 2024-06-24 01:48:00 +09:00
3 changed files with 115 additions and 0 deletions
Showing only changes of commit 80c26f7a9e - Show all commits

67
bar/.yuck Normal file
View File

@ -0,0 +1,67 @@
(defpoll time :interval "10s"
"date '+%H:%M %b %d, %Y'")
(defwidget system-tray []
(systray
:halign "center"
))
(defwidget left []
(box
:class "panel"
:orientation "h"
:halign "end"
:space-evenly false
(system-tray)
(label :text time)
))
(defwidget center []
(box
:class "panel"
:halign "center"
:space-evenly false
(label :text "Hareworks")
)
)
(defwidget right []
(box
:class "panel"
:orientation "h"
:halign "start"
:space-evenly false
(workspaces)
)
)
(defwidget workspaces []
(literal :content get_workspaces))
(deflisten get_workspaces `sh ~/.config/eww/bar/workspace.sh 1`)
(defwidget bar []
(box :class "bar"
:orientation "h"
:hexpand true
:space-evenly true
(right)
(center)
(left)
))
(defwindow bar
:monitor 1
:geometry (geometry
:x "0px"
:y "8px"
:width "2544px"
:height "30px"
:anchor "top center")
:stacking "fg"
:exclusive true
:focusable false
(bar))

19
bar/style.scss Normal file
View File

@ -0,0 +1,19 @@
.bar {
font-size: 18px;
margin: 0px;
.panel {
background: rgba(89, 89, 89, 0.667);
border-radius: 15px;
padding: 0 10px 0 10px;
}
.workspace {
background: rgba(89, 89, 89, 0.667);
border-radius: 15px;
padding: 0 10px 0 10px;
&.focused {
background: rgba(255, 255, 255, 0.667);
}
}
}

29
bar/workspace.sh Normal file
View File

@ -0,0 +1,29 @@
#!/bin/sh
monitor_id=$1
print_workspaces() {
buf=""
output=$(hyprctl -j workspaces | jq -r ".[] | select(.monitorID == $monitor_id)")
focused=$(hyprctl monitors -j | jq -r ".[] | select(.id == $monitor_id) | .activeWorkspace.id")
for w in $(echo $output | jq -r '.id'); do
text=$(echo $output | jq -r "select(.id == $w) | .name")
if [ $w -eq $focused ]; then
buf="$buf (label :class \"workspace focused\" :text \"$text\")"
else
buf="$buf (label :class \"workspace\" :text \"$text\")"
fi
done
echo "(box :class \"workspaces\" :orientation \"h\" :valign \"start\"$buf)"
}
print_workspaces
socat -U - UNIX-CONNECT:$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock | while read -r line; do
case $line in
workspace\>\>*)
echo $line
print_workspaces
;;
esac
done