diff --git a/bar/.yuck b/bar/.yuck new file mode 100644 index 0000000..dd4c451 --- /dev/null +++ b/bar/.yuck @@ -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)) + + + diff --git a/bar/style.scss b/bar/style.scss new file mode 100644 index 0000000..a26ed08 --- /dev/null +++ b/bar/style.scss @@ -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); + } + } +} \ No newline at end of file diff --git a/bar/workspace.sh b/bar/workspace.sh new file mode 100644 index 0000000..dabbf46 --- /dev/null +++ b/bar/workspace.sh @@ -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 \ No newline at end of file diff --git a/eww.scss b/eww.scss new file mode 100644 index 0000000..9ece69d --- /dev/null +++ b/eww.scss @@ -0,0 +1,5 @@ +* { + all: unset; +} + +@import "./bar/style.scss"; diff --git a/eww.yuck b/eww.yuck new file mode 100644 index 0000000..2d26c8e --- /dev/null +++ b/eww.yuck @@ -0,0 +1 @@ +(include "bar/.yuck")