mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-28 23:42:51 -05:00
displays: add "show on last display" for some components.
- Lets the components migrate when un-docked to the otehr monitor, basically
This commit is contained in:
@@ -259,6 +259,7 @@ Singleton {
|
|||||||
property string updaterTerminalAdditionalParams: ""
|
property string updaterTerminalAdditionalParams: ""
|
||||||
|
|
||||||
property var screenPreferences: ({})
|
property var screenPreferences: ({})
|
||||||
|
property var showOnLastDisplay: ({})
|
||||||
|
|
||||||
signal forceDankBarLayoutRefresh
|
signal forceDankBarLayoutRefresh
|
||||||
signal forceDockLayoutRefresh
|
signal forceDockLayoutRefresh
|
||||||
@@ -494,6 +495,7 @@ Singleton {
|
|||||||
widgetBackgroundColor = settings.widgetBackgroundColor !== undefined ? settings.widgetBackgroundColor : "sch"
|
widgetBackgroundColor = settings.widgetBackgroundColor !== undefined ? settings.widgetBackgroundColor : "sch"
|
||||||
surfaceBase = settings.surfaceBase !== undefined ? settings.surfaceBase : "s"
|
surfaceBase = settings.surfaceBase !== undefined ? settings.surfaceBase : "s"
|
||||||
screenPreferences = settings.screenPreferences !== undefined ? settings.screenPreferences : ({})
|
screenPreferences = settings.screenPreferences !== undefined ? settings.screenPreferences : ({})
|
||||||
|
showOnLastDisplay = settings.showOnLastDisplay !== undefined ? settings.showOnLastDisplay : ({})
|
||||||
wallpaperFillMode = settings.wallpaperFillMode !== undefined ? settings.wallpaperFillMode : "Fill"
|
wallpaperFillMode = settings.wallpaperFillMode !== undefined ? settings.wallpaperFillMode : "Fill"
|
||||||
animationSpeed = settings.animationSpeed !== undefined ? settings.animationSpeed : SettingsData.AnimationSpeed.Short
|
animationSpeed = settings.animationSpeed !== undefined ? settings.animationSpeed : SettingsData.AnimationSpeed.Short
|
||||||
customAnimationDuration = settings.customAnimationDuration !== undefined ? settings.customAnimationDuration : 500
|
customAnimationDuration = settings.customAnimationDuration !== undefined ? settings.customAnimationDuration : 500
|
||||||
@@ -677,6 +679,7 @@ Singleton {
|
|||||||
"updaterCustomCommand": updaterCustomCommand,
|
"updaterCustomCommand": updaterCustomCommand,
|
||||||
"updaterTerminalAdditionalParams": updaterTerminalAdditionalParams,
|
"updaterTerminalAdditionalParams": updaterTerminalAdditionalParams,
|
||||||
"screenPreferences": screenPreferences,
|
"screenPreferences": screenPreferences,
|
||||||
|
"showOnLastDisplay": showOnLastDisplay,
|
||||||
"animationSpeed": animationSpeed,
|
"animationSpeed": animationSpeed,
|
||||||
"customAnimationDuration": customAnimationDuration,
|
"customAnimationDuration": customAnimationDuration,
|
||||||
"acMonitorTimeout": acMonitorTimeout,
|
"acMonitorTimeout": acMonitorTimeout,
|
||||||
@@ -743,7 +746,7 @@ Singleton {
|
|||||||
"customPowerActionLock", "customPowerActionLogout", "customPowerActionSuspend",
|
"customPowerActionLock", "customPowerActionLogout", "customPowerActionSuspend",
|
||||||
"customPowerActionHibernate", "customPowerActionReboot", "customPowerActionPowerOff",
|
"customPowerActionHibernate", "customPowerActionReboot", "customPowerActionPowerOff",
|
||||||
"updaterUseCustomCommand", "updaterCustomCommand", "updaterTerminalAdditionalParams",
|
"updaterUseCustomCommand", "updaterCustomCommand", "updaterTerminalAdditionalParams",
|
||||||
"screenPreferences", "animationSpeed", "customAnimationDuration", "acMonitorTimeout", "acLockTimeout",
|
"screenPreferences", "showOnLastDisplay", "animationSpeed", "customAnimationDuration", "acMonitorTimeout", "acLockTimeout",
|
||||||
"acSuspendTimeout", "acHibernateTimeout", "batteryMonitorTimeout", "batteryLockTimeout",
|
"acSuspendTimeout", "acHibernateTimeout", "batteryMonitorTimeout", "batteryLockTimeout",
|
||||||
"batterySuspendTimeout", "batteryHibernateTimeout", "lockBeforeSuspend",
|
"batterySuspendTimeout", "batteryHibernateTimeout", "lockBeforeSuspend",
|
||||||
"loginctlLockIntegration", "launchPrefix", "brightnessDevicePins", "configVersion"
|
"loginctlLockIntegration", "launchPrefix", "brightnessDevicePins", "configVersion"
|
||||||
@@ -943,7 +946,11 @@ Singleton {
|
|||||||
if (prefs.includes("all")) {
|
if (prefs.includes("all")) {
|
||||||
return Quickshell.screens
|
return Quickshell.screens
|
||||||
}
|
}
|
||||||
return Quickshell.screens.filter(screen => prefs.includes(screen.name))
|
var filtered = Quickshell.screens.filter(screen => prefs.includes(screen.name))
|
||||||
|
if (filtered.length === 0 && showOnLastDisplay && showOnLastDisplay[componentId] && Quickshell.screens.length === 1) {
|
||||||
|
return Quickshell.screens
|
||||||
|
}
|
||||||
|
return filtered
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendTestNotifications() {
|
function sendTestNotifications() {
|
||||||
@@ -1812,6 +1819,11 @@ Singleton {
|
|||||||
saveSettings()
|
saveSettings()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setShowOnLastDisplay(prefs) {
|
||||||
|
showOnLastDisplay = prefs
|
||||||
|
saveSettings()
|
||||||
|
}
|
||||||
|
|
||||||
function setBrightnessDevicePins(pins) {
|
function setBrightnessDevicePins(pins) {
|
||||||
brightnessDevicePins = pins
|
brightnessDevicePins = pins
|
||||||
saveSettings()
|
saveSettings()
|
||||||
|
|||||||
@@ -56,10 +56,21 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function setScreenPreferences(componentId, screenNames) {
|
function setScreenPreferences(componentId, screenNames) {
|
||||||
var prefs = SettingsData.screenPreferences || {
|
var prefs = SettingsData.screenPreferences || {};
|
||||||
};
|
var newPrefs = Object.assign({}, prefs);
|
||||||
prefs[componentId] = screenNames;
|
newPrefs[componentId] = screenNames;
|
||||||
SettingsData.setScreenPreferences(prefs);
|
SettingsData.setScreenPreferences(newPrefs);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getShowOnLastDisplay(componentId) {
|
||||||
|
return SettingsData.showOnLastDisplay && SettingsData.showOnLastDisplay[componentId] || false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function setShowOnLastDisplay(componentId, enabled) {
|
||||||
|
var prefs = SettingsData.showOnLastDisplay || {};
|
||||||
|
var newPrefs = Object.assign({}, prefs);
|
||||||
|
newPrefs[componentId] = enabled;
|
||||||
|
SettingsData.setShowOnLastDisplay(newPrefs);
|
||||||
}
|
}
|
||||||
|
|
||||||
DankFlickable {
|
DankFlickable {
|
||||||
@@ -660,7 +671,6 @@ Item {
|
|||||||
|
|
||||||
Column {
|
Column {
|
||||||
property string componentId: modelData.id
|
property string componentId: modelData.id
|
||||||
property var selectedScreens: displaysTab.getScreenPreferences(componentId)
|
|
||||||
|
|
||||||
width: parent.width
|
width: parent.width
|
||||||
spacing: Theme.spacingXS
|
spacing: Theme.spacingXS
|
||||||
@@ -669,7 +679,7 @@ Item {
|
|||||||
width: parent.width
|
width: parent.width
|
||||||
text: I18n.tr("All displays")
|
text: I18n.tr("All displays")
|
||||||
description: I18n.tr("Show on all connected displays")
|
description: I18n.tr("Show on all connected displays")
|
||||||
checked: parent.selectedScreens.includes("all")
|
checked: displaysTab.getScreenPreferences(parent.componentId).includes("all")
|
||||||
onToggled: (checked) => {
|
onToggled: (checked) => {
|
||||||
if (checked)
|
if (checked)
|
||||||
displaysTab.setScreenPreferences(parent.componentId, ["all"]);
|
displaysTab.setScreenPreferences(parent.componentId, ["all"]);
|
||||||
@@ -678,18 +688,29 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DankToggle {
|
||||||
|
width: parent.width
|
||||||
|
text: I18n.tr("Show on Last Display")
|
||||||
|
description: I18n.tr("Always show when there's only one connected display")
|
||||||
|
checked: displaysTab.getShowOnLastDisplay(parent.componentId)
|
||||||
|
visible: !displaysTab.getScreenPreferences(parent.componentId).includes("all") && ["dankBar", "dock", "notifications", "osd", "toast"].includes(parent.componentId)
|
||||||
|
onToggled: (checked) => {
|
||||||
|
displaysTab.setShowOnLastDisplay(parent.componentId, checked);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: 1
|
height: 1
|
||||||
color: Theme.outline
|
color: Theme.outline
|
||||||
opacity: 0.2
|
opacity: 0.2
|
||||||
visible: !parent.selectedScreens.includes("all")
|
visible: !displaysTab.getScreenPreferences(parent.componentId).includes("all")
|
||||||
}
|
}
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
spacing: Theme.spacingXS
|
spacing: Theme.spacingXS
|
||||||
visible: !parent.selectedScreens.includes("all")
|
visible: !displaysTab.getScreenPreferences(parent.componentId).includes("all")
|
||||||
|
|
||||||
Repeater {
|
Repeater {
|
||||||
model: Quickshell.screens
|
model: Quickshell.screens
|
||||||
|
|||||||
Reference in New Issue
Block a user