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

View file

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

View file

@ -18,12 +18,13 @@ RowLayout {
Layout.alignment: Qt.AlignVCenter
spacing: Style.marginS * scaling
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() {
return MediaService.trackTitle + (MediaService.trackArtist !== "" ? ` - ${MediaService.trackArtist}` : "")
}
// A hidden text element to safely measure the full title width
NText {
id: fullTitleMetrics
visible: false
@ -33,133 +34,167 @@ RowLayout {
Rectangle {
id: mediaMini
width: contentLayout.implicitWidth + Style.marginS * 2 * scaling
height: Math.round(Style.capsuleHeight * scaling)
radius: Math.round(Style.radiusM * scaling)
color: Color.mSurfaceVariant
Layout.preferredWidth: rowLayout.implicitWidth + Style.marginM * 2 * scaling
Layout.preferredHeight: Math.round(Style.capsuleHeight * scaling)
Layout.alignment: Qt.AlignVCenter
// --- Visualizer Loaders ---
Loader {
anchors.centerIn: parent
active: Settings.data.audio.showMiniplayerCava && Settings.data.audio.visualizerType == "linear"
&& MediaService.isPlaying && MediaService.trackLength > 0
z: 0
sourceComponent: LinearSpectrum {
width: mediaMini.width - Style.marginS * scaling
height: 20 * scaling
values: CavaService.values
fillColor: Color.mOnSurfaceVariant
opacity: 0.4
}
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
}
Loader {
anchors.centerIn: parent
active: Settings.data.audio.showMiniplayerCava && Settings.data.audio.visualizerType == "mirrored"
&& MediaService.isPlaying && MediaService.trackLength > 0
z: 0
sourceComponent: MirroredSpectrum {
width: mediaMini.width - Style.marginS * scaling
height: mediaMini.height - Style.marginS * scaling
values: CavaService.values
fillColor: Color.mOnSurfaceVariant
opacity: 0.4
}
}
Loader {
anchors.centerIn: parent
active: Settings.data.audio.showMiniplayerCava && Settings.data.audio.visualizerType == "wave"
&& MediaService.isPlaying && MediaService.trackLength > 0
z: 0
sourceComponent: WaveSpectrum {
width: mediaMini.width - Style.marginS * scaling
height: mediaMini.height - Style.marginS * scaling
values: CavaService.values
fillColor: Color.mOnSurfaceVariant
opacity: 0.4
}
}
// --- Main Content Layout ---
RowLayout {
id: contentLayout
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
anchors.leftMargin: Style.marginS * scaling
spacing: Style.marginS * scaling
z: 1
NIcon {
id: windowIcon
text: MediaService.isPlaying ? "pause" : "play_arrow"
font.pointSize: Style.fontSizeL * scaling
Layout.alignment: Qt.AlignVCenter
visible: !Settings.data.audio.showMiniplayerAlbumArt && getTitle() !== "" && !trackArt.visible
}
NImageCircled {
id: trackArt
imagePath: MediaService.trackArtUrl
fallbackIcon: MediaService.isPlaying ? "pause" : "play_arrow"
borderWidth: 0
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 {
id: titleText
Layout.preferredWidth: {
if (mouseArea.containsMouse) {
return Math.round(Math.min(fullTitleMetrics.contentWidth, root.maxWidth * scaling))
} else {
return Math.round(Math.min(fullTitleMetrics.contentWidth, root.minWidth * scaling))
}
}
text: getTitle()
font.pointSize: Style.fontSizeS * scaling
font.weight: Style.fontWeightMedium
elide: Text.ElideRight
color: Color.mTertiary
Layout.alignment: Qt.AlignVCenter
Behavior on Layout.preferredWidth {
NumberAnimation {
duration: Style.animationSlow
easing.type: Easing.InOutCubic
}
}
}
}
MouseArea {
id: mouseArea
Item {
id: mainContainer
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton
onClicked: mouse => {
if (mouse.button === Qt.LeftButton) {
MediaService.playPause()
} else if (mouse.button == Qt.RightButton) {
MediaService.next()
tooltip.visible = false
} else if (mouse.button == Qt.MiddleButton) {
MediaService.previous()
tooltip.visible = false
}
}
onEntered: {
if (tooltip.text !== "") {
tooltip.show()
anchors.leftMargin: Style.marginS * scaling
anchors.rightMargin: Style.marginS * scaling
Loader {
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
active: Settings.data.audio.showMiniplayerCava && Settings.data.audio.visualizerType == "linear"
&& MediaService.isPlaying
z: 0
sourceComponent: LinearSpectrum {
width: mainContainer.width - Style.marginS * scaling
height: 20 * scaling
values: CavaService.values
fillColor: Color.mOnSurfaceVariant
opacity: 0.4
}
}
onExited: {
tooltip.hide()
Loader {
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
active: Settings.data.audio.showMiniplayerCava && Settings.data.audio.visualizerType == "mirrored"
&& MediaService.isPlaying
z: 0
sourceComponent: MirroredSpectrum {
width: mainContainer.width - Style.marginS * scaling
height: mainContainer.height - Style.marginS * scaling
values: CavaService.values
fillColor: Color.mOnSurfaceVariant
opacity: 0.4
}
}
Loader {
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
active: Settings.data.audio.showMiniplayerCava && Settings.data.audio.visualizerType == "wave"
&& MediaService.isPlaying
z: 0
sourceComponent: WaveSpectrum {
width: mainContainer.width - Style.marginS * scaling
height: mainContainer.height - Style.marginS * scaling
values: CavaService.values
fillColor: Color.mOnSurfaceVariant
opacity: 0.4
}
}
RowLayout {
id: rowLayout
anchors.verticalCenter: parent.verticalCenter
spacing: Style.marginS * scaling
z: 1 // Above the visualizer
NIcon {
id: windowIcon
text: MediaService.isPlaying ? "pause" : "play_arrow"
font.pointSize: Style.fontSizeL * scaling
verticalAlignment: Text.AlignVCenter
Layout.alignment: Qt.AlignVCenter
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 {
id: trackArt
anchors.fill: parent
imagePath: MediaService.trackArtUrl
fallbackIcon: MediaService.isPlaying ? "pause" : "play_arrow"
borderWidth: 0
border.color: Color.transparent
}
}
}
NText {
id: titleText
Layout.preferredWidth: {
if (mouseArea.containsMouse) {
return Math.round(Math.min(fullTitleMetrics.contentWidth, root.maxWidth * scaling))
} else {
return Math.round(Math.min(fullTitleMetrics.contentWidth, root.minWidth * scaling))
}
}
Layout.alignment: Qt.AlignVCenter
text: getTitle()
font.pointSize: Style.fontSizeS * scaling
font.weight: Style.fontWeightMedium
elide: Text.ElideRight
verticalAlignment: Text.AlignVCenter
color: Color.mTertiary
Behavior on Layout.preferredWidth {
NumberAnimation {
duration: Style.animationSlow
easing.type: Easing.InOutCubic
}
}
}
}
// Mouse area for hover detection
MouseArea {
id: mouseArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton
onClicked: mouse => {
if (mouse.button === Qt.LeftButton) {
MediaService.playPause()
} else if (mouse.button == Qt.RightButton) {
MediaService.next()
// Need to hide the tooltip instantly
tooltip.visible = false
} else if (mouse.button == Qt.MiddleButton) {
MediaService.previous()
// Need to hide the tooltip instantly
tooltip.visible = false
}
}
onEntered: {
if (tooltip.text !== "") {
tooltip.show()
}
}
onExited: {
tooltip.hide()
}
}
}
}
@ -169,14 +204,14 @@ RowLayout {
text: {
var str = ""
if (MediaService.canGoNext) {
str += "Right click for next\n"
str += "Right click for next.\n"
}
if (MediaService.canGoPrevious) {
str += "Middle click for previous\n"
str += "Middle click for previous."
}
return str
}
target: mediaMini
target: anchor
positionAbove: Settings.data.bar.position === "bottom"
}
}

View file

@ -23,11 +23,5 @@ NIconButton {
onClicked: PanelService.getPanel("notificationHistoryPanel")?.toggle(screen, this)
onRightClicked: {
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)
}
onRightClicked: Settings.data.notifications.doNotDisturb = !Settings.data.notifications.doNotDisturb
}

View file

@ -2,6 +2,7 @@ pragma ComponentBehavior
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import Quickshell
import Quickshell.Widgets
import Quickshell.Wayland
@ -17,15 +18,14 @@ Rectangle {
readonly property real itemSize: Style.baseWidgetSize * 0.8 * scaling
// 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)
radius: Math.round(Style.radiusM * scaling)
color: Color.mSurfaceVariant
Row {
id: taskbarRow
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
RowLayout {
id: taskbarLayout
anchors.centerIn: parent
spacing: Style.marginXXS * root.scaling
Repeater {
@ -35,8 +35,10 @@ Rectangle {
required property Toplevel modelData
property Toplevel toplevel: 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 {
id: iconBackground

View file

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

View file

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

View file

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

View file

@ -40,10 +40,6 @@ Item {
}
function toggleDND() {
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"
tooltipText: Settings.data.notifications.doNotDisturb ? "Do Not Disturb (ON)" : "Do Not Disturb (OFF)"
sizeRatio: 0.8
onClicked: {
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)
}
onClicked: Settings.data.notifications.doNotDisturb = !Settings.data.notifications.doNotDisturb
}
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 Lock Screen | `qs -c noctalia-shell ipc call lockScreen toggle` |
| 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` |
| Assign a Random Wallpaper | `qs -c noctalia-shell ipc call wallpaper random` |
| Toggle Dark Mode | `qs -c noctalia-shell ipc call darkMode toggle` |

View file

@ -28,11 +28,11 @@ Singleton {
// Signal when notification is received
onNotification: function (notification) {
// Always add notification to history
root.addToHistory(notification)
// Check if do-not-disturb is enabled
if (Settings.data.notifications && Settings.data.notifications.doNotDisturb) {
// Still add to history but don't show notification
root.addToHistory(notification)
return
}
@ -46,8 +46,6 @@ Singleton {
// Add to our model
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 addNotification(notification) {
notificationModel.insert(0, {

View file

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

View file

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