From 316a5e2f448a983a51894e1e0fd87129a675160f Mon Sep 17 00:00:00 2001 From: leiserfg Date: Mon, 28 Jul 2025 09:17:13 +0200 Subject: [PATCH] Remove qt5-compat --- Bar/Bar.qml | 2 +- Bar/Modules/Media.qml | 6 +- Bar/Modules/SystemTray.qml | 68 +++++++++++----------- Bar/Modules/Workspace.qml | 16 ++--- Components/Avatar.qml | 26 ++++++--- Widgets/LockScreen/LockScreen.qml | 24 ++++---- Widgets/Overview.qml | 3 +- Widgets/Sidebar/Config/ProfileSettings.qml | 22 +++---- Widgets/Sidebar/Panel/Music.qml | 62 ++++++++++++-------- Widgets/Sidebar/Panel/QuickAccess.qml | 2 +- Widgets/Sidebar/Panel/System.qml | 7 +-- 11 files changed, 128 insertions(+), 110 deletions(-) diff --git a/Bar/Bar.qml b/Bar/Bar.qml index fe657d3b..a65407cd 100644 --- a/Bar/Bar.qml +++ b/Bar/Bar.qml @@ -4,7 +4,7 @@ import QtQuick.Layouts import Quickshell import Quickshell.Io import Quickshell.Wayland -import Qt5Compat.GraphicalEffects +import QtQuick.Effects import qs.Bar.Modules import qs.Settings import qs.Services diff --git a/Bar/Modules/Media.qml b/Bar/Modules/Media.qml index 02fd372e..f2dbd1ff 100644 --- a/Bar/Modules/Media.qml +++ b/Bar/Modules/Media.qml @@ -1,8 +1,8 @@ import QtQuick import QtQuick.Controls import QtQuick.Layouts -import Qt5Compat.GraphicalEffects import Quickshell.Widgets +import QtQuick.Effects import qs.Settings import qs.Services import qs.Components @@ -63,8 +63,8 @@ Item { // Rounded corners using layer layer.enabled: true - layer.effect: OpacityMask { - cached: true + layer.effect: MultiEffect { + maskEnabled: true maskSource: Rectangle { width: albumArt.width height: albumArt.height diff --git a/Bar/Modules/SystemTray.qml b/Bar/Modules/SystemTray.qml index fe2ceeeb..685e9671 100644 --- a/Bar/Modules/SystemTray.qml +++ b/Bar/Modules/SystemTray.qml @@ -2,7 +2,7 @@ import QtQuick import QtQuick.Layouts import QtQuick.Controls import Quickshell -import Qt5Compat.GraphicalEffects +import QtQuick.Effects import Quickshell.Services.SystemTray import Quickshell.Widgets import qs.Settings @@ -14,10 +14,10 @@ Row { property var trayMenu spacing: 8 Layout.alignment: Qt.AlignVCenter - + property bool containsMouse: false property var systemTray: SystemTray - + Repeater { model: systemTray.items delegate: Item { @@ -26,7 +26,7 @@ Row { // Hide Spotify icon, or adjust to your liking visible: modelData && modelData.id !== "spotify" property bool isHovered: trayMouseArea.containsMouse - + // Hover scale animation scale: isHovered ? 1.15 : 1.0 Behavior on scale { @@ -35,7 +35,7 @@ Row { easing.type: Easing.OutCubic } } - + // Subtle rotation on hover rotation: isHovered ? 5 : 0 Behavior on rotation { @@ -44,7 +44,7 @@ Row { easing.type: Easing.OutCubic } } - + Rectangle { anchors.centerIn: parent width: 16 @@ -63,7 +63,8 @@ Row { backer.fillMode: Image.PreserveAspectFit source: { let icon = modelData?.icon || ""; - if (!icon) return ""; + if (!icon) + return ""; // Process icon path if (icon.includes("?path=")) { const [name, path] = icon.split("?path="); @@ -80,61 +81,60 @@ Row { easing.type: Easing.OutCubic } } - Component.onCompleted: { - - } + Component.onCompleted: {} } } - + MouseArea { id: trayMouseArea anchors.fill: parent hoverEnabled: true cursorShape: Qt.PointingHandCursor acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton - onClicked: (mouse) => { - if (!modelData) return; - + onClicked: mouse => { + if (!modelData) + return; + if (mouse.button === Qt.LeftButton) { // Close any open menu first if (trayMenu && trayMenu.visible) { - trayMenu.hideMenu() + trayMenu.hideMenu(); } - + if (!modelData.onlyMenu) { - modelData.activate() + modelData.activate(); } } else if (mouse.button === Qt.MiddleButton) { // Close any open menu first if (trayMenu && trayMenu.visible) { - trayMenu.hideMenu() + trayMenu.hideMenu(); } - - modelData.secondaryActivate && modelData.secondaryActivate() + + modelData.secondaryActivate && modelData.secondaryActivate(); } else if (mouse.button === Qt.RightButton) { - trayTooltip.tooltipVisible = false - console.log("Right click on", modelData.id, "hasMenu:", modelData.hasMenu, "menu:", modelData.menu) + trayTooltip.tooltipVisible = false; + console.log("Right click on", modelData.id, "hasMenu:", modelData.hasMenu, "menu:", modelData.menu); // If menu is already visible, close it if (trayMenu && trayMenu.visible) { - trayMenu.hideMenu() - return + trayMenu.hideMenu(); + return; } - + if (modelData.hasMenu && modelData.menu && trayMenu) { // Anchor the menu to the tray icon item (parent) and position it below the icon const menuX = (width / 2) - (trayMenu.width / 2); const menuY = height + 20; trayMenu.menu = modelData.menu; trayMenu.showAt(parent, menuX, menuY); - } else { - // console.log("No menu available for", modelData.id, "or trayMenu not set") - } + } else + // console.log("No menu available for", modelData.id, "or trayMenu not set") + {} } } onEntered: trayTooltip.tooltipVisible = true onExited: trayTooltip.tooltipVisible = false } - + StyledTooltip { id: trayTooltip text: modelData.tooltipTitle || modelData.name || modelData.id || "Tray Item" @@ -143,10 +143,10 @@ Row { targetItem: trayIcon delay: 200 } - - Component.onDestruction: { - // No cache cleanup needed - } + + Component.onDestruction: + // No cache cleanup needed + {} } } -} \ No newline at end of file +} diff --git a/Bar/Modules/Workspace.qml b/Bar/Modules/Workspace.qml index 40a40238..a658a6a4 100644 --- a/Bar/Modules/Workspace.qml +++ b/Bar/Modules/Workspace.qml @@ -2,7 +2,7 @@ import QtQuick import QtQuick.Controls import QtQuick.Layouts import QtQuick.Window -import Qt5Compat.GraphicalEffects +import QtQuick.Effects import Quickshell import Quickshell.Io import qs.Settings @@ -124,13 +124,13 @@ Item { border.color: Qt.rgba(Theme.textPrimary.r, Theme.textPrimary.g, Theme.textPrimary.b, 0.1) border.width: 1 layer.enabled: true - layer.effect: DropShadow { - color: "black" - radius: 12 - samples: 24 - verticalOffset: 0 - horizontalOffset: 0 - opacity: 0.10 + layer.effect: MultiEffect { + shadowColor: "black" + // radius: 12 + + shadowVerticalOffset: 0 + shadowHorizontalOffset: 0 + shadowOpacity: 0.10 } } diff --git a/Components/Avatar.qml b/Components/Avatar.qml index ab025899..03c690f0 100644 --- a/Components/Avatar.qml +++ b/Components/Avatar.qml @@ -1,8 +1,8 @@ import QtQuick -import Qt5Compat.GraphicalEffects import Quickshell import Quickshell.Widgets import qs.Settings +import QtQuick.Effects Item { anchors.fill: parent @@ -17,18 +17,27 @@ Item { backer.fillMode: Image.PreserveAspectCrop } - OpacityMask { + MultiEffect { anchors.fill: avatarImage source: avatarImage - maskSource: Rectangle { - width: avatarImage.width - height: avatarImage.height - radius: avatarImage.width / 2 - visible: false - } + maskEnabled: true + maskSource: mask visible: Settings.settings.profileImage !== "" } + Item { + id: mask + + anchors.fill: avatarImage + layer.enabled: true + visible: false + + Rectangle { + anchors.fill: avatarImage + radius: avatarImage.width / 2 + } + } + // Fallback icon Text { anchors.centerIn: parent @@ -40,4 +49,3 @@ Item { z: 0 } } - diff --git a/Widgets/LockScreen/LockScreen.qml b/Widgets/LockScreen/LockScreen.qml index b344b4df..6f720851 100644 --- a/Widgets/LockScreen/LockScreen.qml +++ b/Widgets/LockScreen/LockScreen.qml @@ -2,11 +2,10 @@ import QtQuick import QtQuick.Layouts import QtQuick.Controls import QtQuick.Effects -import Qt5Compat.GraphicalEffects import Quickshell +import Quickshell.Wayland import Quickshell.Services.Pam import Quickshell.Io -import Quickshell.Wayland import Quickshell.Widgets import qs.Components import qs.Settings @@ -33,7 +32,7 @@ WlSessionLock { Component.onCompleted: { Qt.callLater(function () { fetchWeatherData(); - }) + }); } function fetchWeatherData() { @@ -147,6 +146,7 @@ WlSessionLock { blurEnabled: true blur: 0.48 // controls blur strength (0 to 1) blurMax: 128 // max blur radius in pixels + // transparentBorder: true } ColumnLayout { @@ -164,10 +164,11 @@ WlSessionLock { Avatar {} layer.enabled: true - layer.effect: Glow { - color: Theme.accentPrimary - radius: 8 - samples: 16 + layer.effect: MultiEffect { + shadowEnabled: true + shadowColor: Theme.accentPrimary + // radius: 8 + // samples: 16 } } @@ -303,7 +304,7 @@ WlSessionLock { position: "bottomright" size: 1.3 fillColor: (Theme.backgroundPrimary !== undefined && Theme.backgroundPrimary !== null) ? Theme.backgroundPrimary : "#222" - offsetX: - Screen.width / 2 - 38 + offsetX: -Screen.width / 2 - 38 offsetY: 0 anchors.top: parent.top visible: Settings.settings.showCorners @@ -379,7 +380,6 @@ WlSessionLock { horizontalAlignment: Text.AlignHCenter Layout.alignment: Qt.AlignHCenter } - } } @@ -406,13 +406,11 @@ WlSessionLock { anchors.left: parent.left anchors.bottom: parent.bottom anchors.margins: 32 - spacing: 12 + spacing: 12 - BatteryCharge { - } + BatteryCharge {} } - ColumnLayout { anchors.right: parent.right anchors.bottom: parent.bottom diff --git a/Widgets/Overview.qml b/Widgets/Overview.qml index 56075489..8370ce06 100644 --- a/Widgets/Overview.qml +++ b/Widgets/Overview.qml @@ -2,7 +2,6 @@ import QtQuick import QtQuick.Effects import Quickshell import Quickshell.Wayland -import Qt5Compat.GraphicalEffects import qs.Services import qs.Settings @@ -54,4 +53,4 @@ ShellRoot { } } } -} \ No newline at end of file +} diff --git a/Widgets/Sidebar/Config/ProfileSettings.qml b/Widgets/Sidebar/Config/ProfileSettings.qml index 4a4bf7c6..20fc9805 100644 --- a/Widgets/Sidebar/Config/ProfileSettings.qml +++ b/Widgets/Sidebar/Config/ProfileSettings.qml @@ -1,7 +1,7 @@ import QtQuick import QtQuick.Layouts +import QtQuick.Effects import QtQuick.Controls -import Qt5Compat.GraphicalEffects import Quickshell.Widgets import qs.Components import qs.Settings @@ -91,7 +91,7 @@ Rectangle { activeFocusOnTab: true inputMethodHints: Qt.ImhUrlCharactersOnly onTextChanged: { - Settings.settings.profileImage = text + Settings.settings.profileImage = text; } MouseArea { anchors.fill: parent @@ -152,7 +152,7 @@ Rectangle { anchors.fill: parent cursorShape: Qt.PointingHandCursor onClicked: { - Settings.settings.showActiveWindowIcon = !Settings.settings.showActiveWindowIcon + Settings.settings.showActiveWindowIcon = !Settings.settings.showActiveWindowIcon; } } } @@ -207,7 +207,7 @@ Rectangle { anchors.fill: parent cursorShape: Qt.PointingHandCursor onClicked: { - Settings.settings.showSystemInfoInBar = !Settings.settings.showSystemInfoInBar + Settings.settings.showSystemInfoInBar = !Settings.settings.showSystemInfoInBar; } } } @@ -262,7 +262,7 @@ Rectangle { anchors.fill: parent cursorShape: Qt.PointingHandCursor onClicked: { - Settings.settings.showCorners = !Settings.settings.showCorners + Settings.settings.showCorners = !Settings.settings.showCorners; } } } @@ -317,7 +317,7 @@ Rectangle { anchors.fill: parent cursorShape: Qt.PointingHandCursor onClicked: { - Settings.settings.showTaskbar = !Settings.settings.showTaskbar + Settings.settings.showTaskbar = !Settings.settings.showTaskbar; } } } @@ -372,7 +372,7 @@ Rectangle { anchors.fill: parent cursorShape: Qt.PointingHandCursor onClicked: { - Settings.settings.showDock = !Settings.settings.showDock + Settings.settings.showDock = !Settings.settings.showDock; } } } @@ -427,7 +427,7 @@ Rectangle { anchors.fill: parent cursorShape: Qt.PointingHandCursor onClicked: { - Settings.settings.showMediaInBar = !Settings.settings.showMediaInBar + Settings.settings.showMediaInBar = !Settings.settings.showMediaInBar; } } } @@ -482,7 +482,7 @@ Rectangle { anchors.fill: parent cursorShape: Qt.PointingHandCursor onClicked: { - Settings.settings.dimPanels = !Settings.settings.dimPanels + Settings.settings.dimPanels = !Settings.settings.dimPanels; } } } @@ -621,7 +621,7 @@ Rectangle { activeFocusOnTab: true inputMethodHints: Qt.ImhUrlCharactersOnly onTextChanged: { - Settings.settings.videoPath = text + Settings.settings.videoPath = text; } MouseArea { anchors.fill: parent @@ -632,4 +632,4 @@ Rectangle { } } } -} \ No newline at end of file +} diff --git a/Widgets/Sidebar/Panel/Music.qml b/Widgets/Sidebar/Panel/Music.qml index be9ac82e..9a7a7683 100644 --- a/Widgets/Sidebar/Panel/Music.qml +++ b/Widgets/Sidebar/Panel/Music.qml @@ -1,7 +1,7 @@ -import QtQuick +import QtQuick import QtQuick.Controls import QtQuick.Layouts -import Qt5Compat.GraphicalEffects +import QtQuick.Effects import qs.Settings import qs.Components import qs.Services @@ -61,7 +61,8 @@ Rectangle { // Album art with spectrum Item { id: albumArtContainer - width: 96; height: 96 // enough for spectrum and art (will adjust if needed) + width: 96 + height: 96 // enough for spectrum and art (will adjust if needed) Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter // Spectrum visualizer @@ -80,7 +81,8 @@ Rectangle { // Album art image Rectangle { id: albumArtwork - width: 60; height: 60 + width: 60 + height: 60 anchors.centerIn: parent radius: 30 // circle color: Qt.darker(Theme.surface, 1.1) @@ -103,14 +105,23 @@ Rectangle { // Rounded corners using layer layer.enabled: true - layer.effect: OpacityMask { - cached: true - maskSource: Rectangle { - width: albumArt.width - height: albumArt.height - radius: albumArt.width / 2 // circle - visible: false - } + layer.effect: MultiEffect { + maskEnabled: true + maskSource: mask + } + } + + Item { + id: mask + + anchors.fill: albumArt + layer.enabled: true + visible: false + + Rectangle { + width: albumArt.width + height: albumArt.height + radius: albumArt.width / 2 // circle } } @@ -172,8 +183,7 @@ Rectangle { color: Qt.rgba(Theme.textPrimary.r, Theme.textPrimary.g, Theme.textPrimary.b, 0.15) Layout.fillWidth: true - property real progressRatio: Math.min(1, MusicManager.trackLength > 0 ? - (MusicManager.currentPosition / MusicManager.trackLength) : 0) + property real progressRatio: Math.min(1, MusicManager.trackLength > 0 ? (MusicManager.currentPosition / MusicManager.trackLength) : 0) Rectangle { id: progressFill @@ -183,7 +193,9 @@ Rectangle { color: Theme.accentPrimary Behavior on width { - NumberAnimation { duration: 200 } + NumberAnimation { + duration: 200 + } } } @@ -197,14 +209,16 @@ Rectangle { border.color: Qt.lighter(Theme.accentPrimary, 1.3) border.width: 1 - x: Math.max(0, Math.min(parent.width - width, progressFill.width - width/2)) + x: Math.max(0, Math.min(parent.width - width, progressFill.width - width / 2)) anchors.verticalCenter: parent.verticalCenter visible: MusicManager.trackLength > 0 scale: progressMouseArea.containsMouse || progressMouseArea.pressed ? 1.2 : 1.0 Behavior on scale { - NumberAnimation { duration: 150 } + NumberAnimation { + duration: 150 + } } } @@ -216,15 +230,15 @@ Rectangle { cursorShape: Qt.PointingHandCursor enabled: MusicManager.trackLength > 0 && MusicManager.canSeek - onClicked: function(mouse) { - let ratio = mouse.x / width - MusicManager.seekByRatio(ratio) + onClicked: function (mouse) { + let ratio = mouse.x / width; + MusicManager.seekByRatio(ratio); } - onPositionChanged: function(mouse) { + onPositionChanged: function (mouse) { if (pressed) { - let ratio = Math.max(0, Math.min(1, mouse.x / width)) - MusicManager.seekByRatio(ratio) + let ratio = Math.max(0, Math.min(1, mouse.x / width)); + MusicManager.seekByRatio(ratio); } } } @@ -319,4 +333,4 @@ Rectangle { } } } -} \ No newline at end of file +} diff --git a/Widgets/Sidebar/Panel/QuickAccess.qml b/Widgets/Sidebar/Panel/QuickAccess.qml index 93975f10..e8ba2454 100644 --- a/Widgets/Sidebar/Panel/QuickAccess.qml +++ b/Widgets/Sidebar/Panel/QuickAccess.qml @@ -1,7 +1,7 @@ import QtQuick import QtQuick.Layouts import QtQuick.Controls -import Qt5Compat.GraphicalEffects +import QtQuick.Effects import Quickshell import Quickshell.Io import qs.Settings diff --git a/Widgets/Sidebar/Panel/System.qml b/Widgets/Sidebar/Panel/System.qml index 902874ae..fa5397d9 100644 --- a/Widgets/Sidebar/Panel/System.qml +++ b/Widgets/Sidebar/Panel/System.qml @@ -1,7 +1,7 @@ import QtQuick import QtQuick.Layouts import QtQuick.Controls -import Qt5Compat.GraphicalEffects +import QtQuick.Effects import Quickshell import Quickshell.Io import Quickshell.Widgets @@ -380,7 +380,7 @@ Rectangle { running: false } - Process { + Process { id: logoutProcessNiri command: ["niri", "msg", "action", "quit", "--skip-confirmation"] running: false @@ -421,7 +421,6 @@ Rectangle { rebootProcess.running = true; } - property bool panelVisible: false // Trigger initial update when panel becomes visible @@ -451,4 +450,4 @@ Rectangle { LockScreen { id: lockScreen } -} \ No newline at end of file +}