Removed NLoader in favor of Loader, as it was not doing anything anymore
This commit is contained in:
parent
c6eb613e38
commit
caffbe45e0
10 changed files with 65 additions and 115 deletions
|
|
@ -4,49 +4,53 @@ import Quickshell.Wayland
|
||||||
import qs.Commons
|
import qs.Commons
|
||||||
import qs.Services
|
import qs.Services
|
||||||
|
|
||||||
Variants {
|
Loader {
|
||||||
model: Quickshell.screens
|
active: !Settings.data.wallpaper.swww.enabled
|
||||||
|
|
||||||
delegate: PanelWindow {
|
sourceComponent: Variants {
|
||||||
required property ShellScreen modelData
|
model: Quickshell.screens
|
||||||
property string wallpaperSource: WallpaperService.currentWallpaper !== ""
|
|
||||||
&& !Settings.data.wallpaper.swww.enabled ? WallpaperService.currentWallpaper : ""
|
|
||||||
|
|
||||||
visible: wallpaperSource !== "" && !Settings.data.wallpaper.swww.enabled
|
delegate: PanelWindow {
|
||||||
|
required property ShellScreen modelData
|
||||||
|
property string wallpaperSource: WallpaperService.currentWallpaper !== ""
|
||||||
|
&& !Settings.data.wallpaper.swww.enabled ? WallpaperService.currentWallpaper : ""
|
||||||
|
|
||||||
// Force update when SWWW setting changes
|
visible: wallpaperSource !== "" && !Settings.data.wallpaper.swww.enabled
|
||||||
onVisibleChanged: {
|
|
||||||
if (visible) {
|
|
||||||
|
|
||||||
} else {
|
// Force update when SWWW setting changes
|
||||||
|
onVisibleChanged: {
|
||||||
|
if (visible) {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
color: Color.transparent
|
||||||
color: Color.transparent
|
screen: modelData
|
||||||
screen: modelData
|
WlrLayershell.layer: WlrLayer.Background
|
||||||
WlrLayershell.layer: WlrLayer.Background
|
WlrLayershell.exclusionMode: ExclusionMode.Ignore
|
||||||
WlrLayershell.exclusionMode: ExclusionMode.Ignore
|
WlrLayershell.namespace: "quickshell-wallpaper"
|
||||||
WlrLayershell.namespace: "quickshell-wallpaper"
|
|
||||||
|
|
||||||
anchors {
|
anchors {
|
||||||
bottom: true
|
bottom: true
|
||||||
top: true
|
top: true
|
||||||
right: true
|
right: true
|
||||||
left: true
|
left: true
|
||||||
}
|
}
|
||||||
|
|
||||||
margins {
|
margins {
|
||||||
top: 0
|
top: 0
|
||||||
}
|
}
|
||||||
|
|
||||||
Image {
|
Image {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
fillMode: Image.PreserveAspectCrop
|
fillMode: Image.PreserveAspectCrop
|
||||||
source: wallpaperSource
|
source: wallpaperSource
|
||||||
visible: wallpaperSource !== ""
|
visible: wallpaperSource !== ""
|
||||||
cache: true
|
cache: true
|
||||||
smooth: true
|
smooth: true
|
||||||
mipmap: false
|
mipmap: false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import qs.Commons
|
||||||
import qs.Services
|
import qs.Services
|
||||||
import qs.Widgets
|
import qs.Widgets
|
||||||
|
|
||||||
NLoader {
|
Loader {
|
||||||
active: CompositorService.isNiri
|
active: CompositorService.isNiri
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,10 @@ import qs.Commons
|
||||||
import qs.Services
|
import qs.Services
|
||||||
import qs.Widgets
|
import qs.Widgets
|
||||||
|
|
||||||
NLoader {
|
Loader {
|
||||||
isLoaded: Settings.data.general.showScreenCorners
|
active: Settings.data.general.showScreenCorners
|
||||||
|
|
||||||
content: Variants {
|
sourceComponent: Variants {
|
||||||
model: Quickshell.screens
|
model: Quickshell.screens
|
||||||
|
|
||||||
PanelWindow {
|
PanelWindow {
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ Item {
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
settingsPanel.requestedTab = SettingsPanel.Tab.Brightness
|
settingsPanel.requestedTab = SettingsPanel.Tab.Brightness
|
||||||
settingsPanel.isLoaded = true
|
settingsPanel.open(screen)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,26 +14,5 @@ NIconButton {
|
||||||
colorBorderHover: Color.transparent
|
colorBorderHover: Color.transparent
|
||||||
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
onClicked: {
|
onClicked: sidePanel.toggle(screen)
|
||||||
sidePanel.toggle(screen)
|
|
||||||
// sidePanel.isLoaded = !sidePanel.isLoaded
|
|
||||||
// Logger.log("SidePanelToggle", sidePanel.isLoaded)
|
|
||||||
// // Map this button's center to the screen and open the side panel below it
|
|
||||||
// const localCenterX = width / 2
|
|
||||||
// const localCenterY = height / 2
|
|
||||||
// const globalPoint = mapToItem(null, localCenterX, localCenterY)
|
|
||||||
// if (sidePanel.isLoaded) {
|
|
||||||
// // Call hide() instead of directly setting isLoaded to false
|
|
||||||
// if (sidePanel.item && sidePanel.item.hide) {
|
|
||||||
// sidePanel.item.hide()
|
|
||||||
// } else {
|
|
||||||
// sidePanel.isLoaded = false
|
|
||||||
// }
|
|
||||||
// } else if (sidePanel.openAt) {
|
|
||||||
// sidePanel.openAt(globalPoint.x, screen)
|
|
||||||
// } else {
|
|
||||||
// // Fallback: toggle if API unavailable
|
|
||||||
// sidePanel.isLoaded = true
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,9 +9,9 @@ import qs.Commons
|
||||||
import qs.Services
|
import qs.Services
|
||||||
import qs.Widgets
|
import qs.Widgets
|
||||||
|
|
||||||
NLoader {
|
Loader {
|
||||||
isLoaded: (Settings.data.dock.monitors.length > 0)
|
active: (Settings.data.dock.monitors.length > 0)
|
||||||
content: Component {
|
sourceComponent: Component {
|
||||||
Variants {
|
Variants {
|
||||||
model: Quickshell.screens
|
model: Quickshell.screens
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -47,8 +47,8 @@ Item {
|
||||||
function toggle() {
|
function toggle() {
|
||||||
// Only lock if not already locked (prevents the red screen issue)
|
// Only lock if not already locked (prevents the red screen issue)
|
||||||
// Note: No unlock via IPC for security reasons
|
// Note: No unlock via IPC for security reasons
|
||||||
if (!lockScreen.isLoaded) {
|
if (!lockScreen.active) {
|
||||||
lockScreen.isLoaded = true
|
lockScreen.active = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,12 +12,13 @@ import qs.Commons
|
||||||
import qs.Services
|
import qs.Services
|
||||||
import qs.Widgets
|
import qs.Widgets
|
||||||
|
|
||||||
NLoader {
|
Loader {
|
||||||
id: lockScreen
|
id: lockScreen
|
||||||
|
active: false
|
||||||
|
|
||||||
// Log state changes to help debug lock screen issues
|
// Log state changes to help debug lock screen issues
|
||||||
onIsLoadedChanged: {
|
onActiveChanged: {
|
||||||
Logger.log("LockScreen", "State changed - isLoaded:", isLoaded)
|
Logger.log("LockScreen", "State changed:", active)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allow a small grace period after unlocking so the compositor releases the lock surfaces
|
// Allow a small grace period after unlocking so the compositor releases the lock surfaces
|
||||||
|
|
@ -26,23 +27,28 @@ NLoader {
|
||||||
interval: 250
|
interval: 250
|
||||||
repeat: false
|
repeat: false
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
Logger.log("LockScreen", "Unload timer triggered - setting isLoaded to false")
|
Logger.log("LockScreen", "Unload timer triggered - deactivating")
|
||||||
lockScreen.isLoaded = false
|
lockScreen.active = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function scheduleUnloadAfterUnlock() {
|
function scheduleUnloadAfterUnlock() {
|
||||||
Logger.log("LockScreen", "Scheduling unload after unlock")
|
Logger.log("LockScreen", "Scheduling unload after unlock")
|
||||||
unloadAfterUnlockTimer.start()
|
unloadAfterUnlockTimer.start()
|
||||||
}
|
}
|
||||||
content: Component {
|
sourceComponent: Component {
|
||||||
WlSessionLock {
|
WlSessionLock {
|
||||||
id: lock
|
id: lock
|
||||||
|
|
||||||
// Tie session lock to loader visibility
|
// Tie session lock to loader visibility
|
||||||
locked: lockScreen.isLoaded
|
locked: lockScreen.active
|
||||||
|
|
||||||
// Lockscreen is a different beast, needs a capital 'S' in 'Screen' to access the current screen
|
// Lockscreen is a different beast, needs a capital 'S' in 'Screen' to access the current screen
|
||||||
// Also we use a different scaling algorithm based on the resolution, as the design is full screen
|
// Also we use a different scaling algorithm based on the resolution, as the design is full screen
|
||||||
readonly property real scaling: ScalingService.dynamicScale(Screen)
|
readonly property real scaling: {
|
||||||
|
var tt = ScalingService.dynamicScale(Screen)
|
||||||
|
console.log(tt)
|
||||||
|
return tt
|
||||||
|
}
|
||||||
|
|
||||||
property string errorMessage: ""
|
property string errorMessage: ""
|
||||||
property bool authenticating: false
|
property bool authenticating: false
|
||||||
|
|
|
||||||
|
|
@ -55,8 +55,8 @@ NPanel {
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case "lock":
|
case "lock":
|
||||||
// Access lockScreen directly like IPCManager does
|
// Access lockScreen directly like IPCManager does
|
||||||
if (!lockScreen.isLoaded) {
|
if (!lockScreen.active) {
|
||||||
lockScreen.isLoaded = true
|
lockScreen.active = true
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
case "suspend":
|
case "suspend":
|
||||||
|
|
|
||||||
|
|
@ -1,39 +0,0 @@
|
||||||
import QtQuick
|
|
||||||
|
|
||||||
// Example usage:
|
|
||||||
// NLoader {
|
|
||||||
// content: Component {
|
|
||||||
// YourComponent {
|
|
||||||
Loader {
|
|
||||||
id: loader
|
|
||||||
|
|
||||||
// Boolean control to load/unload the item
|
|
||||||
property bool isLoaded: false
|
|
||||||
|
|
||||||
// Provide the component to be loaded.
|
|
||||||
property Component content
|
|
||||||
|
|
||||||
active: isLoaded
|
|
||||||
asynchronous: true
|
|
||||||
sourceComponent: content
|
|
||||||
|
|
||||||
onActiveChanged: {
|
|
||||||
if (active && item && item.show) {
|
|
||||||
item.show()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onItemChanged: {
|
|
||||||
if (active && item && item.show) {
|
|
||||||
item.show()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Connections {
|
|
||||||
target: loader.item
|
|
||||||
ignoreUnknownSignals: true
|
|
||||||
function onDismissed() {
|
|
||||||
loader.isLoaded = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue