From 4ae165172024b9dce5db3664a16db68dc42ba400 Mon Sep 17 00:00:00 2001
From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>
Date: Wed, 26 Mar 2025 13:03:20 +1100
Subject: sidebar: notifpane + scroll switch panes
Also placeholder for empty lists (notifs and events)
To switch panes, primary click + scroll
---
src/modules/sidebar/dashboard.tsx | 2 +-
src/modules/sidebar/index.tsx | 35 ++++++++++++++++++---------
src/modules/sidebar/modules/notifications.tsx | 28 ++++++++++++++++-----
src/modules/sidebar/modules/upcoming.tsx | 22 ++++++++++++++---
src/modules/sidebar/notifpane.tsx | 7 ++++++
5 files changed, 73 insertions(+), 21 deletions(-)
create mode 100644 src/modules/sidebar/notifpane.tsx
(limited to 'src/modules/sidebar')
diff --git a/src/modules/sidebar/dashboard.tsx b/src/modules/sidebar/dashboard.tsx
index 936502b..d1d1185 100644
--- a/src/modules/sidebar/dashboard.tsx
+++ b/src/modules/sidebar/dashboard.tsx
@@ -127,7 +127,7 @@ export default () => (
))}
-
+
diff --git a/src/modules/sidebar/index.tsx b/src/modules/sidebar/index.tsx
index 3b62d82..a908430 100644
--- a/src/modules/sidebar/index.tsx
+++ b/src/modules/sidebar/index.tsx
@@ -1,7 +1,8 @@
import type { Monitor } from "@/services/monitors";
import { bind, register, Variable } from "astal";
-import { App, Astal, Gtk, Widget } from "astal/gtk3";
+import { App, Astal, Gdk, Gtk, Widget } from "astal/gtk3";
import Dashboard from "./dashboard";
+import NotifPane from "./notifpane";
@register()
export default class SideBar extends Widget.Window {
@@ -18,17 +19,29 @@ export default class SideBar extends Widget.Window {
// visible: false,
});
+ const panes = [, ];
+
this.add(
-
-
-
-
-
+ {
+ if (event.modifier & Gdk.ModifierType.BUTTON1_MASK) {
+ const index = panes.findIndex(p => p.name === this.shown.get()) + (event.delta_y < 0 ? -1 : 1);
+ if (index < 0 || index >= panes.length) return;
+ this.shown.set(panes[index].name);
+ }
+ }}
+ >
+
+
+ {panes}
+
+
+
);
}
}
diff --git a/src/modules/sidebar/modules/notifications.tsx b/src/modules/sidebar/modules/notifications.tsx
index eb8f0aa..9a9f440 100644
--- a/src/modules/sidebar/modules/notifications.tsx
+++ b/src/modules/sidebar/modules/notifications.tsx
@@ -3,7 +3,7 @@ import { bind } from "astal";
import { Astal, Gtk } from "astal/gtk3";
import AstalNotifd from "gi://AstalNotifd";
-const List = () => (
+const List = ({ compact }: { compact?: boolean }) => (
(
const map = new Map();
const addNotification = (notification: AstalNotifd.Notification) => {
- const notif = () as Notification;
+ const notif = () as Notification;
notif.connect("destroy", () => map.get(notification.id) === notif && map.delete(notification.id));
map.get(notification.id)?.destroyWithAnims();
map.set(notification.id, notif);
@@ -42,7 +42,16 @@ const List = () => (
/>
);
-export default () => (
+const NoNotifs = () => (
+
+
+
+
+
+
+);
+
+export default ({ compact }: { compact?: boolean }) => (
-
-
-
+ (n.length > 0 ? "list" : "empty"))}
+ >
+
+
+
+
+
);
diff --git a/src/modules/sidebar/modules/upcoming.tsx b/src/modules/sidebar/modules/upcoming.tsx
index e2389e8..76dea56 100644
--- a/src/modules/sidebar/modules/upcoming.tsx
+++ b/src/modules/sidebar/modules/upcoming.tsx
@@ -61,6 +61,15 @@ const List = () => (
);
+const NoEvents = () => (
+
+
+
+
+
+
+);
+
export default () => (
@@ -76,8 +85,15 @@ export default () => (
label=" Reload"
/>
-
-
-
+ (n > 0 ? "list" : "empty"))}
+ >
+
+
+
+
+
);
diff --git a/src/modules/sidebar/notifpane.tsx b/src/modules/sidebar/notifpane.tsx
new file mode 100644
index 0000000..79290e2
--- /dev/null
+++ b/src/modules/sidebar/notifpane.tsx
@@ -0,0 +1,7 @@
+import Notifications from "./modules/notifications";
+
+export default () => (
+
+
+
+);
--
cgit v1.2.3-freya