Remove qt5-compat

This commit is contained in:
leiserfg 2025-07-28 09:17:13 +02:00
parent 82935d9236
commit 316a5e2f44
No known key found for this signature in database
11 changed files with 128 additions and 110 deletions

View file

@ -4,7 +4,7 @@ import QtQuick.Layouts
import Quickshell import Quickshell
import Quickshell.Io import Quickshell.Io
import Quickshell.Wayland import Quickshell.Wayland
import Qt5Compat.GraphicalEffects import QtQuick.Effects
import qs.Bar.Modules import qs.Bar.Modules
import qs.Settings import qs.Settings
import qs.Services import qs.Services

View file

@ -1,8 +1,8 @@
import QtQuick import QtQuick
import QtQuick.Controls import QtQuick.Controls
import QtQuick.Layouts import QtQuick.Layouts
import Qt5Compat.GraphicalEffects
import Quickshell.Widgets import Quickshell.Widgets
import QtQuick.Effects
import qs.Settings import qs.Settings
import qs.Services import qs.Services
import qs.Components import qs.Components
@ -63,8 +63,8 @@ Item {
// Rounded corners using layer // Rounded corners using layer
layer.enabled: true layer.enabled: true
layer.effect: OpacityMask { layer.effect: MultiEffect {
cached: true maskEnabled: true
maskSource: Rectangle { maskSource: Rectangle {
width: albumArt.width width: albumArt.width
height: albumArt.height height: albumArt.height

View file

@ -2,7 +2,7 @@ import QtQuick
import QtQuick.Layouts import QtQuick.Layouts
import QtQuick.Controls import QtQuick.Controls
import Quickshell import Quickshell
import Qt5Compat.GraphicalEffects import QtQuick.Effects
import Quickshell.Services.SystemTray import Quickshell.Services.SystemTray
import Quickshell.Widgets import Quickshell.Widgets
import qs.Settings import qs.Settings
@ -14,10 +14,10 @@ Row {
property var trayMenu property var trayMenu
spacing: 8 spacing: 8
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
property bool containsMouse: false property bool containsMouse: false
property var systemTray: SystemTray property var systemTray: SystemTray
Repeater { Repeater {
model: systemTray.items model: systemTray.items
delegate: Item { delegate: Item {
@ -26,7 +26,7 @@ Row {
// Hide Spotify icon, or adjust to your liking // Hide Spotify icon, or adjust to your liking
visible: modelData && modelData.id !== "spotify" visible: modelData && modelData.id !== "spotify"
property bool isHovered: trayMouseArea.containsMouse property bool isHovered: trayMouseArea.containsMouse
// Hover scale animation // Hover scale animation
scale: isHovered ? 1.15 : 1.0 scale: isHovered ? 1.15 : 1.0
Behavior on scale { Behavior on scale {
@ -35,7 +35,7 @@ Row {
easing.type: Easing.OutCubic easing.type: Easing.OutCubic
} }
} }
// Subtle rotation on hover // Subtle rotation on hover
rotation: isHovered ? 5 : 0 rotation: isHovered ? 5 : 0
Behavior on rotation { Behavior on rotation {
@ -44,7 +44,7 @@ Row {
easing.type: Easing.OutCubic easing.type: Easing.OutCubic
} }
} }
Rectangle { Rectangle {
anchors.centerIn: parent anchors.centerIn: parent
width: 16 width: 16
@ -63,7 +63,8 @@ Row {
backer.fillMode: Image.PreserveAspectFit backer.fillMode: Image.PreserveAspectFit
source: { source: {
let icon = modelData?.icon || ""; let icon = modelData?.icon || "";
if (!icon) return ""; if (!icon)
return "";
// Process icon path // Process icon path
if (icon.includes("?path=")) { if (icon.includes("?path=")) {
const [name, path] = icon.split("?path="); const [name, path] = icon.split("?path=");
@ -80,61 +81,60 @@ Row {
easing.type: Easing.OutCubic easing.type: Easing.OutCubic
} }
} }
Component.onCompleted: { Component.onCompleted: {}
}
} }
} }
MouseArea { MouseArea {
id: trayMouseArea id: trayMouseArea
anchors.fill: parent anchors.fill: parent
hoverEnabled: true hoverEnabled: true
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton
onClicked: (mouse) => { onClicked: mouse => {
if (!modelData) return; if (!modelData)
return;
if (mouse.button === Qt.LeftButton) { if (mouse.button === Qt.LeftButton) {
// Close any open menu first // Close any open menu first
if (trayMenu && trayMenu.visible) { if (trayMenu && trayMenu.visible) {
trayMenu.hideMenu() trayMenu.hideMenu();
} }
if (!modelData.onlyMenu) { if (!modelData.onlyMenu) {
modelData.activate() modelData.activate();
} }
} else if (mouse.button === Qt.MiddleButton) { } else if (mouse.button === Qt.MiddleButton) {
// Close any open menu first // Close any open menu first
if (trayMenu && trayMenu.visible) { if (trayMenu && trayMenu.visible) {
trayMenu.hideMenu() trayMenu.hideMenu();
} }
modelData.secondaryActivate && modelData.secondaryActivate() modelData.secondaryActivate && modelData.secondaryActivate();
} else if (mouse.button === Qt.RightButton) { } else if (mouse.button === Qt.RightButton) {
trayTooltip.tooltipVisible = false trayTooltip.tooltipVisible = false;
console.log("Right click on", modelData.id, "hasMenu:", modelData.hasMenu, "menu:", modelData.menu) console.log("Right click on", modelData.id, "hasMenu:", modelData.hasMenu, "menu:", modelData.menu);
// If menu is already visible, close it // If menu is already visible, close it
if (trayMenu && trayMenu.visible) { if (trayMenu && trayMenu.visible) {
trayMenu.hideMenu() trayMenu.hideMenu();
return return;
} }
if (modelData.hasMenu && modelData.menu && trayMenu) { if (modelData.hasMenu && modelData.menu && trayMenu) {
// Anchor the menu to the tray icon item (parent) and position it below the icon // Anchor the menu to the tray icon item (parent) and position it below the icon
const menuX = (width / 2) - (trayMenu.width / 2); const menuX = (width / 2) - (trayMenu.width / 2);
const menuY = height + 20; const menuY = height + 20;
trayMenu.menu = modelData.menu; trayMenu.menu = modelData.menu;
trayMenu.showAt(parent, menuX, menuY); trayMenu.showAt(parent, menuX, menuY);
} else { } else
// console.log("No menu available for", modelData.id, "or trayMenu not set") // console.log("No menu available for", modelData.id, "or trayMenu not set")
} {}
} }
} }
onEntered: trayTooltip.tooltipVisible = true onEntered: trayTooltip.tooltipVisible = true
onExited: trayTooltip.tooltipVisible = false onExited: trayTooltip.tooltipVisible = false
} }
StyledTooltip { StyledTooltip {
id: trayTooltip id: trayTooltip
text: modelData.tooltipTitle || modelData.name || modelData.id || "Tray Item" text: modelData.tooltipTitle || modelData.name || modelData.id || "Tray Item"
@ -143,10 +143,10 @@ Row {
targetItem: trayIcon targetItem: trayIcon
delay: 200 delay: 200
} }
Component.onDestruction: { Component.onDestruction:
// No cache cleanup needed // No cache cleanup needed
} {}
} }
} }
} }

View file

@ -2,7 +2,7 @@ import QtQuick
import QtQuick.Controls import QtQuick.Controls
import QtQuick.Layouts import QtQuick.Layouts
import QtQuick.Window import QtQuick.Window
import Qt5Compat.GraphicalEffects import QtQuick.Effects
import Quickshell import Quickshell
import Quickshell.Io import Quickshell.Io
import qs.Settings import qs.Settings
@ -124,13 +124,13 @@ Item {
border.color: Qt.rgba(Theme.textPrimary.r, Theme.textPrimary.g, Theme.textPrimary.b, 0.1) border.color: Qt.rgba(Theme.textPrimary.r, Theme.textPrimary.g, Theme.textPrimary.b, 0.1)
border.width: 1 border.width: 1
layer.enabled: true layer.enabled: true
layer.effect: DropShadow { layer.effect: MultiEffect {
color: "black" shadowColor: "black"
radius: 12 // radius: 12
samples: 24
verticalOffset: 0 shadowVerticalOffset: 0
horizontalOffset: 0 shadowHorizontalOffset: 0
opacity: 0.10 shadowOpacity: 0.10
} }
} }

View file

@ -1,8 +1,8 @@
import QtQuick import QtQuick
import Qt5Compat.GraphicalEffects
import Quickshell import Quickshell
import Quickshell.Widgets import Quickshell.Widgets
import qs.Settings import qs.Settings
import QtQuick.Effects
Item { Item {
anchors.fill: parent anchors.fill: parent
@ -17,18 +17,27 @@ Item {
backer.fillMode: Image.PreserveAspectCrop backer.fillMode: Image.PreserveAspectCrop
} }
OpacityMask { MultiEffect {
anchors.fill: avatarImage anchors.fill: avatarImage
source: avatarImage source: avatarImage
maskSource: Rectangle { maskEnabled: true
width: avatarImage.width maskSource: mask
height: avatarImage.height
radius: avatarImage.width / 2
visible: false
}
visible: Settings.settings.profileImage !== "" 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 // Fallback icon
Text { Text {
anchors.centerIn: parent anchors.centerIn: parent
@ -40,4 +49,3 @@ Item {
z: 0 z: 0
} }
} }

View file

@ -2,11 +2,10 @@ import QtQuick
import QtQuick.Layouts import QtQuick.Layouts
import QtQuick.Controls import QtQuick.Controls
import QtQuick.Effects import QtQuick.Effects
import Qt5Compat.GraphicalEffects
import Quickshell import Quickshell
import Quickshell.Wayland
import Quickshell.Services.Pam import Quickshell.Services.Pam
import Quickshell.Io import Quickshell.Io
import Quickshell.Wayland
import Quickshell.Widgets import Quickshell.Widgets
import qs.Components import qs.Components
import qs.Settings import qs.Settings
@ -33,7 +32,7 @@ WlSessionLock {
Component.onCompleted: { Component.onCompleted: {
Qt.callLater(function () { Qt.callLater(function () {
fetchWeatherData(); fetchWeatherData();
}) });
} }
function fetchWeatherData() { function fetchWeatherData() {
@ -147,6 +146,7 @@ WlSessionLock {
blurEnabled: true blurEnabled: true
blur: 0.48 // controls blur strength (0 to 1) blur: 0.48 // controls blur strength (0 to 1)
blurMax: 128 // max blur radius in pixels blurMax: 128 // max blur radius in pixels
// transparentBorder: true
} }
ColumnLayout { ColumnLayout {
@ -164,10 +164,11 @@ WlSessionLock {
Avatar {} Avatar {}
layer.enabled: true layer.enabled: true
layer.effect: Glow { layer.effect: MultiEffect {
color: Theme.accentPrimary shadowEnabled: true
radius: 8 shadowColor: Theme.accentPrimary
samples: 16 // radius: 8
// samples: 16
} }
} }
@ -303,7 +304,7 @@ WlSessionLock {
position: "bottomright" position: "bottomright"
size: 1.3 size: 1.3
fillColor: (Theme.backgroundPrimary !== undefined && Theme.backgroundPrimary !== null) ? Theme.backgroundPrimary : "#222" fillColor: (Theme.backgroundPrimary !== undefined && Theme.backgroundPrimary !== null) ? Theme.backgroundPrimary : "#222"
offsetX: - Screen.width / 2 - 38 offsetX: -Screen.width / 2 - 38
offsetY: 0 offsetY: 0
anchors.top: parent.top anchors.top: parent.top
visible: Settings.settings.showCorners visible: Settings.settings.showCorners
@ -379,7 +380,6 @@ WlSessionLock {
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
} }
} }
} }
@ -406,13 +406,11 @@ WlSessionLock {
anchors.left: parent.left anchors.left: parent.left
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.margins: 32 anchors.margins: 32
spacing: 12 spacing: 12
BatteryCharge { BatteryCharge {}
}
} }
ColumnLayout { ColumnLayout {
anchors.right: parent.right anchors.right: parent.right
anchors.bottom: parent.bottom anchors.bottom: parent.bottom

View file

@ -2,7 +2,6 @@ import QtQuick
import QtQuick.Effects import QtQuick.Effects
import Quickshell import Quickshell
import Quickshell.Wayland import Quickshell.Wayland
import Qt5Compat.GraphicalEffects
import qs.Services import qs.Services
import qs.Settings import qs.Settings
@ -54,4 +53,4 @@ ShellRoot {
} }
} }
} }
} }

View file

@ -1,7 +1,7 @@
import QtQuick import QtQuick
import QtQuick.Layouts import QtQuick.Layouts
import QtQuick.Effects
import QtQuick.Controls import QtQuick.Controls
import Qt5Compat.GraphicalEffects
import Quickshell.Widgets import Quickshell.Widgets
import qs.Components import qs.Components
import qs.Settings import qs.Settings
@ -91,7 +91,7 @@ Rectangle {
activeFocusOnTab: true activeFocusOnTab: true
inputMethodHints: Qt.ImhUrlCharactersOnly inputMethodHints: Qt.ImhUrlCharactersOnly
onTextChanged: { onTextChanged: {
Settings.settings.profileImage = text Settings.settings.profileImage = text;
} }
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
@ -152,7 +152,7 @@ Rectangle {
anchors.fill: parent anchors.fill: parent
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: { onClicked: {
Settings.settings.showActiveWindowIcon = !Settings.settings.showActiveWindowIcon Settings.settings.showActiveWindowIcon = !Settings.settings.showActiveWindowIcon;
} }
} }
} }
@ -207,7 +207,7 @@ Rectangle {
anchors.fill: parent anchors.fill: parent
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: { onClicked: {
Settings.settings.showSystemInfoInBar = !Settings.settings.showSystemInfoInBar Settings.settings.showSystemInfoInBar = !Settings.settings.showSystemInfoInBar;
} }
} }
} }
@ -262,7 +262,7 @@ Rectangle {
anchors.fill: parent anchors.fill: parent
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: { onClicked: {
Settings.settings.showCorners = !Settings.settings.showCorners Settings.settings.showCorners = !Settings.settings.showCorners;
} }
} }
} }
@ -317,7 +317,7 @@ Rectangle {
anchors.fill: parent anchors.fill: parent
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: { onClicked: {
Settings.settings.showTaskbar = !Settings.settings.showTaskbar Settings.settings.showTaskbar = !Settings.settings.showTaskbar;
} }
} }
} }
@ -372,7 +372,7 @@ Rectangle {
anchors.fill: parent anchors.fill: parent
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: { onClicked: {
Settings.settings.showDock = !Settings.settings.showDock Settings.settings.showDock = !Settings.settings.showDock;
} }
} }
} }
@ -427,7 +427,7 @@ Rectangle {
anchors.fill: parent anchors.fill: parent
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: { onClicked: {
Settings.settings.showMediaInBar = !Settings.settings.showMediaInBar Settings.settings.showMediaInBar = !Settings.settings.showMediaInBar;
} }
} }
} }
@ -482,7 +482,7 @@ Rectangle {
anchors.fill: parent anchors.fill: parent
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: { onClicked: {
Settings.settings.dimPanels = !Settings.settings.dimPanels Settings.settings.dimPanels = !Settings.settings.dimPanels;
} }
} }
} }
@ -621,7 +621,7 @@ Rectangle {
activeFocusOnTab: true activeFocusOnTab: true
inputMethodHints: Qt.ImhUrlCharactersOnly inputMethodHints: Qt.ImhUrlCharactersOnly
onTextChanged: { onTextChanged: {
Settings.settings.videoPath = text Settings.settings.videoPath = text;
} }
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
@ -632,4 +632,4 @@ Rectangle {
} }
} }
} }
} }

View file

@ -1,7 +1,7 @@
import QtQuick import QtQuick
import QtQuick.Controls import QtQuick.Controls
import QtQuick.Layouts import QtQuick.Layouts
import Qt5Compat.GraphicalEffects import QtQuick.Effects
import qs.Settings import qs.Settings
import qs.Components import qs.Components
import qs.Services import qs.Services
@ -61,7 +61,8 @@ Rectangle {
// Album art with spectrum // Album art with spectrum
Item { Item {
id: albumArtContainer 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 Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter
// Spectrum visualizer // Spectrum visualizer
@ -80,7 +81,8 @@ Rectangle {
// Album art image // Album art image
Rectangle { Rectangle {
id: albumArtwork id: albumArtwork
width: 60; height: 60 width: 60
height: 60
anchors.centerIn: parent anchors.centerIn: parent
radius: 30 // circle radius: 30 // circle
color: Qt.darker(Theme.surface, 1.1) color: Qt.darker(Theme.surface, 1.1)
@ -103,14 +105,23 @@ Rectangle {
// Rounded corners using layer // Rounded corners using layer
layer.enabled: true layer.enabled: true
layer.effect: OpacityMask { layer.effect: MultiEffect {
cached: true maskEnabled: true
maskSource: Rectangle { maskSource: mask
width: albumArt.width }
height: albumArt.height }
radius: albumArt.width / 2 // circle
visible: false 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) color: Qt.rgba(Theme.textPrimary.r, Theme.textPrimary.g, Theme.textPrimary.b, 0.15)
Layout.fillWidth: true Layout.fillWidth: true
property real progressRatio: Math.min(1, MusicManager.trackLength > 0 ? property real progressRatio: Math.min(1, MusicManager.trackLength > 0 ? (MusicManager.currentPosition / MusicManager.trackLength) : 0)
(MusicManager.currentPosition / MusicManager.trackLength) : 0)
Rectangle { Rectangle {
id: progressFill id: progressFill
@ -183,7 +193,9 @@ Rectangle {
color: Theme.accentPrimary color: Theme.accentPrimary
Behavior on width { Behavior on width {
NumberAnimation { duration: 200 } NumberAnimation {
duration: 200
}
} }
} }
@ -197,14 +209,16 @@ Rectangle {
border.color: Qt.lighter(Theme.accentPrimary, 1.3) border.color: Qt.lighter(Theme.accentPrimary, 1.3)
border.width: 1 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 anchors.verticalCenter: parent.verticalCenter
visible: MusicManager.trackLength > 0 visible: MusicManager.trackLength > 0
scale: progressMouseArea.containsMouse || progressMouseArea.pressed ? 1.2 : 1.0 scale: progressMouseArea.containsMouse || progressMouseArea.pressed ? 1.2 : 1.0
Behavior on scale { Behavior on scale {
NumberAnimation { duration: 150 } NumberAnimation {
duration: 150
}
} }
} }
@ -216,15 +230,15 @@ Rectangle {
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
enabled: MusicManager.trackLength > 0 && MusicManager.canSeek enabled: MusicManager.trackLength > 0 && MusicManager.canSeek
onClicked: function(mouse) { onClicked: function (mouse) {
let ratio = mouse.x / width let ratio = mouse.x / width;
MusicManager.seekByRatio(ratio) MusicManager.seekByRatio(ratio);
} }
onPositionChanged: function(mouse) { onPositionChanged: function (mouse) {
if (pressed) { if (pressed) {
let ratio = Math.max(0, Math.min(1, mouse.x / width)) let ratio = Math.max(0, Math.min(1, mouse.x / width));
MusicManager.seekByRatio(ratio) MusicManager.seekByRatio(ratio);
} }
} }
} }
@ -319,4 +333,4 @@ Rectangle {
} }
} }
} }
} }

View file

@ -1,7 +1,7 @@
import QtQuick import QtQuick
import QtQuick.Layouts import QtQuick.Layouts
import QtQuick.Controls import QtQuick.Controls
import Qt5Compat.GraphicalEffects import QtQuick.Effects
import Quickshell import Quickshell
import Quickshell.Io import Quickshell.Io
import qs.Settings import qs.Settings

View file

@ -1,7 +1,7 @@
import QtQuick import QtQuick
import QtQuick.Layouts import QtQuick.Layouts
import QtQuick.Controls import QtQuick.Controls
import Qt5Compat.GraphicalEffects import QtQuick.Effects
import Quickshell import Quickshell
import Quickshell.Io import Quickshell.Io
import Quickshell.Widgets import Quickshell.Widgets
@ -380,7 +380,7 @@ Rectangle {
running: false running: false
} }
Process { Process {
id: logoutProcessNiri id: logoutProcessNiri
command: ["niri", "msg", "action", "quit", "--skip-confirmation"] command: ["niri", "msg", "action", "quit", "--skip-confirmation"]
running: false running: false
@ -421,7 +421,6 @@ Rectangle {
rebootProcess.running = true; rebootProcess.running = true;
} }
property bool panelVisible: false property bool panelVisible: false
// Trigger initial update when panel becomes visible // Trigger initial update when panel becomes visible
@ -451,4 +450,4 @@ Rectangle {
LockScreen { LockScreen {
id: lockScreen id: lockScreen
} }
} }