mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2025-12-07 22:15:38 -05:00
@@ -15,6 +15,7 @@ Singleton {
|
|||||||
// Theme settings
|
// Theme settings
|
||||||
property string currentThemeName: "blue"
|
property string currentThemeName: "blue"
|
||||||
property string customThemeFile: ""
|
property string customThemeFile: ""
|
||||||
|
property string matugenScheme: "scheme-tonal-spot"
|
||||||
property real topBarTransparency: 0.75
|
property real topBarTransparency: 0.75
|
||||||
property real topBarWidgetTransparency: 0.85
|
property real topBarWidgetTransparency: 0.85
|
||||||
property real popupTransparency: 0.92
|
property real popupTransparency: 0.92
|
||||||
@@ -206,6 +207,7 @@ Singleton {
|
|||||||
currentThemeName = settings.currentThemeName !== undefined ? settings.currentThemeName : "blue"
|
currentThemeName = settings.currentThemeName !== undefined ? settings.currentThemeName : "blue"
|
||||||
}
|
}
|
||||||
customThemeFile = settings.customThemeFile !== undefined ? settings.customThemeFile : ""
|
customThemeFile = settings.customThemeFile !== undefined ? settings.customThemeFile : ""
|
||||||
|
matugenScheme = settings.matugenScheme !== undefined ? settings.matugenScheme : "scheme-tonal-spot"
|
||||||
topBarTransparency = settings.topBarTransparency !== undefined ? (settings.topBarTransparency > 1 ? settings.topBarTransparency / 100 : settings.topBarTransparency) : 0.75
|
topBarTransparency = settings.topBarTransparency !== undefined ? (settings.topBarTransparency > 1 ? settings.topBarTransparency / 100 : settings.topBarTransparency) : 0.75
|
||||||
topBarWidgetTransparency = settings.topBarWidgetTransparency !== undefined ? (settings.topBarWidgetTransparency > 1 ? settings.topBarWidgetTransparency / 100 : settings.topBarWidgetTransparency) : 0.85
|
topBarWidgetTransparency = settings.topBarWidgetTransparency !== undefined ? (settings.topBarWidgetTransparency > 1 ? settings.topBarWidgetTransparency / 100 : settings.topBarWidgetTransparency) : 0.85
|
||||||
popupTransparency = settings.popupTransparency !== undefined ? (settings.popupTransparency > 1 ? settings.popupTransparency / 100 : settings.popupTransparency) : 0.92
|
popupTransparency = settings.popupTransparency !== undefined ? (settings.popupTransparency > 1 ? settings.popupTransparency / 100 : settings.popupTransparency) : 0.92
|
||||||
@@ -344,6 +346,7 @@ Singleton {
|
|||||||
settingsFile.setText(JSON.stringify({
|
settingsFile.setText(JSON.stringify({
|
||||||
"currentThemeName": currentThemeName,
|
"currentThemeName": currentThemeName,
|
||||||
"customThemeFile": customThemeFile,
|
"customThemeFile": customThemeFile,
|
||||||
|
"matugenScheme": matugenScheme,
|
||||||
"topBarTransparency": topBarTransparency,
|
"topBarTransparency": topBarTransparency,
|
||||||
"topBarWidgetTransparency": topBarWidgetTransparency,
|
"topBarWidgetTransparency": topBarWidgetTransparency,
|
||||||
"popupTransparency": popupTransparency,
|
"popupTransparency": popupTransparency,
|
||||||
@@ -567,6 +570,22 @@ Singleton {
|
|||||||
saveSettings()
|
saveSettings()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setMatugenScheme(scheme) {
|
||||||
|
var normalized = scheme || "scheme-tonal-spot"
|
||||||
|
if (matugenScheme === normalized)
|
||||||
|
return
|
||||||
|
|
||||||
|
matugenScheme = normalized
|
||||||
|
saveSettings()
|
||||||
|
|
||||||
|
if (typeof Theme !== "undefined") {
|
||||||
|
if (Theme.currentTheme === Theme.dynamic) {
|
||||||
|
Theme.extractColors()
|
||||||
|
}
|
||||||
|
Theme.generateSystemThemesFromCurrentTheme()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function setTopBarTransparency(transparency) {
|
function setTopBarTransparency(transparency) {
|
||||||
topBarTransparency = transparency
|
topBarTransparency = transparency
|
||||||
saveSettings()
|
saveSettings()
|
||||||
|
|||||||
@@ -130,6 +130,26 @@ Singleton {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
readonly property var availableMatugenSchemes: [
|
||||||
|
({ "value": "scheme-tonal-spot", "label": "Tonal Spot", "description": "Balanced palette with focused accents (default)." }),
|
||||||
|
({ "value": "scheme-content", "label": "Content", "description": "Derives colors that closely match the underlying image." }),
|
||||||
|
({ "value": "scheme-expressive", "label": "Expressive", "description": "Vibrant palette with playful saturation." }),
|
||||||
|
({ "value": "scheme-fidelity", "label": "Fidelity", "description": "High-fidelity palette that preserves source hues." }),
|
||||||
|
({ "value": "scheme-fruit-salad", "label": "Fruit Salad", "description": "Colorful mix of bright contrasting accents." }),
|
||||||
|
({ "value": "scheme-monochrome", "label": "Monochrome", "description": "Minimal palette built around a single hue." }),
|
||||||
|
({ "value": "scheme-neutral", "label": "Neutral", "description": "Muted palette with subdued, calming tones." }),
|
||||||
|
({ "value": "scheme-rainbow", "label": "Rainbow", "description": "Diverse palette spanning the full spectrum." })
|
||||||
|
]
|
||||||
|
|
||||||
|
function getMatugenScheme(value) {
|
||||||
|
const schemes = availableMatugenSchemes
|
||||||
|
for (let i = 0; i < schemes.length; i++) {
|
||||||
|
if (schemes[i].value === value)
|
||||||
|
return schemes[i]
|
||||||
|
}
|
||||||
|
return schemes[0]
|
||||||
|
}
|
||||||
|
|
||||||
property color primary: currentThemeData.primary
|
property color primary: currentThemeData.primary
|
||||||
property color primaryText: currentThemeData.primaryText
|
property color primaryText: currentThemeData.primaryText
|
||||||
property color primaryContainer: currentThemeData.primaryContainer
|
property color primaryContainer: currentThemeData.primaryContainer
|
||||||
@@ -552,10 +572,11 @@ Singleton {
|
|||||||
if (!wallpaperPath) {
|
if (!wallpaperPath) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
const selectedMatugenType = (typeof SettingsData !== "undefined" && SettingsData.matugenScheme) ? SettingsData.matugenScheme : "scheme-tonal-spot"
|
||||||
if (wallpaperPath.startsWith("#")) {
|
if (wallpaperPath.startsWith("#")) {
|
||||||
setDesiredTheme("hex", wallpaperPath, isLight, iconTheme)
|
setDesiredTheme("hex", wallpaperPath, isLight, iconTheme, selectedMatugenType)
|
||||||
} else {
|
} else {
|
||||||
setDesiredTheme("image", wallpaperPath, isLight, iconTheme)
|
setDesiredTheme("image", wallpaperPath, isLight, iconTheme, selectedMatugenType)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let primaryColor
|
let primaryColor
|
||||||
@@ -684,10 +705,11 @@ Singleton {
|
|||||||
if (currentTheme === dynamic) {
|
if (currentTheme === dynamic) {
|
||||||
if (wallpaperPath) {
|
if (wallpaperPath) {
|
||||||
Quickshell.execDetached(["rm", "-f", stateDir + "/matugen.key"])
|
Quickshell.execDetached(["rm", "-f", stateDir + "/matugen.key"])
|
||||||
|
const selectedMatugenType = (typeof SettingsData !== "undefined" && SettingsData.matugenScheme) ? SettingsData.matugenScheme : "scheme-tonal-spot"
|
||||||
if (wallpaperPath.startsWith("#")) {
|
if (wallpaperPath.startsWith("#")) {
|
||||||
setDesiredTheme("hex", wallpaperPath, isLight, iconTheme)
|
setDesiredTheme("hex", wallpaperPath, isLight, iconTheme, selectedMatugenType)
|
||||||
} else {
|
} else {
|
||||||
setDesiredTheme("image", wallpaperPath, isLight, iconTheme)
|
setDesiredTheme("image", wallpaperPath, isLight, iconTheme, selectedMatugenType)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -734,7 +756,10 @@ Singleton {
|
|||||||
|
|
||||||
Process {
|
Process {
|
||||||
id: matugenProcess
|
id: matugenProcess
|
||||||
command: ["matugen", "image", wallpaperPath, "--json", "hex"]
|
command: {
|
||||||
|
const scheme = (typeof SettingsData !== "undefined" && SettingsData.matugenScheme) ? SettingsData.matugenScheme : "scheme-tonal-spot"
|
||||||
|
return ["matugen", "image", wallpaperPath, "--json", "hex", "-t", scheme]
|
||||||
|
}
|
||||||
|
|
||||||
stdout: StdioCollector {
|
stdout: StdioCollector {
|
||||||
id: matugenCollector
|
id: matugenCollector
|
||||||
@@ -782,7 +807,10 @@ Singleton {
|
|||||||
|
|
||||||
Process {
|
Process {
|
||||||
id: colorMatugenProcess
|
id: colorMatugenProcess
|
||||||
command: ["matugen", "color", "hex", wallpaperPath, "--json", "hex"]
|
command: {
|
||||||
|
const scheme = (typeof SettingsData !== "undefined" && SettingsData.matugenScheme) ? SettingsData.matugenScheme : "scheme-tonal-spot"
|
||||||
|
return ["matugen", "color", "hex", wallpaperPath, "--json", "hex", "-t", scheme]
|
||||||
|
}
|
||||||
|
|
||||||
stdout: StdioCollector {
|
stdout: StdioCollector {
|
||||||
id: colorMatugenCollector
|
id: colorMatugenCollector
|
||||||
|
|||||||
@@ -889,6 +889,37 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DankDropdown {
|
||||||
|
id: personalizationMatugenPaletteDropdown
|
||||||
|
width: parent.width
|
||||||
|
text: "Matugen Palette"
|
||||||
|
description: "Select the palette algorithm used for wallpaper-based colors"
|
||||||
|
options: Theme.availableMatugenSchemes.map(function (option) { return option.label })
|
||||||
|
currentValue: Theme.getMatugenScheme(SettingsData.matugenScheme).label
|
||||||
|
enabled: Theme.matugenAvailable
|
||||||
|
opacity: enabled ? 1 : 0.4
|
||||||
|
onValueChanged: value => {
|
||||||
|
for (var i = 0; i < Theme.availableMatugenSchemes.length; i++) {
|
||||||
|
var option = Theme.availableMatugenSchemes[i]
|
||||||
|
if (option.label === value) {
|
||||||
|
SettingsData.setMatugenScheme(option.value)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: {
|
||||||
|
var scheme = Theme.getMatugenScheme(SettingsData.matugenScheme)
|
||||||
|
return scheme.description + " (" + scheme.value + ")"
|
||||||
|
}
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceVariantText
|
||||||
|
wrapMode: Text.WordWrap
|
||||||
|
width: parent.width
|
||||||
|
}
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: "matugen not detected - dynamic theming unavailable"
|
text: "matugen not detected - dynamic theming unavailable"
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
|||||||
@@ -608,6 +608,37 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DankDropdown {
|
||||||
|
id: matugenPaletteDropdown
|
||||||
|
width: parent.width
|
||||||
|
text: "Matugen Palette"
|
||||||
|
description: "Select the palette algorithm used for wallpaper-based colors"
|
||||||
|
options: Theme.availableMatugenSchemes.map(function (option) { return option.label })
|
||||||
|
currentValue: Theme.getMatugenScheme(SettingsData.matugenScheme).label
|
||||||
|
enabled: Theme.matugenAvailable
|
||||||
|
opacity: enabled ? 1 : 0.4
|
||||||
|
onValueChanged: value => {
|
||||||
|
for (var i = 0; i < Theme.availableMatugenSchemes.length; i++) {
|
||||||
|
var option = Theme.availableMatugenSchemes[i]
|
||||||
|
if (option.label === value) {
|
||||||
|
SettingsData.setMatugenScheme(option.value)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: {
|
||||||
|
var scheme = Theme.getMatugenScheme(SettingsData.matugenScheme)
|
||||||
|
return scheme.description + " (" + scheme.value + ")"
|
||||||
|
}
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceVariantText
|
||||||
|
wrapMode: Text.WordWrap
|
||||||
|
width: parent.width
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
|
|||||||
Reference in New Issue
Block a user