This commit is contained in:
Ly-sec
2025-10-04 17:10:08 +02:00
5 changed files with 52 additions and 49 deletions
+2
View File
@@ -105,6 +105,7 @@ Variants {
visible: false
cache: false
asynchronous: true
sourceSize: Qt.size(modelData.width, modelData.height)
onStatusChanged: {
if (status === Image.Error) {
Logger.warn("Current wallpaper failed to load:", source)
@@ -120,6 +121,7 @@ Variants {
visible: false
cache: false
asynchronous: true
sourceSize: Qt.size(modelData.width, modelData.height)
onStatusChanged: {
if (status === Image.Error) {
Logger.warn("Next wallpaper failed to load:", source)
+21 -41
View File
@@ -13,7 +13,7 @@ Variants {
required property ShellScreen modelData
property string wallpaper: ""
active: CompositorService.isNiri && Settings.data.wallpaper.enabled && modelData && CompositorService.backend?.overviewActive
active: CompositorService.isNiri && Settings.data.wallpaper.enabled && modelData
sourceComponent: PanelWindow {
id: panelWindow
@@ -59,48 +59,28 @@ Variants {
left: true
}
// Wrap everything in an Item with opacity animation
Item {
id: contentContainer
Image {
id: bgImage
anchors.fill: parent
opacity: 0
fillMode: Image.PreserveAspectCrop
source: wallpaper
smooth: true
mipmap: false
cache: false
asynchronous: true
// Image is heavily blurred, so might as well save a lot of memory here.
sourceSize: Qt.size(1280, 720)
}
Behavior on opacity {
NumberAnimation {
duration: 500
easing.type: Easing.OutCubic
}
}
Component.onCompleted: {
opacity = 1
}
Image {
id: bgImage
anchors.fill: parent
fillMode: Image.PreserveAspectCrop
source: wallpaper
smooth: true
mipmap: false
cache: false
asynchronous: true
}
MultiEffect {
anchors.fill: parent
source: bgImage
autoPaddingEnabled: false
blurEnabled: true
blur: 0.48
blurMax: 128
}
Rectangle {
anchors.fill: parent
color: Settings.data.colorSchemes.darkMode ? Qt.alpha(Color.mSurface, Style.opacityMedium) : Qt.alpha(Color.mOnSurface, Style.opacityMedium)
}
MultiEffect {
anchors.fill: parent
source: bgImage
autoPaddingEnabled: false
blurEnabled: true
blur: 0.48
blurMax: 128
colorization: Style.opacityMedium
colorizationColor: Settings.data.colorSchemes.darkMode ? Color.mSurface : Color.mOnSurface
}
}
}
+2
View File
@@ -79,6 +79,8 @@ Variants {
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.RightButton
hoverEnabled: false
preventStealing: true
onClicked: function (mouse) {
if (mouse.button === Qt.RightButton) {
// Important to pass the screen here so we get the right widget for the actual bar that was clicked.
+15 -7
View File
@@ -8,12 +8,18 @@ Item {
property string widgetId: ""
property var widgetProps: ({})
property string screenName: widgetProps.screen ? widgetProps.screen.name : ""
property string section: widgetProps.section || ""
property int sectionIndex: widgetProps.sectionWidgetIndex || 0
property string screenName: widgetProps && widgetProps.screen ? widgetProps.screen.name : ""
property string section: widgetProps && widgetProps.section || ""
property int sectionIndex: widgetProps && widgetProps.sectionWidgetIndex || 0
// Don't reserve space unless the loaded widget is really visible
implicitWidth: getImplicitSize(loader.item, "implicitWidth")
implicitHeight: getImplicitSize(loader.item, "implicitHeight")
Connections {
target: ScalingService
enabled: loader.item && (loader.item.screen !== undefined)
function onScaleChanged(aScreenName, scale) {
if (loader.item && loader.item.screen && aScreenName === screenName) {
loader.item['scaling'] = scale
@@ -21,15 +27,15 @@ Item {
}
}
// Don't reserve space unless the loaded widget is really visible
implicitWidth: loader.item ? loader.item.visible ? loader.item.implicitWidth : 0 : 0
implicitHeight: loader.item ? loader.item.visible ? loader.item.implicitHeight : 0 : 0
function getImplicitSize(item, prop) {
return (item && item.visible) ? item[prop] : 0
}
Loader {
id: loader
anchors.fill: parent
active: widgetId !== ""
asynchronous: false
sourceComponent: {
if (!active) {
return null
@@ -64,6 +70,8 @@ Item {
if (screenName && section) {
BarService.unregisterWidget(screenName, section, widgetId, sectionIndex)
}
// Explicitly clear references
widgetProps = null
}
}
+12 -1
View File
@@ -50,6 +50,12 @@ NBox {
visible: MediaService.currentPlayer && MediaService.canPlay
spacing: Style.marginM * scaling
Layout.alignment: Qt.AlignHCenter
Item {
Layout.fillWidth: true
Layout.fillHeight: true
}
// Player selector using NContextMenu
Rectangle {
@@ -341,5 +347,10 @@ NBox {
Layout.alignment: Qt.AlignHCenter
}
}
Item {
Layout.fillWidth: true
Layout.fillHeight: true
}
}
}
}