1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2025-12-06 05:25:41 -05:00

Popup transparency option

This commit is contained in:
bbedward
2025-07-14 15:00:58 -04:00
parent 0a4453ab3b
commit 3b16ae73c7
13 changed files with 132 additions and 38 deletions

View File

@@ -11,6 +11,7 @@ Singleton {
property bool themeIsDynamic: false
property bool isLightMode: false
property real topBarTransparency: 0.75
property real popupTransparency: 0.92
property var recentlyUsedApps: []
// New global preferences
@@ -75,6 +76,8 @@ Singleton {
isLightMode = settings.isLightMode !== undefined ? settings.isLightMode : false
topBarTransparency = settings.topBarTransparency !== undefined ?
(settings.topBarTransparency > 1 ? settings.topBarTransparency / 100.0 : settings.topBarTransparency) : 0.75
popupTransparency = settings.popupTransparency !== undefined ?
(settings.popupTransparency > 1 ? settings.popupTransparency / 100.0 : settings.popupTransparency) : 0.92
recentlyUsedApps = settings.recentlyUsedApps || []
use24HourClock = settings.use24HourClock !== undefined ? settings.use24HourClock : true
useFahrenheit = settings.useFahrenheit !== undefined ? settings.useFahrenheit : false
@@ -107,6 +110,7 @@ Singleton {
themeIsDynamic,
isLightMode,
topBarTransparency,
popupTransparency,
recentlyUsedApps,
use24HourClock,
useFahrenheit,
@@ -159,6 +163,12 @@ Singleton {
saveSettings()
}
function setPopupTransparency(transparency) {
console.log("Prefs setPopupTransparency called - popupTransparency:", transparency)
popupTransparency = transparency
saveSettings()
}
function addRecentApp(app) {
if (!app) return

View File

@@ -19,9 +19,25 @@ QtObject {
Colors.colorsUpdated.connect(root.onColorsUpdated)
}
// Initialize transparency values from Prefs
if (typeof Prefs !== "undefined") {
if (Prefs.popupTransparency !== undefined) {
root.popupTransparency = Prefs.popupTransparency
}
// Connect to transparency changes
if (Prefs.popupTransparencyChanged) {
Prefs.popupTransparencyChanged.connect(function() {
if (typeof Prefs !== "undefined" && Prefs.popupTransparency !== undefined) {
root.popupTransparency = Prefs.popupTransparency
}
})
}
}
console.log("Theme initialized, waiting for Prefs to load settings and apply theme")
}
// Handle successful color extraction
function onColorsUpdated() {
console.log("Colors updated successfully - switching to dynamic theme")
@@ -502,6 +518,37 @@ QtObject {
property real opacityHigh: 0.87
property real opacityFull: 1.0
// Transparency system - can be overridden by Prefs
property real panelTransparency: 0.85
property real popupTransparency: 0.92
// Smart transparency functions for content-aware backgrounds
function getPopupBackgroundAlpha() {
return popupTransparency
}
function getContentBackgroundAlpha() {
return popupTransparency
}
function getPopupBorderAlpha() {
// Borders can be more transparent than the main content
return popupTransparency * 0.6
}
// Convenience functions for themed backgrounds with transparency
function popupBackground() {
return Qt.rgba(surfaceContainer.r, surfaceContainer.g, surfaceContainer.b, popupTransparency)
}
function contentBackground() {
return Qt.rgba(surfaceContainer.r, surfaceContainer.g, surfaceContainer.b, popupTransparency)
}
function panelBackground() {
return Qt.rgba(surfaceContainer.r, surfaceContainer.g, surfaceContainer.b, panelTransparency)
}
property string iconFont: "Material Symbols Rounded"
property string iconFontFilled: "Material Symbols Rounded"
property int iconFontWeight: Font.Normal