mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2025-12-05 21:15:38 -05:00
wallpaper: disable cycling if any toplevel is full screen
This commit is contained in:
@@ -3,7 +3,6 @@ import QtQuick.Layouts
|
||||
import qs.Common
|
||||
import qs.Services
|
||||
import qs.Widgets
|
||||
import qs.Modules.DankDash
|
||||
|
||||
DankPopout {
|
||||
id: root
|
||||
|
||||
@@ -4,12 +4,21 @@ pragma ComponentBehavior: Bound
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import qs.Common
|
||||
import Quickshell.Wayland
|
||||
|
||||
Singleton {
|
||||
id: root
|
||||
|
||||
property bool cyclingActive: false
|
||||
readonly property bool anyFullscreen: {
|
||||
if (!ToplevelManager.toplevels?.values)
|
||||
return false;
|
||||
for (const toplevel of ToplevelManager.toplevels.values) {
|
||||
if (toplevel.fullscreen)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
property string cachedCyclingTime: SessionData.wallpaperCyclingTime
|
||||
property int cachedCyclingInterval: SessionData.wallpaperCyclingInterval
|
||||
property string lastTimeCheck: ""
|
||||
@@ -24,8 +33,8 @@ Singleton {
|
||||
running: false
|
||||
repeat: true
|
||||
onTriggered: {
|
||||
if (typeof WallpaperCyclingService !== "undefined" && targetScreen !== "") {
|
||||
WallpaperCyclingService.cycleNextForMonitor(targetScreen)
|
||||
if (typeof WallpaperCyclingService !== "undefined" && targetScreen !== "" && !WallpaperCyclingService.anyFullscreen) {
|
||||
WallpaperCyclingService.cycleNextForMonitor(targetScreen);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -41,24 +50,26 @@ Singleton {
|
||||
stdout: StdioCollector {
|
||||
onStreamFinished: {
|
||||
if (text && text.trim()) {
|
||||
const files = text.trim().split('\n').filter(file => file.length > 0)
|
||||
if (files.length <= 1) return
|
||||
const wallpaperList = files.sort()
|
||||
const currentPath = currentWallpaper
|
||||
let currentIndex = wallpaperList.findIndex(path => path === currentPath)
|
||||
if (currentIndex === -1) currentIndex = 0
|
||||
let targetIndex
|
||||
const files = text.trim().split('\n').filter(file => file.length > 0);
|
||||
if (files.length <= 1)
|
||||
return;
|
||||
const wallpaperList = files.sort();
|
||||
const currentPath = currentWallpaper;
|
||||
let currentIndex = wallpaperList.findIndex(path => path === currentPath);
|
||||
if (currentIndex === -1)
|
||||
currentIndex = 0;
|
||||
let targetIndex;
|
||||
if (goToPrevious) {
|
||||
targetIndex = currentIndex === 0 ? wallpaperList.length - 1 : currentIndex - 1
|
||||
targetIndex = currentIndex === 0 ? wallpaperList.length - 1 : currentIndex - 1;
|
||||
} else {
|
||||
targetIndex = (currentIndex + 1) % wallpaperList.length
|
||||
targetIndex = (currentIndex + 1) % wallpaperList.length;
|
||||
}
|
||||
const targetWallpaper = wallpaperList[targetIndex]
|
||||
const targetWallpaper = wallpaperList[targetIndex];
|
||||
if (targetWallpaper && targetWallpaper !== currentPath) {
|
||||
if (targetScreenName) {
|
||||
SessionData.setMonitorWallpaper(targetScreenName, targetWallpaper)
|
||||
SessionData.setMonitorWallpaper(targetScreenName, targetWallpaper);
|
||||
} else {
|
||||
SessionData.setWallpaper(targetWallpaper)
|
||||
SessionData.setWallpaper(targetWallpaper);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -71,205 +82,205 @@ Singleton {
|
||||
target: SessionData
|
||||
|
||||
function onWallpaperCyclingEnabledChanged() {
|
||||
updateCyclingState()
|
||||
updateCyclingState();
|
||||
}
|
||||
|
||||
function onWallpaperCyclingModeChanged() {
|
||||
updateCyclingState()
|
||||
updateCyclingState();
|
||||
}
|
||||
|
||||
function onWallpaperCyclingIntervalChanged() {
|
||||
cachedCyclingInterval = SessionData.wallpaperCyclingInterval
|
||||
cachedCyclingInterval = SessionData.wallpaperCyclingInterval;
|
||||
if (SessionData.wallpaperCyclingMode === "interval") {
|
||||
updateCyclingState()
|
||||
updateCyclingState();
|
||||
}
|
||||
}
|
||||
|
||||
function onWallpaperCyclingTimeChanged() {
|
||||
cachedCyclingTime = SessionData.wallpaperCyclingTime
|
||||
cachedCyclingTime = SessionData.wallpaperCyclingTime;
|
||||
if (SessionData.wallpaperCyclingMode === "time") {
|
||||
updateCyclingState()
|
||||
updateCyclingState();
|
||||
}
|
||||
}
|
||||
|
||||
function onPerMonitorWallpaperChanged() {
|
||||
updateCyclingState()
|
||||
updateCyclingState();
|
||||
}
|
||||
|
||||
function onMonitorCyclingSettingsChanged() {
|
||||
updateCyclingState()
|
||||
updateCyclingState();
|
||||
}
|
||||
}
|
||||
|
||||
function updateCyclingState() {
|
||||
if (SessionData.perMonitorWallpaper) {
|
||||
stopCycling()
|
||||
updatePerMonitorCycling()
|
||||
stopCycling();
|
||||
updatePerMonitorCycling();
|
||||
} else if (SessionData.wallpaperCyclingEnabled && SessionData.wallpaperPath) {
|
||||
startCycling()
|
||||
stopAllMonitorCycling()
|
||||
startCycling();
|
||||
stopAllMonitorCycling();
|
||||
} else {
|
||||
stopCycling()
|
||||
stopAllMonitorCycling()
|
||||
stopCycling();
|
||||
stopAllMonitorCycling();
|
||||
}
|
||||
}
|
||||
|
||||
function updatePerMonitorCycling() {
|
||||
if (typeof Quickshell === "undefined") return
|
||||
|
||||
var screens = Quickshell.screens
|
||||
if (typeof Quickshell === "undefined")
|
||||
return;
|
||||
var screens = Quickshell.screens;
|
||||
for (var i = 0; i < screens.length; i++) {
|
||||
var screenName = screens[i].name
|
||||
var settings = SessionData.getMonitorCyclingSettings(screenName)
|
||||
var wallpaper = SessionData.getMonitorWallpaper(screenName)
|
||||
var screenName = screens[i].name;
|
||||
var settings = SessionData.getMonitorCyclingSettings(screenName);
|
||||
var wallpaper = SessionData.getMonitorWallpaper(screenName);
|
||||
|
||||
if (settings.enabled && wallpaper && !wallpaper.startsWith("#")) {
|
||||
startMonitorCycling(screenName, settings)
|
||||
startMonitorCycling(screenName, settings);
|
||||
} else {
|
||||
stopMonitorCycling(screenName)
|
||||
stopMonitorCycling(screenName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function stopAllMonitorCycling() {
|
||||
var screenNames = Object.keys(monitorTimers)
|
||||
var screenNames = Object.keys(monitorTimers);
|
||||
for (var i = 0; i < screenNames.length; i++) {
|
||||
stopMonitorCycling(screenNames[i])
|
||||
stopMonitorCycling(screenNames[i]);
|
||||
}
|
||||
}
|
||||
|
||||
function startCycling() {
|
||||
if (SessionData.wallpaperCyclingMode === "interval") {
|
||||
intervalTimer.interval = cachedCyclingInterval * 1000
|
||||
intervalTimer.start()
|
||||
cyclingActive = true
|
||||
intervalTimer.interval = cachedCyclingInterval * 1000;
|
||||
intervalTimer.start();
|
||||
cyclingActive = true;
|
||||
} else if (SessionData.wallpaperCyclingMode === "time") {
|
||||
cyclingActive = true
|
||||
checkTimeBasedCycling()
|
||||
cyclingActive = true;
|
||||
checkTimeBasedCycling();
|
||||
}
|
||||
}
|
||||
|
||||
function stopCycling() {
|
||||
intervalTimer.stop()
|
||||
cyclingActive = false
|
||||
intervalTimer.stop();
|
||||
cyclingActive = false;
|
||||
}
|
||||
|
||||
function startMonitorCycling(screenName, settings) {
|
||||
if (settings.mode === "interval") {
|
||||
var timer = monitorTimers[screenName]
|
||||
var timer = monitorTimers[screenName];
|
||||
if (!timer && monitorTimerComponent && monitorTimerComponent.status === Component.Ready) {
|
||||
var newTimers = Object.assign({}, monitorTimers)
|
||||
newTimers[screenName] = monitorTimerComponent.createObject(root)
|
||||
newTimers[screenName].targetScreen = screenName
|
||||
monitorTimers = newTimers
|
||||
timer = monitorTimers[screenName]
|
||||
var newTimers = Object.assign({}, monitorTimers);
|
||||
newTimers[screenName] = monitorTimerComponent.createObject(root);
|
||||
newTimers[screenName].targetScreen = screenName;
|
||||
monitorTimers = newTimers;
|
||||
timer = monitorTimers[screenName];
|
||||
}
|
||||
if (timer) {
|
||||
timer.interval = settings.interval * 1000
|
||||
timer.start()
|
||||
timer.interval = settings.interval * 1000;
|
||||
timer.start();
|
||||
}
|
||||
} else if (settings.mode === "time") {
|
||||
var newChecks = Object.assign({}, monitorLastTimeChecks)
|
||||
newChecks[screenName] = ""
|
||||
monitorLastTimeChecks = newChecks
|
||||
var newChecks = Object.assign({}, monitorLastTimeChecks);
|
||||
newChecks[screenName] = "";
|
||||
monitorLastTimeChecks = newChecks;
|
||||
}
|
||||
}
|
||||
|
||||
function stopMonitorCycling(screenName) {
|
||||
var timer = monitorTimers[screenName]
|
||||
var timer = monitorTimers[screenName];
|
||||
if (timer) {
|
||||
timer.stop()
|
||||
timer.destroy()
|
||||
var newTimers = Object.assign({}, monitorTimers)
|
||||
delete newTimers[screenName]
|
||||
monitorTimers = newTimers
|
||||
timer.stop();
|
||||
timer.destroy();
|
||||
var newTimers = Object.assign({}, monitorTimers);
|
||||
delete newTimers[screenName];
|
||||
monitorTimers = newTimers;
|
||||
}
|
||||
|
||||
var process = monitorProcesses[screenName]
|
||||
var process = monitorProcesses[screenName];
|
||||
if (process) {
|
||||
process.destroy()
|
||||
var newProcesses = Object.assign({}, monitorProcesses)
|
||||
delete newProcesses[screenName]
|
||||
monitorProcesses = newProcesses
|
||||
process.destroy();
|
||||
var newProcesses = Object.assign({}, monitorProcesses);
|
||||
delete newProcesses[screenName];
|
||||
monitorProcesses = newProcesses;
|
||||
}
|
||||
|
||||
var newChecks = Object.assign({}, monitorLastTimeChecks)
|
||||
delete newChecks[screenName]
|
||||
monitorLastTimeChecks = newChecks
|
||||
var newChecks = Object.assign({}, monitorLastTimeChecks);
|
||||
delete newChecks[screenName];
|
||||
monitorLastTimeChecks = newChecks;
|
||||
}
|
||||
|
||||
function cycleToNextWallpaper(screenName, wallpaperPath) {
|
||||
const currentWallpaper = wallpaperPath || SessionData.wallpaperPath
|
||||
if (!currentWallpaper) return
|
||||
|
||||
const wallpaperDir = currentWallpaper.substring(0, currentWallpaper.lastIndexOf('/'))
|
||||
const currentWallpaper = wallpaperPath || SessionData.wallpaperPath;
|
||||
if (!currentWallpaper)
|
||||
return;
|
||||
const wallpaperDir = currentWallpaper.substring(0, currentWallpaper.lastIndexOf('/'));
|
||||
|
||||
if (screenName && monitorProcessComponent && monitorProcessComponent.status === Component.Ready) {
|
||||
// Use per-monitor process
|
||||
var process = monitorProcesses[screenName]
|
||||
var process = monitorProcesses[screenName];
|
||||
if (!process) {
|
||||
var newProcesses = Object.assign({}, monitorProcesses)
|
||||
newProcesses[screenName] = monitorProcessComponent.createObject(root)
|
||||
monitorProcesses = newProcesses
|
||||
process = monitorProcesses[screenName]
|
||||
var newProcesses = Object.assign({}, monitorProcesses);
|
||||
newProcesses[screenName] = monitorProcessComponent.createObject(root);
|
||||
monitorProcesses = newProcesses;
|
||||
process = monitorProcesses[screenName];
|
||||
}
|
||||
|
||||
if (process) {
|
||||
process.command = ["sh", "-c", `ls -1 "${wallpaperDir}"/*.jpg "${wallpaperDir}"/*.jpeg "${wallpaperDir}"/*.png "${wallpaperDir}"/*.bmp "${wallpaperDir}"/*.gif "${wallpaperDir}"/*.webp 2>/dev/null | sort`]
|
||||
process.targetScreenName = screenName
|
||||
process.currentWallpaper = currentWallpaper
|
||||
process.goToPrevious = false
|
||||
process.running = true
|
||||
process.command = ["sh", "-c", `ls -1 "${wallpaperDir}"/*.jpg "${wallpaperDir}"/*.jpeg "${wallpaperDir}"/*.png "${wallpaperDir}"/*.bmp "${wallpaperDir}"/*.gif "${wallpaperDir}"/*.webp 2>/dev/null | sort`];
|
||||
process.targetScreenName = screenName;
|
||||
process.currentWallpaper = currentWallpaper;
|
||||
process.goToPrevious = false;
|
||||
process.running = true;
|
||||
}
|
||||
} else {
|
||||
// Use global process for fallback
|
||||
cyclingProcess.command = ["sh", "-c", `ls -1 "${wallpaperDir}"/*.jpg "${wallpaperDir}"/*.jpeg "${wallpaperDir}"/*.png "${wallpaperDir}"/*.bmp "${wallpaperDir}"/*.gif "${wallpaperDir}"/*.webp 2>/dev/null | sort`]
|
||||
cyclingProcess.targetScreenName = screenName || ""
|
||||
cyclingProcess.currentWallpaper = currentWallpaper
|
||||
cyclingProcess.running = true
|
||||
cyclingProcess.command = ["sh", "-c", `ls -1 "${wallpaperDir}"/*.jpg "${wallpaperDir}"/*.jpeg "${wallpaperDir}"/*.png "${wallpaperDir}"/*.bmp "${wallpaperDir}"/*.gif "${wallpaperDir}"/*.webp 2>/dev/null | sort`];
|
||||
cyclingProcess.targetScreenName = screenName || "";
|
||||
cyclingProcess.currentWallpaper = currentWallpaper;
|
||||
cyclingProcess.running = true;
|
||||
}
|
||||
}
|
||||
|
||||
function cycleToPrevWallpaper(screenName, wallpaperPath) {
|
||||
const currentWallpaper = wallpaperPath || SessionData.wallpaperPath
|
||||
if (!currentWallpaper) return
|
||||
|
||||
const wallpaperDir = currentWallpaper.substring(0, currentWallpaper.lastIndexOf('/'))
|
||||
const currentWallpaper = wallpaperPath || SessionData.wallpaperPath;
|
||||
if (!currentWallpaper)
|
||||
return;
|
||||
const wallpaperDir = currentWallpaper.substring(0, currentWallpaper.lastIndexOf('/'));
|
||||
|
||||
if (screenName && monitorProcessComponent && monitorProcessComponent.status === Component.Ready) {
|
||||
// Use per-monitor process (same as next, but with prev flag)
|
||||
var process = monitorProcesses[screenName]
|
||||
var process = monitorProcesses[screenName];
|
||||
if (!process) {
|
||||
var newProcesses = Object.assign({}, monitorProcesses)
|
||||
newProcesses[screenName] = monitorProcessComponent.createObject(root)
|
||||
monitorProcesses = newProcesses
|
||||
process = monitorProcesses[screenName]
|
||||
var newProcesses = Object.assign({}, monitorProcesses);
|
||||
newProcesses[screenName] = monitorProcessComponent.createObject(root);
|
||||
monitorProcesses = newProcesses;
|
||||
process = monitorProcesses[screenName];
|
||||
}
|
||||
|
||||
if (process) {
|
||||
process.command = ["sh", "-c", `ls -1 "${wallpaperDir}"/*.jpg "${wallpaperDir}"/*.jpeg "${wallpaperDir}"/*.png "${wallpaperDir}"/*.bmp "${wallpaperDir}"/*.gif "${wallpaperDir}"/*.webp 2>/dev/null | sort`]
|
||||
process.targetScreenName = screenName
|
||||
process.currentWallpaper = currentWallpaper
|
||||
process.goToPrevious = true
|
||||
process.running = true
|
||||
process.command = ["sh", "-c", `ls -1 "${wallpaperDir}"/*.jpg "${wallpaperDir}"/*.jpeg "${wallpaperDir}"/*.png "${wallpaperDir}"/*.bmp "${wallpaperDir}"/*.gif "${wallpaperDir}"/*.webp 2>/dev/null | sort`];
|
||||
process.targetScreenName = screenName;
|
||||
process.currentWallpaper = currentWallpaper;
|
||||
process.goToPrevious = true;
|
||||
process.running = true;
|
||||
}
|
||||
} else {
|
||||
// Use global process for fallback
|
||||
prevCyclingProcess.command = ["sh", "-c", `ls -1 "${wallpaperDir}"/*.jpg "${wallpaperDir}"/*.jpeg "${wallpaperDir}"/*.png "${wallpaperDir}"/*.bmp "${wallpaperDir}"/*.gif "${wallpaperDir}"/*.webp 2>/dev/null | sort`]
|
||||
prevCyclingProcess.targetScreenName = screenName || ""
|
||||
prevCyclingProcess.currentWallpaper = currentWallpaper
|
||||
prevCyclingProcess.running = true
|
||||
prevCyclingProcess.command = ["sh", "-c", `ls -1 "${wallpaperDir}"/*.jpg "${wallpaperDir}"/*.jpeg "${wallpaperDir}"/*.png "${wallpaperDir}"/*.bmp "${wallpaperDir}"/*.gif "${wallpaperDir}"/*.webp 2>/dev/null | sort`];
|
||||
prevCyclingProcess.targetScreenName = screenName || "";
|
||||
prevCyclingProcess.currentWallpaper = currentWallpaper;
|
||||
prevCyclingProcess.running = true;
|
||||
}
|
||||
}
|
||||
|
||||
function cycleNextManually() {
|
||||
if (SessionData.wallpaperPath) {
|
||||
cycleToNextWallpaper()
|
||||
cycleToNextWallpaper();
|
||||
// Restart timers if cycling is active
|
||||
if (cyclingActive && SessionData.wallpaperCyclingEnabled) {
|
||||
if (SessionData.wallpaperCyclingMode === "interval") {
|
||||
intervalTimer.interval = cachedCyclingInterval * 1000
|
||||
intervalTimer.restart()
|
||||
intervalTimer.interval = cachedCyclingInterval * 1000;
|
||||
intervalTimer.restart();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -277,71 +288,73 @@ Singleton {
|
||||
|
||||
function cyclePrevManually() {
|
||||
if (SessionData.wallpaperPath) {
|
||||
cycleToPrevWallpaper()
|
||||
cycleToPrevWallpaper();
|
||||
// Restart timers if cycling is active
|
||||
if (cyclingActive && SessionData.wallpaperCyclingEnabled) {
|
||||
if (SessionData.wallpaperCyclingMode === "interval") {
|
||||
intervalTimer.interval = cachedCyclingInterval * 1000
|
||||
intervalTimer.restart()
|
||||
intervalTimer.interval = cachedCyclingInterval * 1000;
|
||||
intervalTimer.restart();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function cycleNextForMonitor(screenName) {
|
||||
if (!screenName) return
|
||||
|
||||
var currentWallpaper = SessionData.getMonitorWallpaper(screenName)
|
||||
if (!screenName)
|
||||
return;
|
||||
var currentWallpaper = SessionData.getMonitorWallpaper(screenName);
|
||||
if (currentWallpaper) {
|
||||
cycleToNextWallpaper(screenName, currentWallpaper)
|
||||
cycleToNextWallpaper(screenName, currentWallpaper);
|
||||
}
|
||||
}
|
||||
|
||||
function cyclePrevForMonitor(screenName) {
|
||||
if (!screenName) return
|
||||
|
||||
var currentWallpaper = SessionData.getMonitorWallpaper(screenName)
|
||||
if (!screenName)
|
||||
return;
|
||||
var currentWallpaper = SessionData.getMonitorWallpaper(screenName);
|
||||
if (currentWallpaper) {
|
||||
cycleToPrevWallpaper(screenName, currentWallpaper)
|
||||
cycleToPrevWallpaper(screenName, currentWallpaper);
|
||||
}
|
||||
}
|
||||
|
||||
function checkTimeBasedCycling() {
|
||||
const currentTime = Qt.formatTime(systemClock.date, "hh:mm")
|
||||
if (anyFullscreen)
|
||||
return;
|
||||
const currentTime = Qt.formatTime(systemClock.date, "hh:mm");
|
||||
|
||||
if (!SessionData.perMonitorWallpaper) {
|
||||
if (currentTime === cachedCyclingTime && currentTime !== lastTimeCheck) {
|
||||
lastTimeCheck = currentTime
|
||||
cycleToNextWallpaper()
|
||||
lastTimeCheck = currentTime;
|
||||
cycleToNextWallpaper();
|
||||
} else if (currentTime !== cachedCyclingTime) {
|
||||
lastTimeCheck = ""
|
||||
lastTimeCheck = "";
|
||||
}
|
||||
} else {
|
||||
checkPerMonitorTimeBasedCycling(currentTime)
|
||||
checkPerMonitorTimeBasedCycling(currentTime);
|
||||
}
|
||||
}
|
||||
|
||||
function checkPerMonitorTimeBasedCycling(currentTime) {
|
||||
if (typeof Quickshell === "undefined") return
|
||||
|
||||
var screens = Quickshell.screens
|
||||
if (typeof Quickshell === "undefined")
|
||||
return;
|
||||
var screens = Quickshell.screens;
|
||||
for (var i = 0; i < screens.length; i++) {
|
||||
var screenName = screens[i].name
|
||||
var settings = SessionData.getMonitorCyclingSettings(screenName)
|
||||
var wallpaper = SessionData.getMonitorWallpaper(screenName)
|
||||
var screenName = screens[i].name;
|
||||
var settings = SessionData.getMonitorCyclingSettings(screenName);
|
||||
var wallpaper = SessionData.getMonitorWallpaper(screenName);
|
||||
|
||||
if (settings.enabled && settings.mode === "time" && wallpaper && !wallpaper.startsWith("#")) {
|
||||
var lastCheck = monitorLastTimeChecks[screenName] || ""
|
||||
var lastCheck = monitorLastTimeChecks[screenName] || "";
|
||||
|
||||
if (currentTime === settings.time && currentTime !== lastCheck) {
|
||||
var newChecks = Object.assign({}, monitorLastTimeChecks)
|
||||
newChecks[screenName] = currentTime
|
||||
monitorLastTimeChecks = newChecks
|
||||
cycleNextForMonitor(screenName)
|
||||
var newChecks = Object.assign({}, monitorLastTimeChecks);
|
||||
newChecks[screenName] = currentTime;
|
||||
monitorLastTimeChecks = newChecks;
|
||||
cycleNextForMonitor(screenName);
|
||||
} else if (currentTime !== settings.time) {
|
||||
var newChecks = Object.assign({}, monitorLastTimeChecks)
|
||||
newChecks[screenName] = ""
|
||||
monitorLastTimeChecks = newChecks
|
||||
var newChecks = Object.assign({}, monitorLastTimeChecks);
|
||||
newChecks[screenName] = "";
|
||||
monitorLastTimeChecks = newChecks;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -352,7 +365,11 @@ Singleton {
|
||||
interval: cachedCyclingInterval * 1000
|
||||
running: false
|
||||
repeat: true
|
||||
onTriggered: cycleToNextWallpaper()
|
||||
onTriggered: {
|
||||
if (anyFullscreen)
|
||||
return;
|
||||
cycleToNextWallpaper();
|
||||
}
|
||||
}
|
||||
|
||||
SystemClock {
|
||||
@@ -360,7 +377,7 @@ Singleton {
|
||||
precision: SystemClock.Minutes
|
||||
onDateChanged: {
|
||||
if ((SessionData.wallpaperCyclingMode === "time" && cyclingActive) || SessionData.perMonitorWallpaper) {
|
||||
checkTimeBasedCycling()
|
||||
checkTimeBasedCycling();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -376,22 +393,23 @@ Singleton {
|
||||
stdout: StdioCollector {
|
||||
onStreamFinished: {
|
||||
if (text && text.trim()) {
|
||||
const files = text.trim().split('\n').filter(file => file.length > 0)
|
||||
if (files.length <= 1) return
|
||||
const files = text.trim().split('\n').filter(file => file.length > 0);
|
||||
if (files.length <= 1)
|
||||
return;
|
||||
const wallpaperList = files.sort();
|
||||
const currentPath = cyclingProcess.currentWallpaper;
|
||||
let currentIndex = wallpaperList.findIndex(path => path === currentPath);
|
||||
if (currentIndex === -1)
|
||||
currentIndex = 0;
|
||||
|
||||
const wallpaperList = files.sort()
|
||||
const currentPath = cyclingProcess.currentWallpaper
|
||||
let currentIndex = wallpaperList.findIndex(path => path === currentPath)
|
||||
if (currentIndex === -1) currentIndex = 0
|
||||
|
||||
const nextIndex = (currentIndex + 1) % wallpaperList.length
|
||||
const nextWallpaper = wallpaperList[nextIndex]
|
||||
const nextIndex = (currentIndex + 1) % wallpaperList.length;
|
||||
const nextWallpaper = wallpaperList[nextIndex];
|
||||
|
||||
if (nextWallpaper && nextWallpaper !== currentPath) {
|
||||
if (cyclingProcess.targetScreenName) {
|
||||
SessionData.setMonitorWallpaper(cyclingProcess.targetScreenName, nextWallpaper)
|
||||
SessionData.setMonitorWallpaper(cyclingProcess.targetScreenName, nextWallpaper);
|
||||
} else {
|
||||
SessionData.setWallpaper(nextWallpaper)
|
||||
SessionData.setWallpaper(nextWallpaper);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -410,27 +428,27 @@ Singleton {
|
||||
stdout: StdioCollector {
|
||||
onStreamFinished: {
|
||||
if (text && text.trim()) {
|
||||
const files = text.trim().split('\n').filter(file => file.length > 0)
|
||||
if (files.length <= 1) return
|
||||
const files = text.trim().split('\n').filter(file => file.length > 0);
|
||||
if (files.length <= 1)
|
||||
return;
|
||||
const wallpaperList = files.sort();
|
||||
const currentPath = prevCyclingProcess.currentWallpaper;
|
||||
let currentIndex = wallpaperList.findIndex(path => path === currentPath);
|
||||
if (currentIndex === -1)
|
||||
currentIndex = 0;
|
||||
|
||||
const wallpaperList = files.sort()
|
||||
const currentPath = prevCyclingProcess.currentWallpaper
|
||||
let currentIndex = wallpaperList.findIndex(path => path === currentPath)
|
||||
if (currentIndex === -1) currentIndex = 0
|
||||
|
||||
const prevIndex = currentIndex === 0 ? wallpaperList.length - 1 : currentIndex - 1
|
||||
const prevWallpaper = wallpaperList[prevIndex]
|
||||
const prevIndex = currentIndex === 0 ? wallpaperList.length - 1 : currentIndex - 1;
|
||||
const prevWallpaper = wallpaperList[prevIndex];
|
||||
|
||||
if (prevWallpaper && prevWallpaper !== currentPath) {
|
||||
if (prevCyclingProcess.targetScreenName) {
|
||||
SessionData.setMonitorWallpaper(prevCyclingProcess.targetScreenName, prevWallpaper)
|
||||
SessionData.setMonitorWallpaper(prevCyclingProcess.targetScreenName, prevWallpaper);
|
||||
} else {
|
||||
SessionData.setWallpaper(prevWallpaper)
|
||||
SessionData.setWallpaper(prevWallpaper);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user