140 lines
3.6 KiB
Text
140 lines
3.6 KiB
Text
(defwidget bar []
|
|
(centerbox :orientation "h"
|
|
(workspaces :array workspacesArray)
|
|
(music)
|
|
(rightgroup)))
|
|
|
|
(defwidget rightgroup []
|
|
(box :class "rightgroup" :orientation "h" :space-evenly false :halign "end"
|
|
" "
|
|
"🖧 "
|
|
" "
|
|
" "
|
|
(sysdisk)
|
|
(sysmem)
|
|
{formattime(EWW_TIME,"%b %d, %Y %H:%M")}
|
|
(systemtray)))
|
|
|
|
(deflisten workspacesArray :initial "${[1]}"
|
|
`~/.config/eww/scripts/getWorkspaces.sh`)
|
|
|
|
(defwidget workspaces [array]
|
|
(box :class "workspaces"
|
|
:orientation "h"
|
|
:space-evenly true
|
|
:halign "start"
|
|
|
|
(for entry in array
|
|
(button :onclick `swaymsg workspace "${entry.name}"`
|
|
:class {entry.focused ? "focused" : ""}
|
|
`${replace(entry.name,".*:","")}`))))
|
|
|
|
(defwidget systemtray []
|
|
(systray
|
|
:class "systray"
|
|
:orientation "h"
|
|
:space-evenly true
|
|
:spacing 10
|
|
:prepend-new true))
|
|
|
|
(defwidget revealer-on-hover [revealvar revealvar-name ?class ?duration ?transition]
|
|
(box
|
|
:class "${class} revealer-on-hover"
|
|
:orientation "h"
|
|
:space-evently false
|
|
(eventbox
|
|
:onhover "${EWW_CMD} update ${revealvar-name}=true"
|
|
:onhoverlost "${EWW_CMD} update ${revealvar-name}=false"
|
|
(box
|
|
:space-evenly false
|
|
(children :nth 0)
|
|
(revealer
|
|
:reveal revealvar
|
|
:transition {transition ?: "slideright"}
|
|
:duration {duration ?: "500ms"}
|
|
(children :nth 1))))))
|
|
|
|
(defvar reveal_sysmem false)
|
|
(defwidget sysmem []
|
|
(revealer-on-hover
|
|
:revealvar reveal_sysmem
|
|
:revealvar-name "reveal_sysmem"
|
|
(metric :label " "
|
|
:value {EWW_RAM.used_mem_perc}
|
|
:onchange "")
|
|
(sysmem_children)))
|
|
|
|
(defwidget sysmem_children []
|
|
(box :class "reveal_children"
|
|
:orientation "h"
|
|
:space-evenly false
|
|
:halign "center"
|
|
(metric :label " "
|
|
:value {round((EWW_RAM.total_mem - EWW_RAM.free_mem) / EWW_RAM.total_mem,2) * 100}
|
|
:onchange "")
|
|
(metric :label " "
|
|
:value {round((EWW_RAM.total_swap - EWW_RAM.free_swap) / EWW_RAM.total_swap,2) * 100}
|
|
:onchange "")))
|
|
|
|
(defvar reveal_sysdisk false)
|
|
(defwidget sysdisk []
|
|
(revealer-on-hover
|
|
:revealvar reveal_sysdisk
|
|
:revealvar-name "reveal_sysdisk"
|
|
(metric :label "/home"
|
|
:value {EWW_DISK["/home"].used_perc}
|
|
:onchange "")
|
|
(sysdisk_children)))
|
|
|
|
(defwidget sysdisk_children []
|
|
(box :class "reveal_children"
|
|
:orientation "h"
|
|
:space-evenly false
|
|
:halign "center"
|
|
(metric :label "/"
|
|
:value {EWW_DISK["/"].used_perc}
|
|
:onchange "")
|
|
(metric :label "/boot"
|
|
:value {EWW_DISK["/boot"].used_perc}
|
|
:onchange "")))
|
|
|
|
(defwidget music []
|
|
(box :class "music"
|
|
:orientation "h"
|
|
:space-evenly false
|
|
:halign "center"
|
|
{music != "" ? "🎵${music}" : ""}))
|
|
|
|
(defwidget metric [label value onchange]
|
|
(box :orientation "h"
|
|
:class "metric"
|
|
:space-evenly false
|
|
(box :class "label" label)
|
|
(circular-progress
|
|
:active {onchange != ""}
|
|
:value value
|
|
:start-at 0
|
|
:thickness 10
|
|
:clockwise true
|
|
:onchange onchange)))
|
|
|
|
(deflisten music :initial ""
|
|
"playerctl --follow metadata --format '{{ artist }} - {{ title }}' || true")
|
|
|
|
(defpoll volume :interval "1s"
|
|
"scripts/getvol")
|
|
|
|
(defpoll time :interval "10s"
|
|
"date '+%H:%M %b %d, %Y'")
|
|
|
|
(defwindow bar
|
|
:monitor 2
|
|
:windowtype "dock"
|
|
:exclusive true
|
|
:geometry (geometry :x "0%"
|
|
:y "0%"
|
|
:width "99%"
|
|
:height "15px"
|
|
:anchor "top center")
|
|
:reserve (struts :side "top" :distance "4%")
|
|
(bar))
|