This commit is contained in:
Ly-sec 2025-09-06 02:16:13 +02:00
commit eb072ff88a
14 changed files with 242 additions and 205 deletions

View file

@ -7,7 +7,7 @@ import qs.Commons
import qs.Services import qs.Services
import qs.Widgets import qs.Widgets
Row { RowLayout {
id: root id: root
property ShellScreen screen property ShellScreen screen
@ -15,7 +15,7 @@ Row {
readonly property real minWidth: 160 readonly property real minWidth: 160
readonly property real maxWidth: 400 readonly property real maxWidth: 400
anchors.verticalCenter: parent.verticalCenter Layout.alignment: Qt.AlignVCenter
spacing: Style.marginS * scaling spacing: Style.marginS * scaling
visible: getTitle() !== "" visible: getTitle() !== ""
@ -43,15 +43,13 @@ Row {
} }
Rectangle { Rectangle {
// Let the Rectangle size itself based on its content (the Row) id: windowTitleRect
visible: root.visible visible: root.visible
width: row.width + Style.marginM * 2 * scaling Layout.preferredWidth: contentLayout.implicitWidth + Style.marginM * 2 * scaling
height: Math.round(Style.capsuleHeight * scaling) Layout.preferredHeight: Math.round(Style.capsuleHeight * scaling)
radius: Math.round(Style.radiusM * scaling) radius: Math.round(Style.radiusM * scaling)
color: Color.mSurfaceVariant color: Color.mSurfaceVariant
anchors.verticalCenter: parent.verticalCenter
Item { Item {
id: mainContainer id: mainContainer
anchors.fill: parent anchors.fill: parent
@ -59,16 +57,16 @@ Row {
anchors.rightMargin: Style.marginS * scaling anchors.rightMargin: Style.marginS * scaling
clip: true clip: true
Row { RowLayout {
id: row id: contentLayout
anchors.verticalCenter: parent.verticalCenter anchors.centerIn: parent
spacing: Style.marginS * scaling spacing: Style.marginS * scaling
// Window icon // Window icon
Item { Item {
width: Style.fontSizeL * scaling * 1.2 Layout.preferredWidth: Style.fontSizeL * scaling * 1.2
height: Style.fontSizeL * scaling * 1.2 Layout.preferredHeight: Style.fontSizeL * scaling * 1.2
anchors.verticalCenter: parent.verticalCenter Layout.alignment: Qt.AlignVCenter
visible: getTitle() !== "" && Settings.data.bar.showActiveWindowIcon visible: getTitle() !== "" && Settings.data.bar.showActiveWindowIcon
IconImage { IconImage {
@ -85,24 +83,25 @@ Row {
id: titleText id: titleText
// For short titles, show full. For long titles, truncate and expand on hover // For short titles, show full. For long titles, truncate and expand on hover
width: { Layout.preferredWidth: {
if (mouseArea.containsMouse) { if (mouseArea.containsMouse) {
return Math.round(Math.min(fullTitleMetrics.contentWidth, root.maxWidth * scaling)) return Math.round(Math.min(fullTitleMetrics.contentWidth, root.maxWidth * scaling))
} else { } else {
return Math.round(Math.min(fullTitleMetrics.contentWidth, root.minWidth * scaling)) return Math.round(Math.min(fullTitleMetrics.contentWidth, root.minWidth * scaling))
} }
} }
Layout.alignment: Qt.AlignVCenter
horizontalAlignment: Text.AlignLeft horizontalAlignment: Text.AlignLeft
text: getTitle() text: getTitle()
font.pointSize: Style.fontSizeS * scaling font.pointSize: Style.fontSizeS * scaling
font.weight: Style.fontWeightMedium font.weight: Style.fontWeightMedium
elide: mouseArea.containsMouse ? Text.ElideNone : Text.ElideRight elide: mouseArea.containsMouse ? Text.ElideNone : Text.ElideRight
anchors.verticalCenter: parent.verticalCenter
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
color: Color.mSecondary color: Color.mSecondary
clip: true clip: true
Behavior on width { Behavior on Layout.preferredWidth {
NumberAnimation { NumberAnimation {
duration: Style.animationSlow duration: Style.animationSlow
easing.type: Easing.InOutCubic easing.type: Easing.InOutCubic

View file

@ -1,4 +1,5 @@
import QtQuick import QtQuick
import QtQuick.Layouts
import Quickshell import Quickshell
import Quickshell.Wayland import Quickshell.Wayland
import Quickshell.Io import Quickshell.Io
@ -6,7 +7,7 @@ import qs.Commons
import qs.Services import qs.Services
import qs.Widgets import qs.Widgets
Row { RowLayout {
id: root id: root
property ShellScreen screen property ShellScreen screen
@ -18,12 +19,17 @@ Row {
// Use the shared service for keyboard layout // Use the shared service for keyboard layout
property string currentLayout: KeyboardLayoutService.currentLayout property string currentLayout: KeyboardLayoutService.currentLayout
width: pill.width Layout.preferredWidth: pill.implicitWidth
height: pill.height Layout.preferredHeight: pill.implicitHeight
spacing: 0
NPill { NPill {
id: pill id: pill
Layout.alignment: Qt.AlignCenter
Layout.fillWidth: false
Layout.fillHeight: false
rightOpen: BarWidgetRegistry.getNPillDirection(root) rightOpen: BarWidgetRegistry.getNPillDirection(root)
icon: "keyboard_alt" icon: "keyboard_alt"
iconCircleColor: Color.mPrimary iconCircleColor: Color.mPrimary

View file

@ -18,12 +18,13 @@ RowLayout {
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
spacing: Style.marginS * scaling spacing: Style.marginS * scaling
visible: MediaService.currentPlayer !== null && MediaService.canPlay visible: MediaService.currentPlayer !== null && MediaService.canPlay
width: MediaService.currentPlayer !== null && MediaService.canPlay ? implicitWidth : 0 Layout.preferredWidth: MediaService.currentPlayer !== null && MediaService.canPlay ? implicitWidth : 0
function getTitle() { function getTitle() {
return MediaService.trackTitle + (MediaService.trackArtist !== "" ? ` - ${MediaService.trackArtist}` : "") return MediaService.trackTitle + (MediaService.trackArtist !== "" ? ` - ${MediaService.trackArtist}` : "")
} }
// A hidden text element to safely measure the full title width
NText { NText {
id: fullTitleMetrics id: fullTitleMetrics
visible: false visible: false
@ -33,20 +34,36 @@ RowLayout {
Rectangle { Rectangle {
id: mediaMini id: mediaMini
width: contentLayout.implicitWidth + Style.marginS * 2 * scaling
height: Math.round(Style.capsuleHeight * scaling) Layout.preferredWidth: rowLayout.implicitWidth + Style.marginM * 2 * scaling
radius: Math.round(Style.radiusM * scaling) Layout.preferredHeight: Math.round(Style.capsuleHeight * scaling)
color: Color.mSurfaceVariant
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
// --- Visualizer Loaders --- radius: Math.round(Style.radiusM * scaling)
color: Color.mSurfaceVariant
// Used to anchor the tooltip, so the tooltip does not move when the content expands
Item {
id: anchor
height: parent.height
width: 200 * scaling
}
Item {
id: mainContainer
anchors.fill: parent
anchors.leftMargin: Style.marginS * scaling
anchors.rightMargin: Style.marginS * scaling
Loader { Loader {
anchors.centerIn: parent anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
active: Settings.data.audio.showMiniplayerCava && Settings.data.audio.visualizerType == "linear" active: Settings.data.audio.showMiniplayerCava && Settings.data.audio.visualizerType == "linear"
&& MediaService.isPlaying && MediaService.trackLength > 0 && MediaService.isPlaying
z: 0 z: 0
sourceComponent: LinearSpectrum { sourceComponent: LinearSpectrum {
width: mediaMini.width - Style.marginS * scaling width: mainContainer.width - Style.marginS * scaling
height: 20 * scaling height: 20 * scaling
values: CavaService.values values: CavaService.values
fillColor: Color.mOnSurfaceVariant fillColor: Color.mOnSurfaceVariant
@ -55,13 +72,15 @@ RowLayout {
} }
Loader { Loader {
anchors.centerIn: parent anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
active: Settings.data.audio.showMiniplayerCava && Settings.data.audio.visualizerType == "mirrored" active: Settings.data.audio.showMiniplayerCava && Settings.data.audio.visualizerType == "mirrored"
&& MediaService.isPlaying && MediaService.trackLength > 0 && MediaService.isPlaying
z: 0 z: 0
sourceComponent: MirroredSpectrum { sourceComponent: MirroredSpectrum {
width: mediaMini.width - Style.marginS * scaling width: mainContainer.width - Style.marginS * scaling
height: mediaMini.height - Style.marginS * scaling height: mainContainer.height - Style.marginS * scaling
values: CavaService.values values: CavaService.values
fillColor: Color.mOnSurfaceVariant fillColor: Color.mOnSurfaceVariant
opacity: 0.4 opacity: 0.4
@ -69,50 +88,59 @@ RowLayout {
} }
Loader { Loader {
anchors.centerIn: parent anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
active: Settings.data.audio.showMiniplayerCava && Settings.data.audio.visualizerType == "wave" active: Settings.data.audio.showMiniplayerCava && Settings.data.audio.visualizerType == "wave"
&& MediaService.isPlaying && MediaService.trackLength > 0 && MediaService.isPlaying
z: 0 z: 0
sourceComponent: WaveSpectrum { sourceComponent: WaveSpectrum {
width: mediaMini.width - Style.marginS * scaling width: mainContainer.width - Style.marginS * scaling
height: mediaMini.height - Style.marginS * scaling height: mainContainer.height - Style.marginS * scaling
values: CavaService.values values: CavaService.values
fillColor: Color.mOnSurfaceVariant fillColor: Color.mOnSurfaceVariant
opacity: 0.4 opacity: 0.4
} }
} }
// --- Main Content Layout ---
RowLayout { RowLayout {
id: contentLayout id: rowLayout
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.leftMargin: Style.marginS * scaling
spacing: Style.marginS * scaling spacing: Style.marginS * scaling
z: 1 z: 1 // Above the visualizer
NIcon { NIcon {
id: windowIcon id: windowIcon
text: MediaService.isPlaying ? "pause" : "play_arrow" text: MediaService.isPlaying ? "pause" : "play_arrow"
font.pointSize: Style.fontSizeL * scaling font.pointSize: Style.fontSizeL * scaling
verticalAlignment: Text.AlignVCenter
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
visible: !Settings.data.audio.showMiniplayerAlbumArt && getTitle() !== "" && !trackArt.visible visible: !Settings.data.audio.showMiniplayerAlbumArt && getTitle() !== "" && !trackArt.visible
} }
ColumnLayout {
Layout.alignment: Qt.AlignVCenter
visible: Settings.data.audio.showMiniplayerAlbumArt
spacing: 0
Item {
Layout.preferredWidth: Math.round(18 * scaling)
Layout.preferredHeight: Math.round(18 * scaling)
NImageCircled { NImageCircled {
id: trackArt id: trackArt
anchors.fill: parent
imagePath: MediaService.trackArtUrl imagePath: MediaService.trackArtUrl
fallbackIcon: MediaService.isPlaying ? "pause" : "play_arrow" fallbackIcon: MediaService.isPlaying ? "pause" : "play_arrow"
borderWidth: 0 borderWidth: 0
border.color: Color.transparent border.color: Color.transparent
Layout.preferredWidth: Math.round(18 * scaling) }
Layout.preferredHeight: Math.round(18 * scaling) }
Layout.alignment: Qt.AlignVCenter
visible: Settings.data.audio.showMiniplayerAlbumArt
} }
NText { NText {
id: titleText id: titleText
Layout.preferredWidth: { Layout.preferredWidth: {
if (mouseArea.containsMouse) { if (mouseArea.containsMouse) {
return Math.round(Math.min(fullTitleMetrics.contentWidth, root.maxWidth * scaling)) return Math.round(Math.min(fullTitleMetrics.contentWidth, root.maxWidth * scaling))
@ -120,12 +148,14 @@ RowLayout {
return Math.round(Math.min(fullTitleMetrics.contentWidth, root.minWidth * scaling)) return Math.round(Math.min(fullTitleMetrics.contentWidth, root.minWidth * scaling))
} }
} }
Layout.alignment: Qt.AlignVCenter
text: getTitle() text: getTitle()
font.pointSize: Style.fontSizeS * scaling font.pointSize: Style.fontSizeS * scaling
font.weight: Style.fontWeightMedium font.weight: Style.fontWeightMedium
elide: Text.ElideRight elide: Text.ElideRight
verticalAlignment: Text.AlignVCenter
color: Color.mTertiary color: Color.mTertiary
Layout.alignment: Qt.AlignVCenter
Behavior on Layout.preferredWidth { Behavior on Layout.preferredWidth {
NumberAnimation { NumberAnimation {
@ -136,6 +166,7 @@ RowLayout {
} }
} }
// Mouse area for hover detection
MouseArea { MouseArea {
id: mouseArea id: mouseArea
anchors.fill: parent anchors.fill: parent
@ -147,12 +178,15 @@ RowLayout {
MediaService.playPause() MediaService.playPause()
} else if (mouse.button == Qt.RightButton) { } else if (mouse.button == Qt.RightButton) {
MediaService.next() MediaService.next()
// Need to hide the tooltip instantly
tooltip.visible = false tooltip.visible = false
} else if (mouse.button == Qt.MiddleButton) { } else if (mouse.button == Qt.MiddleButton) {
MediaService.previous() MediaService.previous()
// Need to hide the tooltip instantly
tooltip.visible = false tooltip.visible = false
} }
} }
onEntered: { onEntered: {
if (tooltip.text !== "") { if (tooltip.text !== "") {
tooltip.show() tooltip.show()
@ -163,20 +197,21 @@ RowLayout {
} }
} }
} }
}
NTooltip { NTooltip {
id: tooltip id: tooltip
text: { text: {
var str = "" var str = ""
if (MediaService.canGoNext) { if (MediaService.canGoNext) {
str += "Right click for next\n" str += "Right click for next.\n"
} }
if (MediaService.canGoPrevious) { if (MediaService.canGoPrevious) {
str += "Middle click for previous\n" str += "Middle click for previous."
} }
return str return str
} }
target: mediaMini target: anchor
positionAbove: Settings.data.bar.position === "bottom" positionAbove: Settings.data.bar.position === "bottom"
} }
} }

View file

@ -23,11 +23,5 @@ NIconButton {
onClicked: PanelService.getPanel("notificationHistoryPanel")?.toggle(screen, this) onClicked: PanelService.getPanel("notificationHistoryPanel")?.toggle(screen, this)
onRightClicked: { onRightClicked: Settings.data.notifications.doNotDisturb = !Settings.data.notifications.doNotDisturb
Settings.data.notifications.doNotDisturb = !Settings.data.notifications.doNotDisturb
ToastService.showNotice(
Settings.data.notifications.doNotDisturb ? "Do Not Disturb enabled" : "Do Not Disturb disabled",
Settings.data.notifications.doNotDisturb ? "Notifications will be hidden but saved to history" : "Notifications will be shown normally",
"notice", false, 2000)
}
} }

View file

@ -2,6 +2,7 @@ pragma ComponentBehavior
import QtQuick import QtQuick
import QtQuick.Controls import QtQuick.Controls
import QtQuick.Layouts
import Quickshell import Quickshell
import Quickshell.Widgets import Quickshell.Widgets
import Quickshell.Wayland import Quickshell.Wayland
@ -17,15 +18,14 @@ Rectangle {
readonly property real itemSize: Style.baseWidgetSize * 0.8 * scaling readonly property real itemSize: Style.baseWidgetSize * 0.8 * scaling
// Always visible when there are toplevels // Always visible when there are toplevels
implicitWidth: taskbarRow.width + Style.marginM * scaling * 2 implicitWidth: taskbarLayout.implicitWidth + Style.marginM * scaling * 2
implicitHeight: Math.round(Style.capsuleHeight * scaling) implicitHeight: Math.round(Style.capsuleHeight * scaling)
radius: Math.round(Style.radiusM * scaling) radius: Math.round(Style.radiusM * scaling)
color: Color.mSurfaceVariant color: Color.mSurfaceVariant
Row { RowLayout {
id: taskbarRow id: taskbarLayout
anchors.verticalCenter: parent.verticalCenter anchors.centerIn: parent
anchors.horizontalCenter: parent.horizontalCenter
spacing: Style.marginXXS * root.scaling spacing: Style.marginXXS * root.scaling
Repeater { Repeater {
@ -35,8 +35,10 @@ Rectangle {
required property Toplevel modelData required property Toplevel modelData
property Toplevel toplevel: modelData property Toplevel toplevel: modelData
property bool isActive: ToplevelManager.activeToplevel === modelData property bool isActive: ToplevelManager.activeToplevel === modelData
width: root.itemSize
height: root.itemSize Layout.preferredWidth: root.itemSize
Layout.preferredHeight: root.itemSize
Layout.alignment: Qt.AlignCenter
Rectangle { Rectangle {
id: iconBackground id: iconBackground

View file

@ -26,26 +26,26 @@ Rectangle {
} }
visible: SystemTray.items.values.length > 0 visible: SystemTray.items.values.length > 0
implicitWidth: tray.width + Style.marginM * scaling * 2 implicitWidth: trayLayout.implicitWidth + Style.marginM * scaling * 2
implicitHeight: Math.round(Style.capsuleHeight * scaling) implicitHeight: Math.round(Style.capsuleHeight * scaling)
radius: Math.round(Style.radiusM * scaling) radius: Math.round(Style.radiusM * scaling)
color: Color.mSurfaceVariant color: Color.mSurfaceVariant
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
Row { RowLayout {
id: tray id: trayLayout
anchors.centerIn: parent
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
spacing: Style.marginS * scaling spacing: Style.marginS * scaling
Repeater { Repeater {
id: repeater id: repeater
model: SystemTray.items model: SystemTray.items
delegate: Item { delegate: Item {
width: itemSize Layout.preferredWidth: itemSize
height: itemSize Layout.preferredHeight: itemSize
Layout.alignment: Qt.AlignCenter
visible: modelData visible: modelData
IconImage { IconImage {
@ -146,14 +146,15 @@ Rectangle {
function open() { function open() {
visible = true visible = true
PanelService.willOpenPanel(trayPanel) PanelService.willOpenPanel(trayPanel)
} }
function close() { function close() {
visible = false visible = false
if (trayMenu.item) {
trayMenu.item.hideMenu() trayMenu.item.hideMenu()
} }
}
// Clicking outside of the rectangle to close // Clicking outside of the rectangle to close
MouseArea { MouseArea {

View file

@ -11,7 +11,7 @@ import qs.Services
Item { Item {
id: root id: root
property ShellScreen screen: null property ShellScreen screen
property real scaling: 1.0 property real scaling: 1.0
property bool isDestroying: false property bool isDestroying: false

View file

@ -130,7 +130,7 @@ Variants {
Rectangle { Rectangle {
id: dockContainer id: dockContainer
width: dock.width + 48 * scaling width: dockLayout.implicitWidth + 48 * scaling
height: iconSize * 1.4 * scaling height: iconSize * 1.4 * scaling
color: Qt.alpha(Color.mSurface, Settings.data.dock.backgroundOpacity) color: Qt.alpha(Color.mSurface, Settings.data.dock.backgroundOpacity)
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
@ -178,7 +178,7 @@ Variants {
Item { Item {
id: dock id: dock
width: runningAppsRow.width width: dockLayout.implicitWidth
height: parent.height - (20 * scaling) height: parent.height - (20 * scaling)
anchors.centerIn: parent anchors.centerIn: parent
@ -194,10 +194,10 @@ Variants {
return Icons.iconForAppId(toplevel.appId?.toLowerCase()) return Icons.iconForAppId(toplevel.appId?.toLowerCase())
} }
Row { RowLayout {
id: runningAppsRow id: dockLayout
spacing: Style.marginL * scaling spacing: Style.marginL * scaling
height: parent.height Layout.preferredHeight: parent.height
anchors.centerIn: parent anchors.centerIn: parent
Repeater { Repeater {
@ -205,8 +205,10 @@ Variants {
delegate: Rectangle { delegate: Rectangle {
id: appButton id: appButton
width: iconSize * scaling Layout.preferredWidth: iconSize * scaling
height: iconSize * scaling Layout.preferredHeight: iconSize * scaling
Layout.alignment: Qt.AlignCenter
color: Color.transparent color: Color.transparent
radius: Style.radiusM * scaling radius: Style.radiusM * scaling

View file

@ -40,10 +40,6 @@ Item {
} }
function toggleDND() { function toggleDND() {
Settings.data.notifications.doNotDisturb = !Settings.data.notifications.doNotDisturb Settings.data.notifications.doNotDisturb = !Settings.data.notifications.doNotDisturb
ToastService.showNotice(
Settings.data.notifications.doNotDisturb ? "Do Not Disturb enabled" : "Do Not Disturb disabled",
Settings.data.notifications.doNotDisturb ? "Notifications will be hidden but saved to history" : "Notifications will be shown normally",
"notice", false, 2000)
} }
} }

View file

@ -48,13 +48,7 @@ NPanel {
icon: Settings.data.notifications.doNotDisturb ? "notifications_off" : "notifications_active" icon: Settings.data.notifications.doNotDisturb ? "notifications_off" : "notifications_active"
tooltipText: Settings.data.notifications.doNotDisturb ? "Do Not Disturb (ON)" : "Do Not Disturb (OFF)" tooltipText: Settings.data.notifications.doNotDisturb ? "Do Not Disturb (ON)" : "Do Not Disturb (OFF)"
sizeRatio: 0.8 sizeRatio: 0.8
onClicked: { onClicked: Settings.data.notifications.doNotDisturb = !Settings.data.notifications.doNotDisturb
Settings.data.notifications.doNotDisturb = !Settings.data.notifications.doNotDisturb
ToastService.showNotice(
Settings.data.notifications.doNotDisturb ? "Do Not Disturb enabled" : "Do Not Disturb disabled",
Settings.data.notifications.doNotDisturb ? "Notifications will be hidden but saved to history" : "Notifications will be shown normally",
"notice", false, 2000)
}
} }
NIconButton { NIconButton {

View file

@ -215,6 +215,7 @@ Alternatively, you can add it to your NixOS configuration or flake:
| Toggle Settings Window | `qs -c noctalia-shell ipc call settings toggle` | | Toggle Settings Window | `qs -c noctalia-shell ipc call settings toggle` |
| Toggle Lock Screen | `qs -c noctalia-shell ipc call lockScreen toggle` | | Toggle Lock Screen | `qs -c noctalia-shell ipc call lockScreen toggle` |
| Toggle Notification History | `qs -c noctalia-shell ipc call notifications toggleHistory` | | Toggle Notification History | `qs -c noctalia-shell ipc call notifications toggleHistory` |
| Toggle Notification DND | `qs -c noctalia-shell ipc call notifications toggleDND` |
| Change Wallpaper | `qs -c noctalia-shell ipc call wallpaper set $path $monitor` | | Change Wallpaper | `qs -c noctalia-shell ipc call wallpaper set $path $monitor` |
| Assign a Random Wallpaper | `qs -c noctalia-shell ipc call wallpaper random` | | Assign a Random Wallpaper | `qs -c noctalia-shell ipc call wallpaper random` |
| Toggle Dark Mode | `qs -c noctalia-shell ipc call darkMode toggle` | | Toggle Dark Mode | `qs -c noctalia-shell ipc call darkMode toggle` |

View file

@ -28,11 +28,11 @@ Singleton {
// Signal when notification is received // Signal when notification is received
onNotification: function (notification) { onNotification: function (notification) {
// Always add notification to history
root.addToHistory(notification)
// Check if do-not-disturb is enabled // Check if do-not-disturb is enabled
if (Settings.data.notifications && Settings.data.notifications.doNotDisturb) { if (Settings.data.notifications && Settings.data.notifications.doNotDisturb) {
// Still add to history but don't show notification
root.addToHistory(notification)
return return
} }
@ -46,8 +46,6 @@ Singleton {
// Add to our model // Add to our model
root.addNotification(notification) root.addNotification(notification)
// Also add to history
root.addToHistory(notification)
} }
} }
@ -109,6 +107,15 @@ Singleton {
} }
} }
Connections {
target: Settings.data.notifications
function onDoNotDisturbChanged() {
const label = Settings.data.notifications.doNotDisturb ? "'Do Not Disturb' enabled" : "'Do Not Disturb' disabled"
const description = Settings.data.notifications.doNotDisturb ? "You'll find these notifications in your history." : "Showing all notifications."
ToastService.showNotice(label, description, "notice", false, 2000)
}
}
// Function to add notification to model // Function to add notification to model
function addNotification(notification) { function addNotification(notification) {
notificationModel.insert(0, { notificationModel.insert(0, {

View file

@ -1,9 +1,10 @@
import QtQuick import QtQuick
import QtQuick.Layouts
import qs.Commons import qs.Commons
import qs.Services import qs.Services
import qs.Widgets import qs.Widgets
// Compact circular statistic display used in the SidePanel // Compact circular statistic display using Layout management
Rectangle { Rectangle {
id: root id: root
@ -28,20 +29,20 @@ Rectangle {
// Repaint gauge when the bound value changes // Repaint gauge when the bound value changes
onValueChanged: gauge.requestPaint() onValueChanged: gauge.requestPaint()
Row { ColumnLayout {
id: innerRow id: mainLayout
anchors.fill: parent anchors.fill: parent
anchors.margins: Style.marginS * scaling * contentScale anchors.margins: Style.marginS * scaling * contentScale
spacing: Style.marginS * scaling * contentScale spacing: 0
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
// Gauge with percentage label placed inside the open gap (right side) // Main gauge container
Item { Item {
id: gaugeWrap id: gaugeContainer
anchors.verticalCenter: innerRow.verticalCenter Layout.fillWidth: true
width: 68 * scaling * contentScale Layout.fillHeight: true
height: 68 * scaling * contentScale Layout.alignment: Qt.AlignCenter
Layout.preferredWidth: 68 * scaling * contentScale
Layout.preferredHeight: 68 * scaling * contentScale
Canvas { Canvas {
id: gauge id: gauge
@ -84,15 +85,13 @@ Rectangle {
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
} }
// Tiny circular badge for the icon, inside the right-side gap // Tiny circular badge for the icon, positioned using anchors within the gauge
Rectangle { Rectangle {
id: iconBadge id: iconBadge
width: 28 * scaling * contentScale width: 28 * scaling * contentScale
height: width height: width
radius: width / 2 radius: width / 2
color: Color.mSurface color: Color.mSurface
// border.color: Color.mPrimary
// border.width: Math.max(1, Style.borderS * scaling)
anchors.right: parent.right anchors.right: parent.right
anchors.top: parent.top anchors.top: parent.top
anchors.rightMargin: -6 * scaling * contentScale anchors.rightMargin: -6 * scaling * contentScale

View file

@ -18,6 +18,7 @@ Rectangle {
id: textItem id: textItem
text: Time.time text: Time.time
anchors.centerIn: parent anchors.centerIn: parent
font.pointSize: Style.fontSizeS * scaling
font.weight: Style.fontWeightBold font.weight: Style.fontWeightBold
} }