summaryrefslogtreecommitdiff
path: root/.config/eww/eww.yuck
blob: 667c7177ebefb25d97f3f8c5fc6921c2abb54cf7 (plain) (blame)
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
;; Listeners
(deflisten active-workspace
  `stdbuf -oL scripts/active-workspace-listener`)

(deflisten workspace-list :initial '[1]'
  `stdbuf -oL scripts/workspace-list-listener`)

(deflisten datetime :initial '{"pretty":"","month":0}'
  `stdbuf -oL scripts/datetime-listener`)

(deflisten brightness
  `stdbuf -oL scripts/backlight-listener`)

(deflisten volume :initial '{"icon":"","percentage":""}'
  `stdbuf -oL scripts/volume-listener`)

(deflisten keymap
  `stdbuf -oL scripts/keymap-listener`)

;; Pollers
(defpoll battery :initial '{"icon":"","percentage":""}' :interval "1s"
  `scripts/battery`)

(defpoll wireless :interval "1s"
  `scripts/wireless`)

;; Windows
(defwindow bar
  :monitor 0
  :stacking "fg"
  :exclusive true
  :geometry (geometry :width "100%" :height "40px" :anchor "top center")
  (bar))

(defwindow calendar-1
  :monitor 0
  :geometry (geometry :x "10%" :width "20%" :anchor "center left")
  (calendar :class "cal"
            :month {datetime.month - 1}))

(defwindow calendar-2
  :monitor 0
  :geometry (geometry :width "20%" :anchor "center")
  (calendar :class "cal"))

(defwindow calendar-3
  :monitor 0
  :geometry (geometry :x "10%" :width "20%" :anchor "center right")
  (calendar :class "cal"
            :month {datetime.month + 1}))

(defwidget bar []
  (centerbox
    (start)
    (middle)
    (end)))

(defwidget start []
  (workspaces))

(defwidget middle []
  (clock))

(defwidget end []
  (box :halign "end"
       :class "end"
       :space-evenly false
       (keymap)
       (wireless)
       (brightness)
       (volume)
       (battery)))

(defwidget workspaces []
  (box :class "workspaces"
       :space-evenly false
       (for id in workspace-list
            (button :class {active-workspace == id ? "active" : ""}
                    :onclick `hyprctl dispatch workspace ${id}`
                    id))))

(defwidget clock []
  (box (button :onclick `scripts/toggle calendar-1 calendar-2 calendar-3`
               {datetime.pretty})))

(defwidget wireless []
  (pair :icon "" :text wireless))

(defwidget keymap []
  (pair :icon "" :text keymap))

(defwidget brightness []
  (pair :icon "" :text brightness))

(defwidget volume []
  (pair :icon {volume.icon} :text {volume.percentage}))

(defwidget battery []
  (pair :icon {battery.icon} :text {battery.percentage}))

(defwidget pair [icon text]
  (box :width 70
       :space-evenly false
       (label :text icon)
       (label :text text)))