aboutsummaryrefslogtreecommitdiff
path: root/linux/home/.config/ags/greeter/statusbar.ts
blob: 8076011bdfd165a5b77ef0b38914df87fbb46a86 (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
import { clock } from "lib/variables"
import options from "options"
import icons from "lib/icons"
import BatteryBar from "widget/bar/buttons/BatteryBar"
import PanelButton from "widget/bar/PanelButton"

const { scheme } = options.theme
const { monochrome } = options.bar.powermenu
const { format } = options.bar.date

const poweroff = PanelButton({
    class_name: "powermenu",
    child: Widget.Icon(icons.powermenu.shutdown),
    on_clicked: () => Utils.exec("shutdown now"),
    setup: self => self.hook(monochrome, () => {
        self.toggleClassName("colored", !monochrome.value)
        self.toggleClassName("box")
    }),
})

const date = PanelButton({
    class_name: "date",
    child: Widget.Label({
        label: clock.bind().as(c => c.format(`${format}`)!),
    }),
})

const darkmode = PanelButton({
    class_name: "darkmode",
    child: Widget.Icon({ icon: scheme.bind().as(s => icons.color[s]) }),
    on_clicked: () => scheme.value = scheme.value === "dark" ? "light" : "dark",
})

export default Widget.CenterBox({
    class_name: "bar",
    hexpand: true,
    center_widget: date,
    end_widget: Widget.Box({
        hpack: "end",
        children: [
            darkmode,
            BatteryBar(),
            poweroff,
        ],
    }),
})