This commit is contained in:
sankalp committed 2024-06-28 12:12:56 +05:45
1 parent 8b3560aa8b
commit 8aad8fdec2
2 files changed
+15 -9

No files matched your search

+5 -1
View File
@@ -311,10 +311,14 @@ function KeyboardLayout() {
function OpenSideBar() { function OpenSideBar() {
const button = Widget.Button({ const button = Widget.Button({
class_name: "filled_tonal_button awesome_icon", class_name: "filled_tonal_button awesome_icon",
on_clicked: () => { on_primary_click: () => {
App.toggleWindow("sidebar") App.toggleWindow("sidebar")
// Utils.execAsync(["ags", "-t", "sidebar"]) // Utils.execAsync(["ags", "-t", "sidebar"])
}, },
on_secondary_click: () => {
OpenSettings()
},
label: "" label: ""
}) })
+10 -8
View File
@@ -73,7 +73,7 @@ export const Notification = (notification: NotificationType, dismiss = true) =>
}), }),
Widget.Label({ Widget.Label({
class_name: "notification-time", class_name: "notification-time",
label: GLib.DateTime.new_from_unix_local(notification.time).format("%I:%M %p"), label: GLib.DateTime.new_from_unix_local(notification.time).format("%H:%M"),
}), }),
Widget.Button({ Widget.Button({
class_name: "standard_icon_button", class_name: "standard_icon_button",
@@ -99,7 +99,6 @@ export const Notification = (notification: NotificationType, dismiss = true) =>
wrap_mode: Pango.WrapMode.WORD_CHAR, wrap_mode: Pango.WrapMode.WORD_CHAR,
xalign: 0, xalign: 0,
wrap: true, wrap: true,
// HACK: remove linebreaks, so lines property works properly
label: notification.body.replace(/(\r\n|\n|\r)/gm, " "), label: notification.body.replace(/(\r\n|\n|\r)/gm, " "),
}), }),
notification.hints.value ? notification.hints.value ?
@@ -206,21 +205,24 @@ export function NotificationPopups(
return return
const original = list.children.find(n => n.attribute.id === id); const original = list.children.find(n => n.attribute.id === id);
const replace = original?.attribute.id; const replace = original?.attribute.id;
let notification;
if (!replace) { if (!replace) {
const notification = revealer(n, false, dismiss); notification = revealer(n, false, dismiss);
notification.attribute.count = 1; notification.attribute.count = 1;
list.pack_end(notification, false, false, 0) list.pack_end(notification, false, false, 0)
} }
else if (original) { else if (original) {
const notification = revealer(n, true, dismiss); notification = revealer(n, true, dismiss);
notification.attribute.count++; notification.attribute.count++;
original.destroy() original.destroy()
list.pack_end(notification, false, false, 0) list.pack_end(notification, false, false, 0)
} }
if (timeout) if (timeout)
setTimeout(() => { Utils.timeout(7500, () => {
onDismissed(_, id) if (notification !== null && !notification.disposed) {
}, 5000) onDismissed(_, id)
}
})
} }
function onDismissed(_: any, id: number) { function onDismissed(_: any, id: number) {
@@ -243,7 +245,7 @@ export function Notifications(monitor = 0) {
monitor, monitor,
name: `notifications${monitor}`, name: `notifications${monitor}`,
class_name: "notification-popups", class_name: "notification-popups",
anchor: ["bottom", "right"], anchor: ["top", "right"],
type: Gtk.WindowType.POPUP, type: Gtk.WindowType.POPUP,
child: Widget.Box({ child: Widget.Box({
css: "min-width: 2px; min-height: 2px;", css: "min-width: 2px; min-height: 2px;",