mirror of
https://github.com/Theaninova/TheaninovOS.git
synced 2026-04-20 19:48:59 +00:00
feat: update system
This commit is contained in:
@@ -12,52 +12,39 @@ import HoverRevealer from "../../misc/HoverRevealer.js";
|
||||
export default ({ direction = "left" } = {}) =>
|
||||
HoverRevealer({
|
||||
class_name: "notifications panel-button",
|
||||
eventboxConnections: [
|
||||
["button-press-event", () => App.openWindow("dashboard")],
|
||||
[
|
||||
Notifications,
|
||||
(box) =>
|
||||
(box.visible =
|
||||
Notifications.notifications.length > 0 || Notifications.dnd),
|
||||
],
|
||||
],
|
||||
connections: [
|
||||
[
|
||||
Notifications,
|
||||
(revealer) => {
|
||||
const title = Notifications.notifications[0]?.summary;
|
||||
if (revealer._title === title) return;
|
||||
setupEventBox: (box) =>
|
||||
box
|
||||
.on("button-press-event", () => App.openWindow("dashboard"))
|
||||
.hook(
|
||||
Notifications,
|
||||
() =>
|
||||
(box.visible =
|
||||
Notifications.notifications.length > 0 || Notifications.dnd),
|
||||
),
|
||||
|
||||
revealer._title = title;
|
||||
revealer.reveal_child = true;
|
||||
Utils.timeout(3000, () => {
|
||||
revealer.reveal_child = false;
|
||||
});
|
||||
},
|
||||
],
|
||||
],
|
||||
setupRevealer: (self) =>
|
||||
self.hook(Notifications, () => {
|
||||
let title = "";
|
||||
const summary = Notifications.notifications[0]?.summary;
|
||||
if (title === summary) return;
|
||||
|
||||
title = summary;
|
||||
self.reveal_child = true;
|
||||
Utils.timeout(3000, () => {
|
||||
self.reveal_child = false;
|
||||
});
|
||||
}),
|
||||
direction,
|
||||
indicator: Widget.Icon({
|
||||
binds: [
|
||||
[
|
||||
"icon",
|
||||
Notifications,
|
||||
"dnd",
|
||||
(dnd) =>
|
||||
dnd ? icons.notifications.silent : icons.notifications.noisy,
|
||||
],
|
||||
],
|
||||
icon: Notifications.bind("dnd").transform(
|
||||
(dnd) => icons.notifications[dnd ? "silent" : "noisy"],
|
||||
),
|
||||
}),
|
||||
child: Widget.Label({
|
||||
truncate: "end",
|
||||
max_width_chars: 40,
|
||||
binds: [
|
||||
[
|
||||
"label",
|
||||
Notifications,
|
||||
"notifications",
|
||||
(n) => n.reverse()[0]?.summary || "",
|
||||
],
|
||||
],
|
||||
label: Notifications.bind("notifications").transform(
|
||||
(n) => n.reverse()[0]?.summary || "",
|
||||
),
|
||||
}),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user