diff options
Diffstat (limited to '.config/eww/eww.yuck')
| -rw-r--r-- | .config/eww/eww.yuck | 173 |
1 files changed, 173 insertions, 0 deletions
diff --git a/.config/eww/eww.yuck b/.config/eww/eww.yuck new file mode 100644 index 0000000..03d8fa1 --- /dev/null +++ b/.config/eww/eww.yuck @@ -0,0 +1,173 @@ +(defwidget revealer-on-hover [var varname ?class ?duration ?transition] + (box :class "${class} revealer-on-hover" + :orientation "h" + :space-evenly false + (eventbox :class "eventbox" + :onhover "eww update ${varname}=true" + :onhoverlost "eww update ${varname}=false" + (box :space-evenly false + (revealer :reveal var + :transition {transition ?: "slideright"} + :duration {duration ?: "500ms"} + (children :nth 0)) + (children :nth 1))))) + +(defwindow applauncher + :monitor 0 + :geometry (geometry :x "50%" + :y "50%" + :width "500px" + :height "400px" + :anchor "center center") + :stacking "overlay" + :exclusive false + :focusable true + (box :orientation "v" + :class "applauncher" + (input :onaccept `eww close applauncher`) + )) + +(defwindow powermenu + :monitor 0 + :geometry (geometry :x "0%" + :y "0%" + :width "100%" + :height "100%" + :anchor "top left") + :stacking "overlay" + :exclusive false + :focusable false + (box :orientation "v" + :class "powermenu" + (box :orientation "h" + :class "powermenu-buttons" + :spacing "20" + (box :orientation "v" :space-evenly false + (button :vexpand "true" "") + (label :text "Power Off")) + (box :orientation "v" :space-evenly false + (button :vexpand "true" "") + (label :text "Reboot")) + (box :orientation "v" :space-evenly false + (button :vexpand "true" "") + (label :text "Lock")) + (box :orientation "v" :space-evenly false + (button :vexpand "true" "") + (label :text "Sleep")) + (box :orientation "v" :space-evenly false + (button :vexpand "true" "") + (label :text "Log Out")) + (box :orientation "v" :space-evenly false + (button :vexpand "true" :timeout "5000" :onclick `eww close powermenu` "") + (label :text "Cancel"))))) + +(defwindow bar + :monitor 0 + :geometry (geometry :x "0%" + :y "8px" + :width "1904px" + :height "32px" + :anchor "top center") + :stacking "fg" + :exclusive true + :focusable false + (bar)) + +(defwidget bar [] + (centerbox :orientation "h" + :class "bar" + (tags) + (title) + (status))) + +(deflisten tags_json :initial `[]` `river-bedload -minified -watch tags`) +(deflisten wintitle :initial `[{"title":""}]` `river-bedload -minified -watch title`) + +(defwidget tags [] + (box :orientation "h" + :halign "start" + :class "tags" + (button :onclick `riverctl set-focused-tags 1` + :class {jq(tags_json, `.[] | select(.id == 1) | {focused, occupied} | to_entries | map(select(.value) | .key) | join(" ") | {"class": .}`).class} + ;:visible {jq(tags_json, `.[] | select(.id == 1) | .occupied or .focused`)} + ) + (button :onclick `riverctl set-focused-tags 2` + :class {jq(tags_json, `.[] | select(.id == 2) | {focused, occupied} | to_entries | map(select(.value) | .key) | join(" ") | {"class": .}`).class} + ;:visible {jq(tags_json, `.[] | select(.id == 2) | .occupied or .focused`)} + ) + (button :onclick `riverctl set-focused-tags 4` + :class {jq(tags_json, `.[] | select(.id == 3) | {focused, occupied} | to_entries | map(select(.value) | .key) | join(" ") | {"class": .}`).class} + ;:visible {jq(tags_json, `.[] | select(.id == 3) | .occupied or .focused`)} + ) + (button :onclick `riverctl set-focused-tags 8` + :class {jq(tags_json, `.[] | select(.id == 4) | {focused, occupied} | to_entries | map(select(.value) | .key) | join(" ") | {"class": .}`).class} + ;:visible {jq(tags_json, `.[] | select(.id == 4) | .occupied or .focused`)} + ) + (button :onclick `riverctl set-focused-tags 16` + :class {jq(tags_json, `.[] | select(.id == 5) | {focused, occupied} | to_entries | map(select(.value) | .key) | join(" ") | {"class": .}`).class} + ;:visible {jq(tags_json, `.[] | select(.id == 5) | .occupied or .focused`)} + ) + (button :onclick `riverctl set-focused-tags 32` + :class {jq(tags_json, `.[] | select(.id == 6) | {focused, occupied} | to_entries | map(select(.value) | .key) | join(" ") | {"class": .}`).class} + ;:visible {jq(tags_json, `.[] | select(.id == 6) | .occupied or .focused`)} + ) + (button :onclick `riverctl set-focused-tags 64` + :class {jq(tags_json, `.[] | select(.id == 7) | {focused, occupied} | to_entries | map(select(.value) | .key) | join(" ") | {"class": .}`).class} + ;:visible {jq(tags_json, `.[] | select(.id == 7) | .occupied or .focused`)} + ) + (button :onclick `riverctl set-focused-tags 128` + :class {jq(tags_json, `.[] | select(.id == 8) | {focused, occupied} | to_entries | map(select(.value) | .key) | join(" ") | {"class": .}`).class} + ;:visible {jq(tags_json, `.[] | select(.id == 8) | .occupied or .focused`)} + ) + (button :onclick `riverctl set-focused-tags 256` + :class {jq(tags_json, `.[] | select(.id == 9) | {focused, occupied} | to_entries | map(select(.value) | .key) | join(" ") | {"class": .}`).class} + ;:visible {jq(tags_json, `.[] | select(.id == 9) | .occupied or .focused`)} + ))) + + +(defwidget title [] + (label :text {wintitle[0].title} + :class "title" + :truncate true + :show-truncated true + :visible {wintitle[0].title != ""} + :limit-width 55)) + +(deflisten volume :initial "0" `monitor-volume`) +(defpoll ssid :initial "" :interval "10s" `iwctl station wlan0 get-networks | awk -F' ' '/>/{print $3}'`) +(deflisten brightness :initial "0" `brightctl -l`) +(defpoll time :initial "" :interval "1s" `date '+%b %-d %H:%M:%S'`) + +(defvar showvol false) + +(defwidget status [] + (box :orientation "h" + :halign "end" + :class "status" + :spacing 8 + :space-evenly false + (revealer-on-hover :var showvol + :varname "showvol" + :icon "a" + :transition "slideleft" + :class "volume" + (scale :orientation "h" + :min 0 + :max 1 + :value {volume} + :onchange `wpctl set-volume @DEFAULT_SINK@ {}`) + (label :text "${matches(volume, "MUTED") ? " " : volume == 0 ? "" : volume < 50 ? "" : " "} ${volume}%" + :class "volume")) + (label :text "${ssid == "" ? "" : ""} ${ssid}" + :class "network") + (label :text " ${brightness}%" + :class "brightness") + (label :text "${`{"Discharging": ["","","","","","","","","",""], "Charging": ["","","","","","","","","",""]}`?.[EWW_BATTERY.BAT0.status]?.[round((EWW_BATTERY.BAT0.capacity - 1) / 10, 0)] ?: ""} ${EWW_BATTERY.BAT0.capacity}%" + :class "battery") + (label :text " ${time}" + :class "clock") + (label :text "" + :class "menu"))) + ;(label :text "" + ;:class "power"))) + |
