aboutsummaryrefslogtreecommitdiff
path: root/ags/config.js
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--ags/config.js39
1 files changed, 33 insertions, 6 deletions
diff --git a/ags/config.js b/ags/config.js
index 2a5b7e3..bc50aa8 100644
--- a/ags/config.js
+++ b/ags/config.js
@@ -1,14 +1,41 @@
-const { speaker } = await Service.import("audio")
+// @ts-ignore
+const battery = await Service.import("battery")
-const child = Widget.Slider({
- value: speaker.bind("volume"),
- onChange: ({ value }) => speaker.volume = value,
+const BatteryPercent = () => Widget.Label()
+ .hook(battery, self => {
+ self.label = `${battery.percent}%`
+ self.visible = battery.available
+ }, "changed")
+
+const MyButton = () => Widget.Button()
+ .on("clicked", self => {
+ print(self, "is clicked")
+ })
+
+const MyDate = () => Widget.Label({
+ css: "color:blue; padding: 1em;",
})
+ .poll(1000, self => {
+ self.label = Utils.exec("date +'%_H:%_M:%S'")
+ })
+
+const MyKeybind = () => Widget.Button()
+ .keybind(["MOD1", "CONTROL"], "a", (_self, _event) => {
+ print("alt+control+a was pressed")
+ })
const Bar = () => Widget.Window({
name: 'bar',
anchor: ['top', 'left', 'right'],
- child: child,
+ child: MyDate(),
+})
+
+const scss = `${App.configDir}/style.scss`
+const css = "/tmp/my-style.css"
+Utils.exec(`sassc ${scss} ${css}`)
+
+App.config({
+ style: css,
+ windows: [Bar()],
})
-App.config({ windows: [Bar()] })