panel & taskpanel: Only opaque if windows are maximized

This commit is contained in:
Devin Lin 2022-06-27 14:52:16 -04:00
parent c0642a6d41
commit a607fc2600
3 changed files with 68 additions and 17 deletions

View file

@ -18,12 +18,14 @@ import org.kde.plasma.components 3.0 as PlasmaComponents
import org.kde.plasma.private.nanoshell 2.0 as NanoShell import org.kde.plasma.private.nanoshell 2.0 as NanoShell
import org.kde.plasma.private.mobileshell 1.0 as MobileShell import org.kde.plasma.private.mobileshell 1.0 as MobileShell
import org.kde.taskmanager 0.1 as TaskManager
import org.kde.notificationmanager 1.0 as NotificationManager import org.kde.notificationmanager 1.0 as NotificationManager
Item { Item {
id: root id: root
readonly property bool showingApp: !MobileShell.WindowUtil.allWindowsMinimizedExcludingShell // only opaque if there are no maximized windows on this screen
readonly property bool showingApp: visibleMaximizedWindowsModel.count > 0
readonly property color backgroundColor: topPanel.colorScopeColor readonly property color backgroundColor: topPanel.colorScopeColor
Plasmoid.backgroundHints: showingApp ? PlasmaCore.Types.StandardBackground : PlasmaCore.Types.NoBackground Plasmoid.backgroundHints: showingApp ? PlasmaCore.Types.StandardBackground : PlasmaCore.Types.NoBackground
@ -76,6 +78,34 @@ Item {
MobileShell.VolumeProvider.bindShortcuts = true; MobileShell.VolumeProvider.bindShortcuts = true;
} }
TaskManager.VirtualDesktopInfo {
id: virtualDesktopInfo
}
TaskManager.ActivityInfo {
id: activityInfo
}
PlasmaCore.SortFilterModel {
id: visibleMaximizedWindowsModel
filterRole: 'IsMinimized'
filterRegExp: 'false'
sourceModel: TaskManager.TasksModel {
id: tasksModel
filterByVirtualDesktop: true
filterByActivity: true
filterNotMaximized: true
filterByScreen: true
filterHidden: true
// screenGeometry: panel.screenGeometry
virtualDesktop: virtualDesktopInfo.currentDesktop
activity: activityInfo.currentActivity
groupMode: TaskManager.TasksModel.GroupDisabled
}
}
// top panel component // top panel component
MobileShell.StatusBar { MobileShell.StatusBar {
id: topPanel id: topPanel
@ -97,7 +127,6 @@ Item {
id: drawer id: drawer
actionDrawer.notificationSettings: NotificationManager.Settings {} actionDrawer.notificationSettings: NotificationManager.Settings {}
actionDrawer.notificationModel: NotificationManager.Notifications { actionDrawer.notificationModel: NotificationManager.Notifications {
showExpired: true showExpired: true
showDismissed: true showDismissed: true

View file

@ -16,7 +16,7 @@ import org.kde.plasma.private.mobileshell 1.0 as MobileShell
MobileShell.NavigationPanel { MobileShell.NavigationPanel {
id: root id: root
property bool appIsShown: !MobileShell.WindowUtil.allWindowsMinimizedExcludingShell required property bool opaqueBar
// background is: // background is:
// - opaque if an app is shown or vkbd is shown // - opaque if an app is shown or vkbd is shown
@ -26,11 +26,11 @@ MobileShell.NavigationPanel {
if (root.taskSwitcher.visible) { if (root.taskSwitcher.visible) {
return Qt.rgba(0, 0, 0, 0.1); return Qt.rgba(0, 0, 0, 0.1);
} else { } else {
return (Keyboards.KWinVirtualKeyboard.visible || appIsShown) ? PlasmaCore.ColorScope.backgroundColor : "transparent"; return (Keyboards.KWinVirtualKeyboard.visible || opaqueBar) ? PlasmaCore.ColorScope.backgroundColor : "transparent";
} }
} }
foregroundColorGroup: (!root.taskSwitcher.visible && appIsShown) ? PlasmaCore.Theme.NormalColorGroup : PlasmaCore.Theme.ComplementaryColorGroup foregroundColorGroup: (!root.taskSwitcher.visible && opaqueBar) ? PlasmaCore.Theme.NormalColorGroup : PlasmaCore.Theme.ComplementaryColorGroup
shadow: !appIsShown shadow: !opaqueBar
// do not enable drag gesture when task switcher is already open // do not enable drag gesture when task switcher is already open
// also don't disable drag gesture mid-drag // also don't disable drag gesture mid-drag

View file

@ -21,13 +21,6 @@ import org.kde.plasma.phone.taskpanel 1.0 as TaskPanel
PlasmaCore.ColorScope { PlasmaCore.ColorScope {
id: root id: root
width: 360
// contrasting colour
colorGroup: !MobileShell.WindowUtil.allWindowsMinimized ? PlasmaCore.Theme.NormalColorGroup : PlasmaCore.Theme.ComplementaryColorGroup
readonly property color backgroundColor: PlasmaCore.ColorScope.backgroundColor
Plasmoid.backgroundHints: PlasmaCore.Types.NoBackground Plasmoid.backgroundHints: PlasmaCore.Types.NoBackground
// toggle visibility of navigation bar (show, or use gestures only) // toggle visibility of navigation bar (show, or use gestures only)
@ -114,18 +107,47 @@ PlasmaCore.ColorScope {
} }
//END API implementation //END API implementation
Window.onWindowChanged: { TaskManager.VirtualDesktopInfo {
if (!Window.window) { id: virtualDesktopInfo
return; }
TaskManager.ActivityInfo {
id: activityInfo
}
PlasmaCore.SortFilterModel {
id: visibleMaximizedWindowsModel
filterRole: 'IsMinimized'
filterRegExp: 'false'
sourceModel: TaskManager.TasksModel {
id: tasksModel
filterByVirtualDesktop: true
filterByActivity: true
filterNotMaximized: true
filterByScreen: true
filterHidden: true
// screenGeometry: panel.screenGeometry
virtualDesktop: virtualDesktopInfo.currentDesktop
activity: activityInfo.currentActivity
groupMode: TaskManager.TasksModel.GroupDisabled
} }
} }
// only opaque if there are no maximized windows on this screen
readonly property bool opaqueBar: visibleMaximizedWindowsModel.count > 0
// contrasting colour
colorGroup: opaqueBar ? PlasmaCore.Theme.NormalColorGroup : PlasmaCore.Theme.ComplementaryColorGroup
// bottom navigation panel component // bottom navigation panel component
Component { Component {
id: navigationPanel id: navigationPanel
NavigationPanelComponent { NavigationPanelComponent {
taskSwitcher: MobileShell.HomeScreenControls.taskSwitcher taskSwitcher: MobileShell.HomeScreenControls.taskSwitcher
opaqueBar: root.opaqueBar
} }
} }