aboutsummaryrefslogtreecommitdiff
path: root/share/home/eww/config/eww.yuck
blob: 4cb9bc9cc7053d073630f6f0f7a17345ba83dc99 (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
(defwidget bar []
  (centerbox :orientation "v"
             :class "bar"
    (workspaces)
    "t1"
    (sidestuff)))

(defwidget workspace-btn [n ?icon]
  (button :onclick "hyprctl dispatch 'workspace ${n}'"
          :halign "baseline"
          :hexpand true
    "${icon ?: n}"))

(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)))

(defwidget netstats [device]
  (box :class "netstats"
       :orientation "v"
       :space-evenly false
       :valign "end"
       :halign "center"
    device
    "up"
    {EWW_NET[device].NET_UP}))

(defwidget battery [device]
  (metric :icon "bat"
    "${EWW_BATTERY[device].capacity}%"))

(defwidget clock []
  (box :class "card"
       :orientation "v"
       :valign "end"
       :spacing -3
    {formattime(EWW_TIME, "%a")}
    {formattime(EWW_TIME, "%-d")}
    {formattime(EWW_TIME, "%-m")}
    {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))