diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-09-19 00:08:56 +1000 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-09-19 00:08:56 +1000 |
| commit | 1e35caa6f7a3b8e3aaf77bfeb307d15c3ea7e32d (patch) | |
| tree | 2b717d58ba7c41a0cf2130e83354daed88d6e6c0 /modules/sidebar/NotifGroup.qml | |
| parent | notifs: persistent notifs + better sidebar notifs (diff) | |
| download | caelestia-shell-1e35caa6f7a3b8e3aaf77bfeb307d15c3ea7e32d.tar.gz caelestia-shell-1e35caa6f7a3b8e3aaf77bfeb307d15c3ea7e32d.tar.bz2 caelestia-shell-1e35caa6f7a3b8e3aaf77bfeb307d15c3ea7e32d.zip | |
sidebar/notifs: add mouse actions
Diffstat (limited to 'modules/sidebar/NotifGroup.qml')
| -rw-r--r-- | modules/sidebar/NotifGroup.qml | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/modules/sidebar/NotifGroup.qml b/modules/sidebar/NotifGroup.qml index 4476bf9..83cffcd 100644 --- a/modules/sidebar/NotifGroup.qml +++ b/modules/sidebar/NotifGroup.qml @@ -24,6 +24,15 @@ StyledRect { readonly property bool expanded: props.expandedNotifs.includes(modelData) + function toggleExpand(expand: bool): void { + if (expand) { + if (!expanded) + props.expandedNotifs.push(modelData); + } else if (expanded) { + props.expandedNotifs.splice(props.expandedNotifs.indexOf(modelData), 1); + } + } + anchors.left: parent?.left anchors.right: parent?.right implicitHeight: content.implicitHeight + Appearance.padding.normal * 2 @@ -156,10 +165,7 @@ StyledRect { color: root.urgency === "critical" ? Colours.palette.m3onError : Colours.palette.m3onSurface function onClicked(): void { - if (root.expanded) - root.props.expandedNotifs.splice(root.props.expandedNotifs.indexOf(root.modelData), 1); - else - root.props.expandedNotifs.push(root.modelData); + root.toggleExpand(!root.expanded); } } @@ -197,6 +203,7 @@ StyledRect { props: root.props notifs: root.notifs expanded: root.expanded + onRequestToggleExpand: expand => root.toggleExpand(expand) } } } |