eww.yuck (3189B)


      1 (deflisten wlr_apps :initial "[]" "wlr-apps -mjq 1")
      2 
      3 (defwindow bottom_bar []
      4   :monitor "0"
      5   :windowtype "dock"
      6   :geometry (geometry :width "100%"
      7                       :height "64px"
      8                       :anchor "bottom center")
      9   :exclusive true
     10   (bar))
     11 
     12 (defwidget bar []
     13   (box :class "bar"
     14        :orientation "h"
     15        :space-evenly false
     16     (launcher)
     17     (taskbar)
     18     (toolbar)
     19     (statsbar)))
     20 
     21 (defwidget statsbar []
     22   (box :class "stats"
     23        :orientation "h"
     24        :space-evenly false
     25        :hexpand false
     26        :halign "end"
     27        (time)))
     28 
     29 (defwidget time []
     30   (box :orientation "h"
     31        :space-evenly false
     32        :hexpand false
     33        :halign "end"
     34        (label :text _time)))
     35 
     36 (defpoll _time :interval "1s"
     37   "date -R")
     38 
     39 (defwidget power []
     40   (progress :orientation "h"
     41        :space-evenly false
     42        :halign "end"
     43        :valign "center"
     44        :vexpand false
     45        :value "${EWW_BATTERY.BAT0.capacity}"))
     46 
     47 (defwidget launcher []
     48   (box :class "launcher"
     49        :orientation "h"
     50        :space-evenly false
     51        :hexpand false
     52        :halign "start"
     53        (button :onclick "librewolf &"
     54                :tooltip "Librewolf"
     55                (image :icon "librewolf"
     56                       :icon-size "dialog"))
     57        (button :onclick "aseprite &"
     58                :tooltip "Aseprite"
     59                (image :icon "aseprite"
     60                       :icon-size "dialog"))
     61        (button :onclick "snap &"
     62                :tooltip "Snap!"
     63                (image :icon "half-life"
     64                       :icon-size "dialog"))
     65        (box :width 24)
     66        (button :onclick "thunar \"$HOME\" &"
     67                :tooltip "File Manager"
     68                (image :icon "system-file-manager"
     69                       :icon-size "dialog"))
     70        (button :onclick "footclient -T \"Task Manager\" -W 80x24 btop &"
     71                :tooltip "Task Manager"
     72                (image :icon "utilities-system-monitor"
     73                       :icon-size "dialog"))))
     74 
     75 (defwidget toolbar []
     76   (box :class "launcher"
     77        :hexpand false
     78        :space-evenly false
     79        :halign "end"
     80        (power)
     81        (button :onclick "pavucontrol-qt &"
     82                :tooltip "Audio Control"
     83                (image :icon "multimedia-volume-control"
     84                       :icon-size "large-toolbar"))
     85        (button :onclick "footclient -T \"Internet Settings\" nmtui &"
     86                :tooltip "Network Manager"
     87                (image :icon "wifi-radar"
     88                       :icon-size "large-toolbar"))))
     89 
     90 (defwidget taskbar []
     91   (box :orientation "h"
     92        :halign "center"
     93        :hexpand true
     94        :space-evenly false
     95        :class "launcher"
     96        ;; Iterates through the array provided by wlr-apps and creates a button for each app found.
     97     (for app in {wlr_apps}
     98       (button ;; Highlights the app that is currently active.
     99               :class "app_item ${app.active == true ? "active" : ""}" 
    100               ;; Functionality to focus app on click, to be expanded.
    101               :onclick "wlr-apps -x \"f ${app.id}\""
    102               :tooltip "${app.title}"
    103               (image :class "app_image"
    104                      :icon "${app.app_id}"
    105                      :icon-size "dialog")))))