Samuel Shuert | 504b0fd | 2024-02-11 14:39:15 -0500 | [diff] [blame^] | 1 | (defwidget bar [] |
| 2 | (centerbox :orientation "h" |
| 3 | (workspaces) |
| 4 | (music) |
| 5 | (sidestuff))) |
Samuel Shuert | 3f82866 | 2024-02-10 20:45:50 -0500 | [diff] [blame] | 6 | |
Samuel Shuert | 504b0fd | 2024-02-11 14:39:15 -0500 | [diff] [blame^] | 7 | (defwidget sidestuff [] |
| 8 | (box :class "sidestuff" :orientation "h" :space-evenly false :halign "end" |
| 9 | (metric :label "🔊" |
| 10 | :value volume |
| 11 | :onchange "amixer -D pulse sset Master {}%") |
| 12 | (metric :label "ï¡š" |
| 13 | :value {EWW_RAM.used_mem_perc} |
| 14 | :onchange "") |
| 15 | (metric :label "💾" |
| 16 | :value {round((1 - (EWW_DISK["/"].free / EWW_DISK["/"].total)) * 100, 0)} |
| 17 | :onchange "") |
| 18 | time)) |
Samuel Shuert | 3f82866 | 2024-02-10 20:45:50 -0500 | [diff] [blame] | 19 | |
| 20 | (defwidget workspaces [] |
Samuel Shuert | 504b0fd | 2024-02-11 14:39:15 -0500 | [diff] [blame^] | 21 | (box :class "workspaces" |
Samuel Shuert | 3f82866 | 2024-02-10 20:45:50 -0500 | [diff] [blame] | 22 | :orientation "h" |
Samuel Shuert | 504b0fd | 2024-02-11 14:39:15 -0500 | [diff] [blame^] | 23 | :space-evenly true |
| 24 | :halign "start" |
| 25 | :spacing 10 |
| 26 | (button :onclick "wmctrl -s 0" 1) |
| 27 | (button :onclick "wmctrl -s 1" 2) |
| 28 | (button :onclick "wmctrl -s 2" 3) |
| 29 | (button :onclick "wmctrl -s 3" 4) |
| 30 | (button :onclick "wmctrl -s 4" 5) |
| 31 | (button :onclick "wmctrl -s 5" 6) |
| 32 | (button :onclick "wmctrl -s 6" 7) |
| 33 | (button :onclick "wmctrl -s 7" 8) |
| 34 | (button :onclick "wmctrl -s 8" 9))) |
| 35 | |
| 36 | (defwidget music [] |
| 37 | (box :class "music" |
| 38 | :orientation "h" |
| 39 | :space-evenly false |
| 40 | :halign "center" |
| 41 | {music != "" ? "🎵${music}" : ""})) |
| 42 | |
| 43 | |
| 44 | (defwidget metric [label value onchange] |
| 45 | (box :orientation "h" |
| 46 | :class "metric" |
| 47 | :space-evenly false |
| 48 | (box :class "label" label) |
| 49 | (scale :min 0 |
| 50 | :max 101 |
| 51 | :active {onchange != ""} |
| 52 | :value value |
| 53 | :onchange onchange))) |
| 54 | |
| 55 | |
| 56 | |
| 57 | (deflisten music :initial "" |
| 58 | "playerctl --follow metadata --format '{{ artist }} - {{ title }}' || true") |
| 59 | |
| 60 | (defpoll volume :interval "1s" |
| 61 | "scripts/getvol") |
| 62 | |
| 63 | (defpoll time :interval "10s" |
| 64 | "date '+%H:%M %b %d, %Y'") |
Samuel Shuert | 3f82866 | 2024-02-10 20:45:50 -0500 | [diff] [blame] | 65 | |
| 66 | (defwindow bar |
Samuel Shuert | 504b0fd | 2024-02-11 14:39:15 -0500 | [diff] [blame^] | 67 | :monitor 0 |
| 68 | :windowtype "dock" |
| 69 | :geometry (geometry :x "0%" |
| 70 | :y "0%" |
| 71 | :width "90%" |
| 72 | :height "10px" |
| 73 | :anchor "top center") |
| 74 | :reserve (struts :side "top" :distance "4%") |
| 75 | (bar)) |