AGS/widget/Bar.tsx

31 lines
782 B
TypeScript
Raw Normal View History

2024-11-21 22:45:00 +07:00
import { App, Astal, Gtk, Gdk } from "astal/gtk3";
import { Variable } from "astal";
2024-11-21 10:01:26 +07:00
2024-11-21 22:45:00 +07:00
const time = Variable("").poll(1000, "date");
2024-11-21 10:01:26 +07:00
export default function Bar(gdkmonitor: Gdk.Monitor) {
2024-11-21 22:45:00 +07:00
return (
<window
className="Bar"
gdkmonitor={gdkmonitor}
exclusivity={Astal.Exclusivity.EXCLUSIVE}
anchor={
Astal.WindowAnchor.TOP |
Astal.WindowAnchor.LEFT |
Astal.WindowAnchor.RIGHT
}
application={App}
>
<centerbox>
<button onClicked="notify-send hello" halign={Gtk.Align.CENTER}>
Welcome to AGS!
</button>
<box />
<button onClick={() => print("hello")} halign={Gtk.Align.CENTER}>
<label label={time()} />
</button>
</centerbox>
2024-11-21 10:01:26 +07:00
</window>
2024-11-21 22:45:00 +07:00
);
2024-11-21 10:01:26 +07:00
}