mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
NiriService: Added overview active to properly unload overview when not in use. WIP
This commit is contained in:
@@ -11,21 +11,18 @@ Variants {
|
||||
|
||||
delegate: Loader {
|
||||
required property ShellScreen modelData
|
||||
|
||||
active: CompositorService.isNiri && modelData && Settings.data.wallpaper.enabled
|
||||
|
||||
property string wallpaper: ""
|
||||
|
||||
active: CompositorService.isNiri && Settings.data.wallpaper.enabled && modelData && CompositorService.backend?.overviewActive
|
||||
|
||||
sourceComponent: PanelWindow {
|
||||
id: panelWindow
|
||||
|
||||
Component.onCompleted: {
|
||||
if (modelData) {
|
||||
Logger.log("Overview", "Loading Overview component for Niri on", modelData.name)
|
||||
}
|
||||
updateWallpaper()
|
||||
}
|
||||
|
||||
function updateWallpaper() {
|
||||
wallpaper = modelData ? WallpaperService.getWallpaper(modelData.name) : ""
|
||||
setWallpaperInitial()
|
||||
}
|
||||
|
||||
// External state management
|
||||
@@ -38,13 +35,12 @@ Variants {
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: WallpaperService
|
||||
function onIsInitializedChanged() {
|
||||
if (WallpaperService.isInitialized) {
|
||||
updateWallpaper()
|
||||
}
|
||||
function setWallpaperInitial() {
|
||||
if (!WallpaperService || !WallpaperService.isInitialized) {
|
||||
Qt.callLater(setWallpaperInitial)
|
||||
return
|
||||
}
|
||||
wallpaper = WallpaperService.getWallpaper(modelData.name)
|
||||
}
|
||||
|
||||
color: Color.transparent
|
||||
@@ -60,29 +56,46 @@ Variants {
|
||||
left: true
|
||||
}
|
||||
|
||||
Image {
|
||||
id: bgImage
|
||||
// Wrap everything in an Item with opacity animation
|
||||
Item {
|
||||
id: contentContainer
|
||||
anchors.fill: parent
|
||||
fillMode: Image.PreserveAspectCrop
|
||||
source: wallpaper
|
||||
smooth: true
|
||||
mipmap: false
|
||||
cache: false
|
||||
}
|
||||
opacity: 0
|
||||
|
||||
MultiEffect {
|
||||
anchors.fill: parent
|
||||
source: bgImage
|
||||
autoPaddingEnabled: false
|
||||
blurEnabled: true
|
||||
blur: 0.48
|
||||
blurMax: 128
|
||||
}
|
||||
Behavior on opacity {
|
||||
NumberAnimation {
|
||||
duration: 500
|
||||
easing.type: Easing.OutCubic
|
||||
}
|
||||
}
|
||||
|
||||
// Make the overview darker
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: Settings.data.colorSchemes.darkMode ? Qt.alpha(Color.mSurface, Style.opacityMedium) : Qt.alpha(Color.mOnSurface, Style.opacityMedium)
|
||||
Component.onCompleted: {
|
||||
opacity = 1
|
||||
}
|
||||
|
||||
Image {
|
||||
id: bgImage
|
||||
anchors.fill: parent
|
||||
fillMode: Image.PreserveAspectCrop
|
||||
source: wallpaper
|
||||
smooth: true
|
||||
mipmap: false
|
||||
cache: false
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,8 @@ Item {
|
||||
property var windows: []
|
||||
property int focusedWindowIndex: -1
|
||||
|
||||
property bool overviewActive: false
|
||||
|
||||
// Signals that match the facade interface
|
||||
signal workspaceChanged
|
||||
signal activeWindowChanged
|
||||
@@ -127,6 +129,8 @@ Item {
|
||||
handleWindowFocusChanged(event.WindowFocusChanged)
|
||||
} else if (event.WindowLayoutsChanged) {
|
||||
handleWindowLayoutsChanged(event.WindowLayoutsChanged)
|
||||
} else if (event.OverviewOpenedOrClosed) {
|
||||
handleOverviewOpenedOrClosed(event.OverviewOpenedOrClosed)
|
||||
}
|
||||
} catch (e) {
|
||||
Logger.error("NiriService", "Error parsing event stream:", e, data)
|
||||
@@ -318,6 +322,15 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
function handleOverviewOpenedOrClosed(eventData) {
|
||||
try {
|
||||
overviewActive = eventData.is_open
|
||||
Logger.log("NiriService", "Overview opened or closed:", eventData.is_open)
|
||||
} catch (e) {
|
||||
Logger.error("NiriService", "Error handling OverviewOpenedOrClosed:", e)
|
||||
}
|
||||
}
|
||||
|
||||
// Public functions
|
||||
function switchToWorkspace(workspaceId) {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user