summaryrefslogtreecommitdiff
path: root/src/modules/bar.tsx
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-03-26 13:03:20 +1100
committer2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-03-26 13:03:20 +1100
commit4ae165172024b9dce5db3664a16db68dc42ba400 (patch)
treed3230716c0bb8eab6ddf7d8b17825ea569f92c69 /src/modules/bar.tsx
parentcalendar: notifications for events (diff)
downloadcaelestia-shell-4ae165172024b9dce5db3664a16db68dc42ba400.tar.gz
caelestia-shell-4ae165172024b9dce5db3664a16db68dc42ba400.tar.bz2
caelestia-shell-4ae165172024b9dce5db3664a16db68dc42ba400.zip
sidebar: notifpane + scroll switch panes
Also placeholder for empty lists (notifs and events) To switch panes, primary click + scroll
Diffstat (limited to 'src/modules/bar.tsx')
-rw-r--r--src/modules/bar.tsx16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/modules/bar.tsx b/src/modules/bar.tsx
index 85d2add..65a2727 100644
--- a/src/modules/bar.tsx
+++ b/src/modules/bar.tsx
@@ -1,3 +1,4 @@
+import type SideBar from "@/modules/sidebar";
import type { Monitor } from "@/services/monitors";
import Players from "@/services/players";
import Updates from "@/services/updates";
@@ -72,10 +73,19 @@ const togglePopup = (self: JSX.Element, event: Astal.ClickEvent, name: string) =
}
};
+const switchPane = (name: string) => {
+ const sidebar = App.get_window("sidebar") as SideBar | null;
+ if (sidebar) {
+ if (sidebar.visible && sidebar.shown.get() === name) sidebar.hide();
+ else sidebar.show();
+ sidebar.shown.set(name);
+ }
+};
+
const OSIcon = () => (
<button
className="module os-icon"
- onClick={(self, event) => event.button === Astal.MouseButton.PRIMARY && togglePopup(self, event, "sideleft")}
+ onClick={(_, event) => event.button === Astal.MouseButton.PRIMARY && switchPane("dashboard")}
>
{osIcon}
</button>
@@ -446,9 +456,7 @@ const PkgUpdates = () => (
const NotifCount = () => (
<button
- onClick={(self, event) =>
- event.button === Astal.MouseButton.PRIMARY && togglePopup(self, event, "notifications")
- }
+ onClick={(_, event) => event.button === Astal.MouseButton.PRIMARY && switchPane("notifpane")}
setup={self =>
setupCustomTooltip(
self,