diff --git a/modules/bar/Bar.qml b/modules/bar/Bar.qml index 01c92e2..8ca1c91 100644 --- a/modules/bar/Bar.qml +++ b/modules/bar/Bar.qml @@ -5,6 +5,7 @@ import Quickshell import "components" import "components/bluetooth" import "components/hyprland" +import "components/notifications" import "components/tray" Scope { diff --git a/modules/bar/components/notifications/NotificationMenu.qml b/modules/bar/components/notifications/NotificationMenu.qml new file mode 100644 index 0000000..064d3f3 --- /dev/null +++ b/modules/bar/components/notifications/NotificationMenu.qml @@ -0,0 +1,34 @@ +pragma ComponentBehavior: Bound + +import qs.config +import qs.widgets +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import Quickshell +import Quickshell.Services.Notifications +import Quickshell.Widgets + +StyledPopupWindow { + id: root + + backgroundColor: Theme.palette.base300 + margins: 16 + radius: 8 + + content: ColumnLayout { + spacing: 8 + + RowLayout { + StyledText { + text: "Enabled" + } + + Switch { + checkable: !!Notifications + checked: Bluetooth.defaultAdapter?.enabled ?? false + onClicked: Bluetooth.defaultAdapter.enabled = checked + } + } + } +} diff --git a/modules/bar/components/Notifications.qml b/modules/bar/components/notifications/Notifications.qml similarity index 58% rename from modules/bar/components/Notifications.qml rename to modules/bar/components/notifications/Notifications.qml index d0cb6cd..6896f9b 100644 --- a/modules/bar/components/Notifications.qml +++ b/modules/bar/components/notifications/Notifications.qml @@ -5,10 +5,10 @@ import qs.widgets import QtQuick StyledButton { - id: clickable + id: root onClicked: { - Notifications.clear(); + menu.toggle(); } content: StyledText { @@ -19,16 +19,24 @@ StyledButton { font.bold: true text: Icons.bell - color: clickable.containsMouse ? Theme.palette.base300 : Theme.palette.basecontent + color: root.containsMouse ? Theme.palette.base300 : Theme.palette.basecontent states: State { when: Notifications.hasNotifications PropertyChanges { text { text: Icons.bellRing - color: clickable.containsMouse ? Theme.palette.base300 : Theme.palette.secondary + color: root.containsMouse ? Theme.palette.base300 : Theme.palette.secondary } } } } + + NotificationMenu { + id: menu + + anchor.item: root + anchor.rect.x: root.width / 2 - width / 2 + anchor.rect.y: root.height + 8 + } }