mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-29 16:02:51 -05:00
display: fix wallpaper when using monitor model
This commit is contained in:
@@ -422,29 +422,59 @@ Singleton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function setMonitorWallpaper(screenName, path) {
|
function setMonitorWallpaper(screenName, path) {
|
||||||
var newMonitorWallpapers = Object.assign({}, monitorWallpapers)
|
var screen = null
|
||||||
if (path && path !== "") {
|
var screens = Quickshell.screens
|
||||||
newMonitorWallpapers[screenName] = path
|
for (var i = 0; i < screens.length; i++) {
|
||||||
} else {
|
if (screens[i].name === screenName) {
|
||||||
delete newMonitorWallpapers[screenName]
|
screen = screens[i]
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!screen) {
|
||||||
|
console.warn("SessionData: Screen not found:", screenName)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var identifier = typeof SettingsData !== "undefined" ? SettingsData.getScreenDisplayName(screen) : screen.name
|
||||||
|
|
||||||
|
var newMonitorWallpapers = {}
|
||||||
|
for (var key in monitorWallpapers) {
|
||||||
|
var isThisScreen = key === screen.name || (screen.model && key === screen.model)
|
||||||
|
if (!isThisScreen) {
|
||||||
|
newMonitorWallpapers[key] = monitorWallpapers[key]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (path && path !== "") {
|
||||||
|
newMonitorWallpapers[identifier] = path
|
||||||
|
}
|
||||||
|
|
||||||
monitorWallpapers = newMonitorWallpapers
|
monitorWallpapers = newMonitorWallpapers
|
||||||
|
|
||||||
if (perModeWallpaper) {
|
if (perModeWallpaper) {
|
||||||
if (isLightMode) {
|
if (isLightMode) {
|
||||||
var newLight = Object.assign({}, monitorWallpapersLight)
|
var newLight = {}
|
||||||
|
for (var key in monitorWallpapersLight) {
|
||||||
|
var isThisScreen = key === screen.name || (screen.model && key === screen.model)
|
||||||
|
if (!isThisScreen) {
|
||||||
|
newLight[key] = monitorWallpapersLight[key]
|
||||||
|
}
|
||||||
|
}
|
||||||
if (path && path !== "") {
|
if (path && path !== "") {
|
||||||
newLight[screenName] = path
|
newLight[identifier] = path
|
||||||
} else {
|
|
||||||
delete newLight[screenName]
|
|
||||||
}
|
}
|
||||||
monitorWallpapersLight = newLight
|
monitorWallpapersLight = newLight
|
||||||
} else {
|
} else {
|
||||||
var newDark = Object.assign({}, monitorWallpapersDark)
|
var newDark = {}
|
||||||
|
for (var key in monitorWallpapersDark) {
|
||||||
|
var isThisScreen = key === screen.name || (screen.model && key === screen.model)
|
||||||
|
if (!isThisScreen) {
|
||||||
|
newDark[key] = monitorWallpapersDark[key]
|
||||||
|
}
|
||||||
|
}
|
||||||
if (path && path !== "") {
|
if (path && path !== "") {
|
||||||
newDark[screenName] = path
|
newDark[identifier] = path
|
||||||
} else {
|
|
||||||
delete newDark[screenName]
|
|
||||||
}
|
}
|
||||||
monitorWallpapersDark = newDark
|
monitorWallpapersDark = newDark
|
||||||
}
|
}
|
||||||
@@ -489,61 +519,153 @@ Singleton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function setMonitorCyclingEnabled(screenName, enabled) {
|
function setMonitorCyclingEnabled(screenName, enabled) {
|
||||||
var newSettings = Object.assign({}, monitorCyclingSettings)
|
var screen = null
|
||||||
if (!newSettings[screenName]) {
|
var screens = Quickshell.screens
|
||||||
newSettings[screenName] = {
|
for (var i = 0; i < screens.length; i++) {
|
||||||
|
if (screens[i].name === screenName) {
|
||||||
|
screen = screens[i]
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!screen) {
|
||||||
|
console.warn("SessionData: Screen not found:", screenName)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var identifier = typeof SettingsData !== "undefined" ? SettingsData.getScreenDisplayName(screen) : screen.name
|
||||||
|
|
||||||
|
var newSettings = {}
|
||||||
|
for (var key in monitorCyclingSettings) {
|
||||||
|
var isThisScreen = key === screen.name || (screen.model && key === screen.model)
|
||||||
|
if (!isThisScreen) {
|
||||||
|
newSettings[key] = monitorCyclingSettings[key]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!newSettings[identifier]) {
|
||||||
|
newSettings[identifier] = {
|
||||||
"enabled": false,
|
"enabled": false,
|
||||||
"mode": "interval",
|
"mode": "interval",
|
||||||
"interval": 300,
|
"interval": 300,
|
||||||
"time": "06:00"
|
"time": "06:00"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
newSettings[screenName].enabled = enabled
|
newSettings[identifier].enabled = enabled
|
||||||
monitorCyclingSettings = newSettings
|
monitorCyclingSettings = newSettings
|
||||||
saveSettings()
|
saveSettings()
|
||||||
}
|
}
|
||||||
|
|
||||||
function setMonitorCyclingMode(screenName, mode) {
|
function setMonitorCyclingMode(screenName, mode) {
|
||||||
var newSettings = Object.assign({}, monitorCyclingSettings)
|
var screen = null
|
||||||
if (!newSettings[screenName]) {
|
var screens = Quickshell.screens
|
||||||
newSettings[screenName] = {
|
for (var i = 0; i < screens.length; i++) {
|
||||||
|
if (screens[i].name === screenName) {
|
||||||
|
screen = screens[i]
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!screen) {
|
||||||
|
console.warn("SessionData: Screen not found:", screenName)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var identifier = typeof SettingsData !== "undefined" ? SettingsData.getScreenDisplayName(screen) : screen.name
|
||||||
|
|
||||||
|
var newSettings = {}
|
||||||
|
for (var key in monitorCyclingSettings) {
|
||||||
|
var isThisScreen = key === screen.name || (screen.model && key === screen.model)
|
||||||
|
if (!isThisScreen) {
|
||||||
|
newSettings[key] = monitorCyclingSettings[key]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!newSettings[identifier]) {
|
||||||
|
newSettings[identifier] = {
|
||||||
"enabled": false,
|
"enabled": false,
|
||||||
"mode": "interval",
|
"mode": "interval",
|
||||||
"interval": 300,
|
"interval": 300,
|
||||||
"time": "06:00"
|
"time": "06:00"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
newSettings[screenName].mode = mode
|
newSettings[identifier].mode = mode
|
||||||
monitorCyclingSettings = newSettings
|
monitorCyclingSettings = newSettings
|
||||||
saveSettings()
|
saveSettings()
|
||||||
}
|
}
|
||||||
|
|
||||||
function setMonitorCyclingInterval(screenName, interval) {
|
function setMonitorCyclingInterval(screenName, interval) {
|
||||||
var newSettings = Object.assign({}, monitorCyclingSettings)
|
var screen = null
|
||||||
if (!newSettings[screenName]) {
|
var screens = Quickshell.screens
|
||||||
newSettings[screenName] = {
|
for (var i = 0; i < screens.length; i++) {
|
||||||
|
if (screens[i].name === screenName) {
|
||||||
|
screen = screens[i]
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!screen) {
|
||||||
|
console.warn("SessionData: Screen not found:", screenName)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var identifier = typeof SettingsData !== "undefined" ? SettingsData.getScreenDisplayName(screen) : screen.name
|
||||||
|
|
||||||
|
var newSettings = {}
|
||||||
|
for (var key in monitorCyclingSettings) {
|
||||||
|
var isThisScreen = key === screen.name || (screen.model && key === screen.model)
|
||||||
|
if (!isThisScreen) {
|
||||||
|
newSettings[key] = monitorCyclingSettings[key]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!newSettings[identifier]) {
|
||||||
|
newSettings[identifier] = {
|
||||||
"enabled": false,
|
"enabled": false,
|
||||||
"mode": "interval",
|
"mode": "interval",
|
||||||
"interval": 300,
|
"interval": 300,
|
||||||
"time": "06:00"
|
"time": "06:00"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
newSettings[screenName].interval = interval
|
newSettings[identifier].interval = interval
|
||||||
monitorCyclingSettings = newSettings
|
monitorCyclingSettings = newSettings
|
||||||
saveSettings()
|
saveSettings()
|
||||||
}
|
}
|
||||||
|
|
||||||
function setMonitorCyclingTime(screenName, time) {
|
function setMonitorCyclingTime(screenName, time) {
|
||||||
var newSettings = Object.assign({}, monitorCyclingSettings)
|
var screen = null
|
||||||
if (!newSettings[screenName]) {
|
var screens = Quickshell.screens
|
||||||
newSettings[screenName] = {
|
for (var i = 0; i < screens.length; i++) {
|
||||||
|
if (screens[i].name === screenName) {
|
||||||
|
screen = screens[i]
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!screen) {
|
||||||
|
console.warn("SessionData: Screen not found:", screenName)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var identifier = typeof SettingsData !== "undefined" ? SettingsData.getScreenDisplayName(screen) : screen.name
|
||||||
|
|
||||||
|
var newSettings = {}
|
||||||
|
for (var key in monitorCyclingSettings) {
|
||||||
|
var isThisScreen = key === screen.name || (screen.model && key === screen.model)
|
||||||
|
if (!isThisScreen) {
|
||||||
|
newSettings[key] = monitorCyclingSettings[key]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!newSettings[identifier]) {
|
||||||
|
newSettings[identifier] = {
|
||||||
"enabled": false,
|
"enabled": false,
|
||||||
"mode": "interval",
|
"mode": "interval",
|
||||||
"interval": 300,
|
"interval": 300,
|
||||||
"time": "06:00"
|
"time": "06:00"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
newSettings[screenName].time = time
|
newSettings[identifier].time = time
|
||||||
monitorCyclingSettings = newSettings
|
monitorCyclingSettings = newSettings
|
||||||
saveSettings()
|
saveSettings()
|
||||||
}
|
}
|
||||||
@@ -770,11 +892,57 @@ Singleton {
|
|||||||
if (!perMonitorWallpaper) {
|
if (!perMonitorWallpaper) {
|
||||||
return wallpaperPath
|
return wallpaperPath
|
||||||
}
|
}
|
||||||
return monitorWallpapers[screenName] || wallpaperPath
|
|
||||||
|
var screen = null
|
||||||
|
var screens = Quickshell.screens
|
||||||
|
for (var i = 0; i < screens.length; i++) {
|
||||||
|
if (screens[i].name === screenName) {
|
||||||
|
screen = screens[i]
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!screen) {
|
||||||
|
return monitorWallpapers[screenName] || wallpaperPath
|
||||||
|
}
|
||||||
|
|
||||||
|
if (monitorWallpapers[screen.name]) {
|
||||||
|
return monitorWallpapers[screen.name]
|
||||||
|
}
|
||||||
|
if (screen.model && monitorWallpapers[screen.model]) {
|
||||||
|
return monitorWallpapers[screen.model]
|
||||||
|
}
|
||||||
|
|
||||||
|
return wallpaperPath
|
||||||
}
|
}
|
||||||
|
|
||||||
function getMonitorCyclingSettings(screenName) {
|
function getMonitorCyclingSettings(screenName) {
|
||||||
return monitorCyclingSettings[screenName] || {
|
var screen = null
|
||||||
|
var screens = Quickshell.screens
|
||||||
|
for (var i = 0; i < screens.length; i++) {
|
||||||
|
if (screens[i].name === screenName) {
|
||||||
|
screen = screens[i]
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!screen) {
|
||||||
|
return monitorCyclingSettings[screenName] || {
|
||||||
|
"enabled": false,
|
||||||
|
"mode": "interval",
|
||||||
|
"interval": 300,
|
||||||
|
"time": "06:00"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (monitorCyclingSettings[screen.name]) {
|
||||||
|
return monitorCyclingSettings[screen.name]
|
||||||
|
}
|
||||||
|
if (screen.model && monitorCyclingSettings[screen.model]) {
|
||||||
|
return monitorCyclingSettings[screen.model]
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
"enabled": false,
|
"enabled": false,
|
||||||
"mode": "interval",
|
"mode": "interval",
|
||||||
"interval": 300,
|
"interval": 300,
|
||||||
|
|||||||
Reference in New Issue
Block a user