blob: 6b5b7198cc8624688296e678e1fd076cf180490f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
(defwidget bar []
(centerbox :orientation "v"
:class "bar"
(workspaces)
;; TODO - add a command runner button here
""
(sidestuff)))
(defwidget workspace-btn [n ?icon]
(button :onclick "hyprctl dispatch 'workspace ${n}'"
:halign "baseline"
:hexpand true
"${icon ?: n}"))
;; TODO - add indicator that signifies that there is at least one window open on
;; the workspace
(defwidget workspaces []
(box :class "workspaces"
:orientation "v"
:space-evenly true
:valign "start"
:halign "center"
(workspace-btn :n 1 :icon "")
(workspace-btn :n 2 :icon "")
(workspace-btn :n 3 :icon "")
(workspace-btn :n 4 :icon "")
(workspace-btn :n 5 :icon "")
(workspace-btn :n 6 :icon "")
(workspace-btn :n 7 :icon "")
(workspace-btn :n 8 :icon "")
(workspace-btn :n 9 :icon "")))
(defwidget sidestuff []
(box :class "sidestuff"
:orientation "v"
:space-evenly false
:spacing 10
:valign "end"
;(netstats :device "wlp2s0")
(battery :device "BAT0")
(clock)))
(defwidget metric [icon ?font-size]
(box :class "metric card"
:orientation "v"
(label :class "metric-icon"
:style {font-size != "" ? "font-size: ${font-size}rem;" : ""}
:text icon)
(children)))
;; TODO - Add down speed and format them into human-readable values
(defwidget netstats [device]
(box :class "netstats"
:orientation "v"
:space-evenly false
:valign "end"
:halign "center"
device
"up"
{EWW_NET[device].NET_UP}))
;; TODO - make the icon change based on the percentage left
(defwidget battery [device]
(metric :icon ""
:font-size 1.5
"${EWW_BATTERY[device].capacity}%"))
(defwidget clock []
(box :class "card"
:orientation "v"
:valign "end"
:spacing -2
{formattime(EWW_TIME, "%R")}
{formattime(EWW_TIME, "%a")}
{formattime(EWW_TIME, "%-d.")}
{formattime(EWW_TIME, "%b")}
{formattime(EWW_TIME, "%Y")}))
(defwindow bar
:monitor 0
:geometry (geometry :width "1.5%"
:height "98%"
:anchor "right center")
:stacking "fg"
:windowtype "dock"
:exclusive true
(bar))
|