mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-06-21 10:35:26 -04:00
feat(wallpaper): support configurable background color (#2671)
* feat(wallpaper): support configurable background color * chore(translations): update settings search index * revert(wallpaper): keep Pad naming instead of Center
This commit is contained in:
@@ -242,6 +242,24 @@ Singleton {
|
|||||||
property string wallpaperFillMode: "Fill"
|
property string wallpaperFillMode: "Fill"
|
||||||
property bool blurredWallpaperLayer: false
|
property bool blurredWallpaperLayer: false
|
||||||
property bool blurWallpaperOnOverview: false
|
property bool blurWallpaperOnOverview: false
|
||||||
|
property string wallpaperBackgroundColorMode: "black"
|
||||||
|
property string wallpaperBackgroundCustomColor: "#000000"
|
||||||
|
readonly property color effectiveWallpaperBackgroundColor: {
|
||||||
|
switch (wallpaperBackgroundColorMode) {
|
||||||
|
case "black":
|
||||||
|
return "#000000";
|
||||||
|
case "white":
|
||||||
|
return "#ffffff";
|
||||||
|
case "primary":
|
||||||
|
return Theme.primary;
|
||||||
|
case "surface":
|
||||||
|
return Theme.surfaceContainer;
|
||||||
|
case "custom":
|
||||||
|
return wallpaperBackgroundCustomColor;
|
||||||
|
default:
|
||||||
|
return "#000000";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
property bool frameEnabled: false
|
property bool frameEnabled: false
|
||||||
onFrameEnabledChanged: saveSettings()
|
onFrameEnabledChanged: saveSettings()
|
||||||
|
|||||||
@@ -74,6 +74,8 @@ var SPEC = {
|
|||||||
wallpaperFillMode: { def: "Fill" },
|
wallpaperFillMode: { def: "Fill" },
|
||||||
blurredWallpaperLayer: { def: false },
|
blurredWallpaperLayer: { def: false },
|
||||||
blurWallpaperOnOverview: { def: false },
|
blurWallpaperOnOverview: { def: false },
|
||||||
|
wallpaperBackgroundColorMode: { def: "black" },
|
||||||
|
wallpaperBackgroundCustomColor: { def: "#000000" },
|
||||||
|
|
||||||
showLauncherButton: { def: true },
|
showLauncherButton: { def: true },
|
||||||
showWorkspaceSwitcher: { def: true },
|
showWorkspaceSwitcher: { def: true },
|
||||||
|
|||||||
@@ -43,6 +43,11 @@ Variants {
|
|||||||
id: root
|
id: root
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
anchors.fill: parent
|
||||||
|
color: SettingsData.effectiveWallpaperBackgroundColor
|
||||||
|
}
|
||||||
|
|
||||||
function encodeFileUrl(path) {
|
function encodeFileUrl(path) {
|
||||||
if (!path)
|
if (!path)
|
||||||
return "";
|
return "";
|
||||||
@@ -137,6 +142,12 @@ Variants {
|
|||||||
function onWallpaperFillModeChanged() {
|
function onWallpaperFillModeChanged() {
|
||||||
root.invalidate();
|
root.invalidate();
|
||||||
}
|
}
|
||||||
|
function onWallpaperBackgroundColorModeChanged() {
|
||||||
|
root.invalidate();
|
||||||
|
}
|
||||||
|
function onWallpaperBackgroundCustomColorChanged() {
|
||||||
|
root.invalidate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
|
|||||||
@@ -79,6 +79,24 @@ Singleton {
|
|||||||
property var screenPreferences: ({})
|
property var screenPreferences: ({})
|
||||||
property int animationSpeed: 2
|
property int animationSpeed: 2
|
||||||
property string wallpaperFillMode: "Fill"
|
property string wallpaperFillMode: "Fill"
|
||||||
|
property string wallpaperBackgroundColorMode: "black"
|
||||||
|
property string wallpaperBackgroundCustomColor: "#000000"
|
||||||
|
readonly property color effectiveWallpaperBackgroundColor: {
|
||||||
|
switch (wallpaperBackgroundColorMode) {
|
||||||
|
case "black":
|
||||||
|
return "#000000";
|
||||||
|
case "white":
|
||||||
|
return "#ffffff";
|
||||||
|
case "primary":
|
||||||
|
return (typeof Theme !== "undefined") ? Theme.primary : "#000000";
|
||||||
|
case "surface":
|
||||||
|
return (typeof Theme !== "undefined") ? Theme.surfaceContainer : "#000000";
|
||||||
|
case "custom":
|
||||||
|
return wallpaperBackgroundCustomColor;
|
||||||
|
default:
|
||||||
|
return "#000000";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function parseSettings(content) {
|
function parseSettings(content) {
|
||||||
try {
|
try {
|
||||||
@@ -147,6 +165,8 @@ Singleton {
|
|||||||
screenPreferences = settings.screenPreferences !== undefined ? settings.screenPreferences : ({});
|
screenPreferences = settings.screenPreferences !== undefined ? settings.screenPreferences : ({});
|
||||||
animationSpeed = settings.animationSpeed !== undefined ? settings.animationSpeed : 2;
|
animationSpeed = settings.animationSpeed !== undefined ? settings.animationSpeed : 2;
|
||||||
wallpaperFillMode = settings.wallpaperFillMode !== undefined ? settings.wallpaperFillMode : "Fill";
|
wallpaperFillMode = settings.wallpaperFillMode !== undefined ? settings.wallpaperFillMode : "Fill";
|
||||||
|
wallpaperBackgroundColorMode = settings.wallpaperBackgroundColorMode !== undefined ? settings.wallpaperBackgroundColorMode : "black";
|
||||||
|
wallpaperBackgroundCustomColor = settings.wallpaperBackgroundCustomColor !== undefined ? settings.wallpaperBackgroundCustomColor : "#000000";
|
||||||
|
|
||||||
if (typeof Theme !== "undefined") {
|
if (typeof Theme !== "undefined") {
|
||||||
if (currentThemeName === "custom" && customThemeFile) {
|
if (currentThemeName === "custom" && customThemeFile) {
|
||||||
|
|||||||
@@ -794,6 +794,11 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
anchors.fill: parent
|
||||||
|
color: GreetdSettings.effectiveWallpaperBackgroundColor
|
||||||
|
}
|
||||||
|
|
||||||
DankBackdrop {
|
DankBackdrop {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
screenName: root.screenName
|
screenName: root.screenName
|
||||||
|
|||||||
@@ -182,6 +182,11 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
anchors.fill: parent
|
||||||
|
color: SettingsData.effectiveWallpaperBackgroundColor
|
||||||
|
}
|
||||||
|
|
||||||
Loader {
|
Loader {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
active: {
|
active: {
|
||||||
|
|||||||
@@ -354,6 +354,28 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ColorDropdownRow {
|
||||||
|
tab: "wallpaper"
|
||||||
|
tags: ["background", "color", "fill", "fit", "custom"]
|
||||||
|
settingKey: "wallpaperBackgroundColorMode"
|
||||||
|
text: I18n.tr("Background Color")
|
||||||
|
description: I18n.tr("Color shown for areas not covered by wallpaper (e.g. Fit or Pad modes)")
|
||||||
|
visible: root.currentWallpaper !== "" && !root.currentWallpaper.startsWith("#")
|
||||||
|
dropdownWidth: 220
|
||||||
|
options: [
|
||||||
|
{ "value": "black", "label": I18n.tr("Black") },
|
||||||
|
{ "value": "white", "label": I18n.tr("White") },
|
||||||
|
{ "value": "primary", "label": I18n.tr("Primary Theme Color") },
|
||||||
|
{ "value": "surface", "label": I18n.tr("Surface Container") },
|
||||||
|
{ "value": "custom", "label": I18n.tr("Custom") }
|
||||||
|
]
|
||||||
|
currentMode: SettingsData.wallpaperBackgroundColorMode
|
||||||
|
customColor: SettingsData.wallpaperBackgroundCustomColor || "#000000"
|
||||||
|
pickerTitle: I18n.tr("Wallpaper Background Color")
|
||||||
|
onModeSelected: mode => SettingsData.set("wallpaperBackgroundColorMode", mode)
|
||||||
|
onCustomColorSelected: selectedColor => SettingsData.set("wallpaperBackgroundCustomColor", selectedColor.toString())
|
||||||
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: 1
|
height: 1
|
||||||
|
|||||||
@@ -42,6 +42,11 @@ Variants {
|
|||||||
id: root
|
id: root
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
anchors.fill: parent
|
||||||
|
color: SettingsData.effectiveWallpaperBackgroundColor
|
||||||
|
}
|
||||||
|
|
||||||
function encodeFileUrl(path) {
|
function encodeFileUrl(path) {
|
||||||
if (!path)
|
if (!path)
|
||||||
return "";
|
return "";
|
||||||
@@ -131,6 +136,12 @@ Variants {
|
|||||||
function onWallpaperFillModeChanged() {
|
function onWallpaperFillModeChanged() {
|
||||||
root.invalidate();
|
root.invalidate();
|
||||||
}
|
}
|
||||||
|
function onWallpaperBackgroundColorModeChanged() {
|
||||||
|
root.invalidate();
|
||||||
|
}
|
||||||
|
function onWallpaperBackgroundCustomColorChanged() {
|
||||||
|
root.invalidate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
|
|||||||
@@ -343,28 +343,26 @@
|
|||||||
"category": "Personalization",
|
"category": "Personalization",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"appearance",
|
"appearance",
|
||||||
|
"areas",
|
||||||
"background",
|
"background",
|
||||||
"bg",
|
"bg",
|
||||||
|
"color",
|
||||||
|
"colour",
|
||||||
|
"covered",
|
||||||
"custom",
|
"custom",
|
||||||
"customize",
|
"customize",
|
||||||
"dark",
|
|
||||||
"dark mode",
|
|
||||||
"day",
|
|
||||||
"desktop",
|
"desktop",
|
||||||
"different",
|
"hue",
|
||||||
"image",
|
"image",
|
||||||
"light",
|
|
||||||
"light mode",
|
|
||||||
"mode",
|
|
||||||
"night",
|
|
||||||
"personal",
|
"personal",
|
||||||
"personalization",
|
"personalization",
|
||||||
"picture",
|
"picture",
|
||||||
"wallpaper",
|
"shown",
|
||||||
"wallpapers"
|
"tint",
|
||||||
|
"wallpaper"
|
||||||
],
|
],
|
||||||
"icon": "wallpaper",
|
"icon": "wallpaper",
|
||||||
"description": "Set different wallpapers for light and dark mode"
|
"description": "Color shown for areas not covered by wallpaper (e.g. Fit or Pad modes)"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"section": "selectedMonitor",
|
"section": "selectedMonitor",
|
||||||
|
|||||||
Reference in New Issue
Block a user