ags: lot of stuff lmao
This commit is contained in:
@@ -3,7 +3,7 @@ import { Connectable } from "astal/binding";
|
||||
|
||||
|
||||
/** !!TODO!! Needs more work and testing
|
||||
* I(retrozinndev) don't have a monitor that has software-controlled brightness
|
||||
* I(retrozinndev) don't have a monitor that has software-controlled brightness :(
|
||||
*/
|
||||
@register({ GTypeName: "Brightness" })
|
||||
class Brightness extends GObject.Object implements Connectable {
|
||||
@@ -16,7 +16,7 @@ class Brightness extends GObject.Object implements Connectable {
|
||||
|
||||
constructor(backlightDevice?: string) {
|
||||
super();
|
||||
this.backlight = backlightDevice || "";
|
||||
this.backlight = backlightDevice || "intel_backlight";
|
||||
this.max = Number.parseInt(exec(`brightnessctl -d ${backlightDevice} max`))
|
||||
this.brightness = Number.parseInt(exec(`brightnessctl -d ${backlightDevice} get`))
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import { Subscribable } from "astal/binding";
|
||||
import { GObject, property, register, Variable } from "astal";
|
||||
import { Windows } from "../windows";
|
||||
import { FloatingNotifications } from "../window/FloatingNotifications";
|
||||
import { Gtk, Widget } from "astal/gtk3";
|
||||
|
||||
@register({ GTypeName: "Notifications" })
|
||||
class NotificationsClass extends GObject.Object implements Subscribable {
|
||||
@@ -74,7 +75,6 @@ class NotificationsClass extends GObject.Object implements Subscribable {
|
||||
|
||||
notification.urgency !== AstalNotifd.Urgency.CRITICAL &&
|
||||
timeout(notificationTimeout, () => {
|
||||
notification.dismiss();
|
||||
this.notifications.set(this.notifications.get().filter((item) => item.id !== notification.id));
|
||||
this.addHistory(notification);
|
||||
});
|
||||
@@ -106,4 +106,67 @@ class NotificationsClass extends GObject.Object implements Subscribable {
|
||||
}
|
||||
}
|
||||
|
||||
function NotificationWidget(notification: AstalNotifd.Notification): Gtk.Widget {
|
||||
return new Widget.Box({
|
||||
className: "notification",
|
||||
homogeneous: false,
|
||||
expand: false,
|
||||
orientation: Gtk.Orientation.VERTICAL,
|
||||
children: [
|
||||
new Widget.Box({
|
||||
className: "top",
|
||||
orientation: Gtk.Orientation.HORIZONTAL,
|
||||
hexpand: true,
|
||||
vexpand: false,
|
||||
children: [
|
||||
new Widget.Icon({
|
||||
className: "icon",
|
||||
visible: notification.appIcon !== "",
|
||||
icon: notification.appIcon || "image-missing",
|
||||
iconSize: Gtk.IconSize.DND,
|
||||
css: ".icon { font-size: 24px; }"
|
||||
}),
|
||||
new Widget.Label({
|
||||
className: "app-name",
|
||||
halign: Gtk.Align.START,
|
||||
label: notification.appName || "Unknown Application"
|
||||
} as Widget.LabelProps),
|
||||
new Widget.Button({
|
||||
className: "close nf",
|
||||
onClick: () => notification.dismiss(),
|
||||
label: ""
|
||||
} 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: `box.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);
|
||||
}
|
||||
|
||||
export const Notifications = new NotificationsClass();
|
||||
|
||||
@@ -41,7 +41,7 @@ function watch(): void {
|
||||
`${path}`,
|
||||
(file: string) => {
|
||||
// Ignore tmp files
|
||||
if(!file.endsWith('~')) {
|
||||
if(!file.endsWith('~') && !Number.isNaN(file)) {
|
||||
console.log(`[LOG] Stylesheet ${file} file updated`)
|
||||
compileStyle();
|
||||
applyStyle();
|
||||
|
||||
Reference in New Issue
Block a user