Created default layout for the Bar

This commit is contained in:
Pascal Thuma committed 2026-03-24 19:14:00 +01:00
1 parent 1178d04d37
commit fe35b5b10b
3 files changed
+37 -19

No files matched your search

+2
View File
@@ -0,0 +1,2 @@
node_modules/
@girs/
+7
View File
@@ -11,6 +11,13 @@ window.Bar {
background: $bg-color; background: $bg-color;
border-radius: 10px; border-radius: 10px;
margin: 8px; margin: 8px;
padding: 4px 12px;
}
.left-box,
.center-box,
.right-box {
padding: 0 8px;
} }
button { button {
+28 -19
View File
@@ -1,16 +1,37 @@
import app from "ags/gtk4/app" import app from "ags/gtk4/app"
import { Astal, Gtk, Gdk } from "ags/gtk4" import { Astal, Gtk, Gdk } from "ags/gtk4"
import { execAsync } from "ags/process"
import { createPoll } from "ags/time" function Left() {
return (
<box $type="start" halign={Gtk.Align.START} cssClasses={["left-box"]}>
<label label="Left Widget Area" />
</box>
)
}
function Center() {
return (
<box $type="center" halign={Gtk.Align.CENTER} cssClasses={["center-box"]}>
<label label="Center Widget Area" />
</box>
)
}
function Right() {
return (
<box $type="end" halign={Gtk.Align.END} cssClasses={["right-box"]}>
<label label="Right Widget Area" />
</box>
)
}
export default function Bar(gdkmonitor: Gdk.Monitor) { export default function Bar(gdkmonitor: Gdk.Monitor) {
const time = createPoll("", 1000, "date")
const { TOP, LEFT, RIGHT } = Astal.WindowAnchor const { TOP, LEFT, RIGHT } = Astal.WindowAnchor
return ( return (
<window <window
visible visible
name="bar" name={`bar-${gdkmonitor.get_display()?.get_name()}`}
class="Bar" class="Bar"
gdkmonitor={gdkmonitor} gdkmonitor={gdkmonitor}
exclusivity={Astal.Exclusivity.EXCLUSIVE} exclusivity={Astal.Exclusivity.EXCLUSIVE}
@@ -18,21 +39,9 @@ export default function Bar(gdkmonitor: Gdk.Monitor) {
application={app} application={app}
> >
<centerbox cssName="centerbox"> <centerbox cssName="centerbox">
<button <Left />
$type="start" <Center />
onClicked={() => execAsync("echo hello").then(console.log)} <Right />
hexpand
halign={Gtk.Align.CENTER}
>
<label label="Welcome to AGS!" />
</button>
<box $type="center" />
<menubutton $type="end" hexpand halign={Gtk.Align.CENTER}>
<label label={time} />
<popover>
<Gtk.Calendar />
</popover>
</menubutton>
</centerbox> </centerbox>
</window> </window>
) )