diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-03-26 13:03:20 +1100 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-03-26 13:03:20 +1100 |
| commit | 4ae165172024b9dce5db3664a16db68dc42ba400 (patch) | |
| tree | d3230716c0bb8eab6ddf7d8b17825ea569f92c69 /src/modules/sidebar/index.tsx | |
| parent | calendar: notifications for events (diff) | |
| download | caelestia-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/sidebar/index.tsx')
| -rw-r--r-- | src/modules/sidebar/index.tsx | 35 |
1 files changed, 24 insertions, 11 deletions
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 = [<Dashboard />, <NotifPane />]; + this.add( - <box vertical className="sidebar"> - <stack - vexpand - transitionType={Gtk.StackTransitionType.SLIDE_UP_DOWN} - transitionDuration={200} - shown={bind(this.shown)} - > - <Dashboard /> - </stack> - </box> + <eventbox + onScroll={(_, event) => { + 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); + } + }} + > + <box vertical className="sidebar"> + <stack + vexpand + transitionType={Gtk.StackTransitionType.SLIDE_UP_DOWN} + transitionDuration={200} + shown={bind(this.shown)} + > + {panes} + </stack> + </box> + </eventbox> ); } } |