diff --git a/tree/.config/eww/eww.scss b/tree/.config/eww/eww.scss index 61fc31d..574bf8f 100644 --- a/tree/.config/eww/eww.scss +++ b/tree/.config/eww/eww.scss @@ -31,18 +31,23 @@ window { border-radius: 30px; padding-top: 3px; padding-bottom: 5px; - margin-top: 3px; - margin-bottom: 3px; - box-shadow: 0 0px 5px 1px #06060b; - transition: all 1s; + margin-bottom: 6px; + transition: border-color 0.5s; } .workspace.active { border: solid $highlight2 2px; } +.workspace:hover { + background-color: $lowlight2; +} + +.workspace:active { + background-color: $highlight2; +} + .workspaces { - margin-top: 10px; margin-bottom: 10px; } diff --git a/tree/.config/eww/eww.yuck b/tree/.config/eww/eww.yuck index c8f7061..d38aade 100644 --- a/tree/.config/eww/eww.yuck +++ b/tree/.config/eww/eww.yuck @@ -33,7 +33,7 @@ (defwidget bottom [] (box :orientation "v" :valign "end" - :class "bottom" + :class "bottom" :space-evenly false (vpn) (speaker) @@ -49,11 +49,27 @@ (box :orientation "v" :valign "start" :class "workspaces" - :space-evenly: false - (for workspace in workspaces_json - (button :visible {workspace.monitor == monitor} :class 'workspace ${workspace.class}' - (label :text '${workspace.id}')) -))) + :space-evenly: false + ; can't use a for loop here because that breaks css animations + (workspace :n 1) + (workspace :n 2) + (workspace :n 3) + (workspace :n 4) + (workspace :n 5) + (workspace :n 6) + (workspace :n 7) + (workspace :n 8) + (workspace :n 9) + (workspace :n 10) + (workspace :n 11) + (workspace :n 12) +)) + +(defwidget workspace [n] + (button :visible {jq(workspaces, '.["${n}"] != null')} + :class 'workspace ${workspaces[n].class}' + (label :text n)) +) (defwidget speaker [] (eventbox @@ -61,7 +77,7 @@ :onhoverlost "${EWW_CMD} update show_volume=false" (box :orientation "v" :class "thingy volbox ${show_volume ? "active" : ""}" - :space-evenly false + :space-evenly false (revealer :transition "slidedown" :reveal show_volume (scale :orientation "v" @@ -83,7 +99,7 @@ (button :valign "end" :class "vpn thingy ${vpn_status.class}" :onclick "${vpn_status.on_click}" - :tooltip "${vpn_status.tooltip}" + :tooltip "${vpn_status.tooltip}" (label :text "${vpn_status.icon}") )) @@ -100,7 +116,7 @@ (box :orientation "v" :valign "end" :class "thingy" - :visible {bat_charge != ""} + :visible {bat_charge != ""} (label :text "BAT") (circular-progress :thickness 4.0 @@ -110,7 +126,6 @@ bat_charge < 15 ? "battery-gauge low" : "battery-gauge" } - ;:style {bat_charge < 15 ? "color: red;" : ""} ) ;(label :text "${bat_charge}%") )) @@ -138,7 +153,7 @@ (button :orientation "v" :valign "end" :class "thingy pwrbtn clickable" - :onclick "${EWW_CMD} open --toggle pwrctl" + :onclick "${EWW_CMD} open --toggle pwrctl" (label :text "⏻") )) @@ -160,7 +175,7 @@ (defvar show_volume false) -(defpoll workspaces_json :interval "1s" "eww-workspaces") +(defpoll workspaces :interval "1s" "eww-workspaces") (defpoll volume_out :interval "1s" "pamixer --get-volume") (defpoll vpn_status :interval "1s" "mullvad-status") (defpoll current_minute :interval "1s" "date +%M") diff --git a/tree/.local/bin/eww-workspaces b/tree/.local/bin/eww-workspaces index 06206c6..0d25122 100755 --- a/tree/.local/bin/eww-workspaces +++ b/tree/.local/bin/eww-workspaces @@ -5,5 +5,6 @@ let active = (hyprctl activeworkspace -j | from json | get id) hyprctl workspaces -j | from json | sort-by id | - each {|w| {id: $w.id monitor: $w.monitorID class: (if ($w.id == $active) {"active"} else {""}) }} | + each {|w| {$w.id: {monitor: $w.monitorID class: (if ($w.id == $active) {"active"} else {""}) }}} | + reduce {|a, b| $a | merge $b } | to json