mirror of
https://github.com/KDE/latte-dock.git
synced 2025-03-21 10:50:30 +03:00
fix #469,support show background on maximized only
-- the user can choose this behavior from the Tweaks page, the panel background in shown only when there is maximized window and it is fully transparent otherwise
This commit is contained in:
parent
ede4eb6496
commit
9d55a65bf5
@ -66,6 +66,9 @@
|
||||
<entry name="addLaunchersInTaskManager" type="Bool">
|
||||
<default>true</default>
|
||||
</entry>
|
||||
<entry name="backgroundOnlyOnMaximized" type="Bool">
|
||||
<default>false</default>
|
||||
</entry>
|
||||
<entry name="splitterPosition" type="Int">
|
||||
<default>-1</default>
|
||||
</entry>
|
||||
|
@ -827,20 +827,23 @@ Item {
|
||||
anchors.fill: container.appletWrapper
|
||||
|
||||
active: container.applet
|
||||
&&((plasmoid.configuration.shadows === 1 /*Locked Applets*/
|
||||
&& (!container.canBeHovered || (container.lockZoom && (applet.pluginName !== root.plasmoidName))) )
|
||||
|| (plasmoid.configuration.shadows === 2 /*All Applets*/
|
||||
&& (applet.pluginName !== root.plasmoidName)))
|
||||
&& (((plasmoid.configuration.shadows === 1 /*Locked Applets*/
|
||||
&& (!container.canBeHovered || (container.lockZoom && (applet.pluginName !== root.plasmoidName))) )
|
||||
|| (plasmoid.configuration.shadows === 2 /*All Applets*/
|
||||
&& (applet.pluginName !== root.plasmoidName)))
|
||||
|| (root.forceTransparentPanel && applet.pluginName !== root.plasmoidName)) /*on forced transparent state*/
|
||||
|
||||
sourceComponent: DropShadow{
|
||||
anchors.fill: parent
|
||||
color: "#ff080808"
|
||||
color: forcedShadow ? "#ff040404" : "#ff080808"
|
||||
samples: 2 * radius
|
||||
source: container.fakeIconItem ? wrapperContainer : container.applet
|
||||
radius: shadowSize
|
||||
verticalOffset: 2
|
||||
verticalOffset: forcedShadow ? 1 : 2
|
||||
|
||||
property int shadowSize : Math.ceil(root.iconSize / 12)
|
||||
property int shadowSize : forcedShadow? 7 : Math.ceil(root.iconSize / 12)
|
||||
|
||||
property bool forcedShadow: root.forceTransparentPanel && applet.pluginName !== root.plasmoidName ? true : false
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -224,7 +224,14 @@ Item{
|
||||
anchors.bottomMargin: Latte.WindowSystem.compositingActive ? shadowsSvgItem.margins.bottom - bottomIncreaser : 0
|
||||
anchors.fill:parent
|
||||
|
||||
opacity: root.solidPanel ? 1 : plasmoid.configuration.panelTransparency / 100
|
||||
opacity: {
|
||||
if (root.backgroundOnlyOnMaximized && !windowsModel.hasMaximizedWindow)
|
||||
return 0;
|
||||
else if (root.solidPanel)
|
||||
return 1;
|
||||
else
|
||||
return plasmoid.configuration.panelTransparency / 100;
|
||||
}
|
||||
|
||||
property rect efGeometry: Qt.rect(-1,-1,0,0)
|
||||
|
||||
@ -235,6 +242,11 @@ Item{
|
||||
|
||||
Component.onCompleted: root.updateEffectsArea.connect(updateEffectsArea);
|
||||
|
||||
Behavior on opacity {
|
||||
enabled: root.backgroundOnlyOnMaximized
|
||||
NumberAnimation { duration: 8*root.durationTime*units.shortDuration }
|
||||
}
|
||||
|
||||
Connections{
|
||||
target: root
|
||||
|
||||
|
82
containment/package/contents/ui/WindowsModel.qml
Normal file
82
containment/package/contents/ui/WindowsModel.qml
Normal file
@ -0,0 +1,82 @@
|
||||
/*
|
||||
* Copyright 2016 Smith AR <audoban@openmailbox.org>
|
||||
* Michail Vourlakos <mvourlakos@gmail.com>
|
||||
*
|
||||
* This file is part of Latte-Dock
|
||||
*
|
||||
* Latte-Dock is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* Latte-Dock is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import QtQuick 2.1
|
||||
|
||||
import org.kde.plasma.plasmoid 2.0
|
||||
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.taskmanager 0.1 as TaskManager
|
||||
|
||||
|
||||
Item{
|
||||
id: winModel
|
||||
|
||||
property bool maximizedWindowOnScreen: maximizedWindowModel.count > 0
|
||||
|
||||
//--- active-window-control start
|
||||
Component.onCompleted: maximizedWindowModel.doCheck()
|
||||
TaskManager.VirtualDesktopInfo { id: virtualDesktopInfo }
|
||||
TaskManager.ActivityInfo { id: activityInfo }
|
||||
TaskManager.TasksModel {
|
||||
id: tasksModel
|
||||
sortMode: TaskManager.TasksModel.SortVirtualDesktop
|
||||
groupMode: TaskManager.TasksModel.GroupDisabled
|
||||
|
||||
virtualDesktop: virtualDesktopInfo.currentDesktop
|
||||
activity: activityInfo.currentActivity
|
||||
|
||||
screenGeometry: root.screenGeometry
|
||||
|
||||
filterByVirtualDesktop: true
|
||||
filterByScreen: true
|
||||
filterByActivity: true
|
||||
|
||||
onActiveTaskChanged: {
|
||||
maximizedWindowModel.sourceModel = tasksModel
|
||||
}
|
||||
onDataChanged: { maximizedWindowModel.doCheck(); }
|
||||
onCountChanged: { maximizedWindowModel.doCheck(); }
|
||||
}
|
||||
|
||||
PlasmaCore.SortFilterModel {
|
||||
id: maximizedWindowModel
|
||||
filterRole: 'IsMaximized'
|
||||
filterRegExp: 'true'
|
||||
sourceModel: tasksModel
|
||||
|
||||
onDataChanged: { maximizedWindowModel.doCheck(); }
|
||||
onCountChanged: { maximizedWindowModel.doCheck(); }
|
||||
function doCheck() {
|
||||
var screenHasMaximized = false
|
||||
for (var i = 0; i < maximizedWindowModel.count; i++) {
|
||||
var task = maximizedWindowModel.get(i)
|
||||
if (task.IsMaximized && !task.IsMinimized) {
|
||||
screenHasMaximized = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if (winModel.maximizedWindowOnScreen != screenHasMaximized) {
|
||||
winModel.maximizedWindowOnScreen = screenHasMaximized
|
||||
}
|
||||
}
|
||||
}
|
||||
//--- active-window-control end
|
||||
}
|
@ -53,19 +53,20 @@ DragDrop.DropArea {
|
||||
property bool addLaunchersMessage: false
|
||||
property bool addLaunchersInTaskManager: plasmoid.configuration.addLaunchersInTaskManager
|
||||
property bool autoDecreaseIconSize: plasmoid.configuration.autoDecreaseIconSize
|
||||
property bool backgroundOnlyOnMaximized: plasmoid.configuration.backgroundOnlyOnMaximized
|
||||
property bool behaveAsPlasmaPanel: visibilityManager.panelIsBiggerFromIconSize && (zoomFactor === 1.0)
|
||||
&& (dock.visibility.mode === Latte.Dock.AlwaysVisible || dock.visibility.mode === Latte.Dock.WindowsGoBelow)
|
||||
&& (plasmoid.configuration.panelPosition === Latte.Dock.Justify) && !root.solidPanel
|
||||
|
||||
property bool blurEnabled: plasmoid.configuration.blurEnabled
|
||||
property bool blurEnabled: plasmoid.configuration.blurEnabled && !root.forceTransparentPanel
|
||||
property bool confirmedDragEntered: false
|
||||
property bool dockContainsMouse: dock && dock.visibility ? dock.visibility.containsMouse : false
|
||||
|
||||
|
||||
property bool drawShadowsExternal: panelShadowsActive && behaveAsPlasmaPanel
|
||||
|
||||
property bool editMode: plasmoid.userConfiguring
|
||||
property bool exposeAltSession: globalSettings ? globalSettings.exposeAltSession : false
|
||||
property bool forceTransparentPanel: root.backgroundOnlyOnMaximized && !windowsModel.hasMaximizedWindow
|
||||
|
||||
property bool immutable: plasmoid.immutable
|
||||
property bool indicateAudioStreams: plasmoid.configuration.indicateAudioStreams
|
||||
@ -119,7 +120,7 @@ DragDrop.DropArea {
|
||||
|
||||
property int panelEdgeSpacing: iconSize / 3
|
||||
property int panelTransparency: plasmoid.configuration.panelTransparency
|
||||
property bool panelShadowsActive: plasmoid.configuration.panelShadows
|
||||
property bool panelShadowsActive: plasmoid.configuration.panelShadows && !root.forceTransparentPanel
|
||||
|
||||
property int totalPanelEdgeSpacing: 0 //this is set by PanelBox
|
||||
//FIXME: this is not needed any more probably
|
||||
@ -203,7 +204,7 @@ DragDrop.DropArea {
|
||||
// TO BE DELETED, if not needed: property int counter:0;
|
||||
|
||||
///BEGIN properties provided to Latte Plasmoid
|
||||
property bool enableShadows: plasmoid.configuration.shadows
|
||||
property bool enableShadows: plasmoid.configuration.shadows || root.forceTransparentPanel
|
||||
property bool dockIsHidden: dock ? dock.visibility.isHidden : true
|
||||
property bool dotsOnActive: plasmoid.configuration.dotsOnActive
|
||||
property bool highlightWindows: plasmoid.configuration.highlightWindows
|
||||
@ -1312,6 +1313,15 @@ DragDrop.DropArea {
|
||||
}
|
||||
}
|
||||
|
||||
Loader{
|
||||
id: windowsModel
|
||||
|
||||
active: plasmoid.configuration.backgroundOnlyOnMaximized
|
||||
|
||||
property bool hasMaximizedWindow: active ? item.maximizedWindowOnScreen : false
|
||||
sourceComponent: WindowsModel{}
|
||||
}
|
||||
|
||||
|
||||
EditModeVisual{
|
||||
id:editModeVisual
|
||||
|
@ -71,6 +71,17 @@ PlasmaComponents.Page {
|
||||
plasmoid.configuration.shrinkThickMargins = checked
|
||||
}
|
||||
}
|
||||
|
||||
PlasmaComponents.CheckBox {
|
||||
id: onlyOnMaximizedChk
|
||||
Layout.leftMargin: units.smallSpacing * 2
|
||||
text: i18n("Show background only maximized windows ")
|
||||
checked: plasmoid.configuration.backgroundOnlyOnMaximized
|
||||
|
||||
onClicked: {
|
||||
plasmoid.configuration.backgroundOnlyOnMaximized = checked
|
||||
}
|
||||
}
|
||||
}
|
||||
//! END: Appearance
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user