simplify colorize properties & active new options

pull/4/head
Michail Vourlakos 6 years ago
parent 730030c5fb
commit fd300ec9cf

@ -522,7 +522,7 @@ Item{
return plasmoid.configuration.panelTransparency / 100; return plasmoid.configuration.panelTransparency / 100;
} }
if (root.forceColorizeFromActiveWindowScheme) { if (colorizerManager.mustBeShown && colorizerManager.applyTheme !== theme) {
return solidBackground.opacity; return solidBackground.opacity;
} }
@ -530,14 +530,10 @@ Item{
} }
backgroundColor: { backgroundColor: {
if (root.forcePanelForBusyBackground) { if (colorizerManager.mustBeShown && colorizerManager.applyTheme !== theme) {
return colorizerManager.backgroundColor; return colorizerManager.backgroundColor;
} }
if (root.forceColorizeFromActiveWindowScheme) {
return latteView.windowsTracker.touchingWindowScheme.backgroundColor
}
return "transparent"; return "transparent";
} }

@ -516,6 +516,7 @@ Item {
readonly property bool mustBeShown: colorizerManager.mustBeShown readonly property bool mustBeShown: colorizerManager.mustBeShown
&& !appletItem.userBlocksColorizing && !appletItem.userBlocksColorizing
&& !appletItem.appletBlocksColorizing && !appletItem.appletBlocksColorizing
&& !appletItem.isInternalViewSplitter
Behavior on opacity { Behavior on opacity {
NumberAnimation { NumberAnimation {

@ -29,42 +29,45 @@ import "../../code/ColorizerTools.js" as ColorizerTools
Loader{ Loader{
id: manager id: manager
active: root.colorizerEnabled || forceSolidnessAndColorize //! the loader loads the backgroundTracker component
active: root.themeColors === Latte.Types.SmartThemeColors
readonly property bool forceSolidness: (root.solidStylePanel && !plasmoid.configuration.solidBackgroundForMaximized)
|| root.forceSolidPanel
|| !Latte.WindowSystem.compositingActive
readonly property bool forceSolidnessAndColorize: forceSolidness && forceColorizeFromActiveWindowScheme
readonly property bool backgroundIsBusy: item ? item.isBusy : false readonly property bool backgroundIsBusy: item ? item.isBusy : false
readonly property real themeBackgroundColorBrightness: ColorizerTools.colorBrightness(theme.backgroundColor)
readonly property real themeTextColorBrightness: ColorizerTools.colorBrightness(theme.textColor) readonly property real themeTextColorBrightness: ColorizerTools.colorBrightness(theme.textColor)
readonly property color minimizedDotColor: themeTextColorBrightness > 127.5 ? Qt.darker(theme.textColor, 1.7) : Qt.lighter(theme.textColor, 7) readonly property color minimizedDotColor: themeTextColorBrightness > 127.5 ? Qt.darker(theme.textColor, 1.7) : Qt.lighter(theme.textColor, 7)
property bool mustBeShown: active && (!root.forceSolidPanel || forceSolidnessAndColorize) readonly property bool mustBeShown: (applyTheme && applyTheme !== theme)
//! when forceSemiTransparentPanel is enabled because of touching or maximized etc. windows
//! then the colorizer could be enabled for low panel transparency levels (<40%) onMustBeShownChanged: console.log(mustBeShown);
&& (!userShowPanelBackground || !forceSemiTransparentPanel || (forceSemiTransparentPanel && root.panelTransparency<40))
&& !maximizedWindowTitleBarBehavesAsPanelBackground
&& (plasmoid.configuration.solidBackgroundForMaximized || plasmoid.configuration.backgroundOnlyOnMaximized)
&& !root.editMode && Latte.WindowSystem.compositingActive
readonly property real currentBackgroundBrightness: item ? item.currentBrightness : -1000 readonly property real currentBackgroundBrightness: item ? item.currentBrightness : -1000
readonly property bool applyingWindowColors: (root.windowColors === Latte.Types.ActiveWindowColors && latteView.windowsTracker.activeWindowScheme)
|| (root.windowColors === Latte.Types.TouchingWindowColors && latteView.windowsTracker.touchingWindowScheme)
property QtObject applyTheme: { property QtObject applyTheme: {
if (forceSolidnessAndColorize && latteView.windowsTracker.touchingWindowScheme) { if (root.windowColors === Latte.Types.ActiveWindowColors && latteView.windowsTracker.activeWindowScheme) {
return latteView.windowsTracker.activeWindowScheme;
}
if (root.windowColors === Latte.Types.TouchingWindowColors && latteView.windowsTracker.touchingWindowScheme) {
return latteView.windowsTracker.touchingWindowScheme; return latteView.windowsTracker.touchingWindowScheme;
} }
if (themeExtended) { if (themeExtended) {
if (root.themeColors === Latte.Types.ReverseThemeColors) {
return themeExtended.isLightTheme ? themeExtended.darkTheme : themeExtended.lightTheme;
}
if (root.themeColors === Latte.Types.SmartThemeColors && !root.editMode) {
if (currentBackgroundBrightness > 127.5) { if (currentBackgroundBrightness > 127.5) {
return themeExtended.lightTheme; return themeExtended.lightTheme;
} else { } else {
return themeExtended.darkTheme; return themeExtended.darkTheme;
} }
} }
}
return theme; return theme;
} }

@ -90,10 +90,6 @@ DragDrop.DropArea {
property bool windowIsTouching: latteView && latteView.windowsTracker property bool windowIsTouching: latteView && latteView.windowsTracker
&& (latteView.windowsTracker.existsWindowMaximized|| latteView.windowsTracker.activeWindowTouching || hasExpandedApplet) && (latteView.windowsTracker.existsWindowMaximized|| latteView.windowsTracker.activeWindowTouching || hasExpandedApplet)
property bool forceSemiTransparentPanel: Latte.WindowSystem.compositingActive && !root.editMode
&& ((!plasmoid.configuration.solidBackgroundForMaximized && plasmoid.configuration.backgroundOnlyOnMaximized && windowIsTouching)
|| (plasmoid.configuration.solidBackgroundForMaximized && !plasmoid.configuration.backgroundOnlyOnMaximized && !windowIsTouching))
property bool forceSolidPanel: (latteView && latteView.visibility property bool forceSolidPanel: (latteView && latteView.visibility
&& Latte.WindowSystem.compositingActive && Latte.WindowSystem.compositingActive
&& !root.editMode && !root.editMode
@ -111,21 +107,13 @@ DragDrop.DropArea {
property bool forcePanelForBusyBackground: root.forceTransparentPanel && colorizerManager.mustBeShown && colorizerManager.backgroundIsBusy property bool forcePanelForBusyBackground: root.forceTransparentPanel && colorizerManager.mustBeShown && colorizerManager.backgroundIsBusy
property int themeColors: plasmoid.configuration.themeColors
property bool themeColors: plasmoid.configuration.themeColors property int windowColors: plasmoid.configuration.windowColors
property bool windowColors: plasmoid.configuration.windowColors
property bool colorizerEnabled: themeColors !== Latte.Types.PlasmaThemeColors || windowColors !== Latte.Types.NoneWindowColors property bool colorizerEnabled: themeColors !== Latte.Types.PlasmaThemeColors || windowColors !== Latte.Types.NoneWindowColors
property bool plasmaBackgroundForPopups: plasmoid.configuration.plasmaBackgroundForPopups property bool plasmaBackgroundForPopups: plasmoid.configuration.plasmaBackgroundForPopups
property bool maximizedWindowTitleBarBehavesAsPanelBackground: latteView && latteView.visibility
&& (!plasmoid.configuration.solidBackgroundForMaximized && plasmoid.configuration.backgroundOnlyOnMaximized)
&& (latteView.visibility.mode === Latte.Types.WindowsGoBelow)
&& (plasmoid.location === PlasmaCore.Types.TopEdge)
&& (!useThemePanel || panelTransparency<40)
&& latteView.windowsTracker.existsWindowMaximized
readonly property bool hasExpandedApplet: plasmoid.applets.some(function (item) { readonly property bool hasExpandedApplet: plasmoid.applets.some(function (item) {
return (item.status >= PlasmaCore.Types.NeedsAttentionStatus && item.status !== PlasmaCore.Types.HiddenStatus return (item.status >= PlasmaCore.Types.NeedsAttentionStatus && item.status !== PlasmaCore.Types.HiddenStatus
&& item.pluginName !== root.plasmoidName && item.pluginName !== root.plasmoidName

Loading…
Cancel
Save