✨ ags: add center-window and logout-menu windows and more
This commit is contained in:
@@ -3,7 +3,6 @@ import { GLib } from "astal";
|
||||
|
||||
import { getDateTime } from "../scripts/time";
|
||||
|
||||
|
||||
export const CenterWindow: Widget.Window = new Widget.Window({
|
||||
className: "center-window",
|
||||
namespace: "center-window",
|
||||
@@ -12,7 +11,8 @@ export const CenterWindow: Widget.Window = new Widget.Window({
|
||||
layer: Astal.Layer.OVERLAY,
|
||||
exclusivity: Astal.Exclusivity.NORMAL,
|
||||
visible: false,
|
||||
height_request: 600,
|
||||
height_request: 400,
|
||||
margin_top: 10,
|
||||
anchor: Astal.WindowAnchor.TOP,
|
||||
child: new Widget.Box({
|
||||
className: "center-window-container",
|
||||
@@ -23,7 +23,7 @@ export const CenterWindow: Widget.Window = new Widget.Window({
|
||||
width_request: 300,
|
||||
children: [
|
||||
new Widget.Box({
|
||||
className: "top time date",
|
||||
className: "top",
|
||||
orientation: Gtk.Orientation.VERTICAL,
|
||||
children: [
|
||||
new Widget.Label({
|
||||
@@ -37,7 +37,7 @@ export const CenterWindow: Widget.Window = new Widget.Window({
|
||||
dateTime.format("%A, %B %d %Y"))
|
||||
} as Widget.LabelProps)
|
||||
]
|
||||
} as Widget.BoxProps)
|
||||
} as Widget.BoxProps),
|
||||
]
|
||||
} as Widget.BoxProps),
|
||||
new Widget.Box({
|
||||
@@ -46,6 +46,7 @@ export const CenterWindow: Widget.Window = new Widget.Window({
|
||||
new Widget.Box({
|
||||
className: "calendar-box",
|
||||
child: new Gtk.Calendar({
|
||||
visible: true,
|
||||
show_heading: true,
|
||||
show_day_names: true,
|
||||
show_week_numbers: false
|
||||
|
||||
@@ -20,7 +20,7 @@ export const ControlCenter: Widget.Window = new Widget.Window({
|
||||
layer: Astal.Layer.OVERLAY,
|
||||
margin_top: 10,
|
||||
margin_right: 10,
|
||||
width_request: 450,
|
||||
width_request: 400,
|
||||
monitor: 0,
|
||||
visible: false
|
||||
} as Widget.WindowProps, widgetsContainer);
|
||||
|
||||
@@ -1,26 +1,29 @@
|
||||
import { Astal, Gtk, Widget } from "astal/gtk3";
|
||||
import { getNotifd, notifications, removeNotification } from "../scripts/notification-handler";
|
||||
import AstalNotifd from "gi://AstalNotifd";
|
||||
import { bind } from "astal";
|
||||
import { Notifications } from "../scripts/notification-handler";
|
||||
|
||||
export const FloatingNotifications: Widget.Window = new Widget.Window({
|
||||
className: "floating-notifications",
|
||||
namespace: "floating-notifications",
|
||||
canFocus: false,
|
||||
anchor: Astal.WindowAnchor.RIGHT,
|
||||
monitor: 0,
|
||||
layer: Astal.Layer.OVERLAY,
|
||||
visible: false,
|
||||
width_request: 350,
|
||||
exclusivity: Astal.Exclusivity.NORMAL,
|
||||
child: new Widget.Box({
|
||||
className: "notifications",
|
||||
className: "floating-notifications-container",
|
||||
orientation: Gtk.Orientation.VERTICAL,
|
||||
homogeneous: false,
|
||||
children: bind(getNotifd(), "notifications").as(() => {
|
||||
notifications.length > 0 ? notifications.map((notification: AstalNotifd.Notification) =>
|
||||
children: bind(Notifications, "notifications").as((notifications: Array<AstalNotifd.Notification>) => {
|
||||
console.log("something changed!");
|
||||
return notifications.map((notification: AstalNotifd.Notification) =>
|
||||
new Widget.Box({
|
||||
className: "notification",
|
||||
homogeneous: false,
|
||||
expand: false,
|
||||
orientation: Gtk.Orientation.VERTICAL,
|
||||
children: [
|
||||
new Widget.Box({
|
||||
className: "top",
|
||||
@@ -35,13 +38,40 @@ export const FloatingNotifications: Widget.Window = new Widget.Window({
|
||||
} as Widget.LabelProps),
|
||||
new Widget.Button({
|
||||
className: "close-button",
|
||||
onClick: () => removeNotification(notification.id)
|
||||
onClick: () => Notifications.removeNotification(notification.id)
|
||||
} as Widget.ButtonProps)
|
||||
]
|
||||
} as Widget.BoxProps),
|
||||
new Widget.Box({
|
||||
className: "content",
|
||||
orientation: Gtk.Orientation.HORIZONTAL,
|
||||
children: [
|
||||
new Widget.Box({
|
||||
className: "image",
|
||||
visible: notification.image !== "",
|
||||
css: `.image { background-image: url('${notification.image}'); }`
|
||||
} as Widget.BoxProps),
|
||||
new Widget.Box({
|
||||
className: "text",
|
||||
orientation: Gtk.Orientation.VERTICAL,
|
||||
children: [
|
||||
new Widget.Label({
|
||||
className: "summary",
|
||||
useMarkup: true,
|
||||
label: notification.summary
|
||||
}),
|
||||
new Widget.Label({
|
||||
className: "body",
|
||||
useMarkup: true,
|
||||
label: notification.body
|
||||
} as Widget.LabelProps)
|
||||
]
|
||||
} as Widget.BoxProps)
|
||||
]
|
||||
} as Widget.BoxProps)
|
||||
]
|
||||
} as Widget.BoxProps)
|
||||
) : new Widget.Box({})
|
||||
)
|
||||
})
|
||||
} as Widget.BoxProps)
|
||||
} as Widget.WindowProps);
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
import { Astal, Gdk, Gtk, Widget } from "astal/gtk3";
|
||||
import { getDateTime } from "../scripts/time";
|
||||
import { execAsync, GLib, Process } from "astal";
|
||||
|
||||
|
||||
const { TOP, LEFT, RIGHT, BOTTOM } = Astal.WindowAnchor;
|
||||
|
||||
export const LogoutMenu: Widget.Window = new Widget.Window({
|
||||
namespace: "logout-menu",
|
||||
anchor: TOP | LEFT | RIGHT | BOTTOM,
|
||||
layer: Astal.Layer.OVERLAY,
|
||||
exclusivity: Astal.Exclusivity.IGNORE,
|
||||
monitor: 0,
|
||||
visible: false,
|
||||
widthRequest: Gdk.Screen.get_default()?.get_monitor_geometry(0)?.width,
|
||||
height_request: Gdk.Screen.get_default()?.get_monitor_geometry(0)?.height,
|
||||
child: new Widget.EventBox({
|
||||
className: "logout-menu",
|
||||
onClick: () => Process.exec_async("astal close logout-menu", () => {}),
|
||||
child: new Widget.Box({
|
||||
homogeneous: false,
|
||||
orientation: Gtk.Orientation.VERTICAL,
|
||||
children: [
|
||||
new Widget.Box({
|
||||
className: "top",
|
||||
expand: true,
|
||||
orientation: Gtk.Orientation.VERTICAL,
|
||||
children: [
|
||||
new Widget.Label({
|
||||
className: "time",
|
||||
label: getDateTime().as((dateTime: GLib.DateTime) =>
|
||||
dateTime.format("%H:%M"))
|
||||
} as Widget.LabelProps),
|
||||
new Widget.Label({
|
||||
className: "date",
|
||||
label: getDateTime().as((dateTime: GLib.DateTime) =>
|
||||
dateTime.format("%A, %B %d %Y"))
|
||||
} as Widget.LabelProps)
|
||||
]
|
||||
} as Widget.BoxProps),
|
||||
new Widget.Box({
|
||||
className: "button-row",
|
||||
homogeneous: true,
|
||||
expand: true,
|
||||
valign: Gtk.Align.CENTER,
|
||||
children: [
|
||||
new Widget.Button({
|
||||
className: "poweroff nf",
|
||||
label: "",
|
||||
onClick: "ask user if it's fr!"
|
||||
} as Widget.ButtonProps),
|
||||
new Widget.Button({
|
||||
className: "reboot nf",
|
||||
label: "",
|
||||
onClick: "ask user if it's fr!"
|
||||
} as Widget.ButtonProps),
|
||||
new Widget.Button({
|
||||
className: "suspend nf",
|
||||
label: "",
|
||||
onClick: "ask user if it's fr!"
|
||||
} as Widget.ButtonProps),
|
||||
new Widget.Button({
|
||||
className: "logout nf",
|
||||
label: "",
|
||||
onClick: () => execAsync("astal close logout-menu && bash -c 'loginctl terminate-user $USER'")
|
||||
} as Widget.ButtonProps),
|
||||
]
|
||||
} as Widget.BoxProps)
|
||||
]
|
||||
})
|
||||
} as Widget.EventBoxProps)
|
||||
} as Widget.WindowProps);
|
||||
Reference in New Issue
Block a user