34 lines
883 B
TypeScript
34 lines
883 B
TypeScript
import app from "ags/gtk4/app"
|
|
import { Astal, Gtk, Gdk } from "ags/gtk4"
|
|
import { createPoll } from "ags/time"
|
|
import BatteryWidget from "./Battery";
|
|
|
|
export default function Bar(gdkmonitor: Gdk.Monitor) {
|
|
const time = createPoll("", 1000, "date '+%a %b %d %l:%M:%S %p'");
|
|
const { TOP, LEFT, RIGHT } = Astal.WindowAnchor;
|
|
|
|
return (
|
|
<window
|
|
visible
|
|
name="bar"
|
|
class="Bar"
|
|
gdkmonitor={gdkmonitor}
|
|
exclusivity={Astal.Exclusivity.EXCLUSIVE}
|
|
anchor={TOP | LEFT | RIGHT}
|
|
application={app}
|
|
>
|
|
<centerbox cssName="centerbox">
|
|
<menubutton $type="center" hexpand halign={Gtk.Align.CENTER}>
|
|
<label label={time} />
|
|
<popover>
|
|
<Gtk.Calendar />
|
|
</popover>
|
|
</menubutton>
|
|
<box $type="end">
|
|
<BatteryWidget />
|
|
</box>
|
|
</centerbox>
|
|
</window>
|
|
)
|
|
}
|