mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
Auto-hide dock when a window is maximized
Slide the dock off-screen when WindowMaximizedTracker reports a maximized window, and bring it back on mouse proximity via a HoverHandler. The dockSpaceReserver exclusion zone drops to 0 so KWin gives the full screen to the maximized window. Animation follows the StatusBarWrapper pattern: offset property, Translate transform, Behavior with InExpo/OutExpo easing.
This commit is contained in:
parent
41a64bfe8e
commit
3728ef7602
2 changed files with 31 additions and 1 deletions
|
|
@ -176,11 +176,38 @@ ContainmentItem {
|
||||||
LayerShell.Window.exclusionZone: -1
|
LayerShell.Window.exclusionZone: -1
|
||||||
LayerShell.Window.keyboardInteractivity: LayerShell.Window.KeyboardInteractivityOnDemand
|
LayerShell.Window.keyboardInteractivity: LayerShell.Window.KeyboardInteractivityOnDemand
|
||||||
|
|
||||||
|
// Auto-hide: slide dock content off-screen when a window is
|
||||||
|
// maximized. A HoverHandler brings it back on mouse proximity.
|
||||||
|
property real dockOffset: 0
|
||||||
|
readonly property real dockHeight: Kirigami.Units.gridUnit * 3
|
||||||
|
readonly property bool dockHovered: dockHoverHandler.hovered
|
||||||
|
readonly property bool shouldHide: windowMaximizedTracker.showingWindow && !dockHovered
|
||||||
|
|
||||||
|
onShouldHideChanged: {
|
||||||
|
if (shouldHide) {
|
||||||
|
dockOffset = dockHeight
|
||||||
|
} else {
|
||||||
|
dockOffset = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
HoverHandler {
|
||||||
|
id: dockHoverHandler
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on dockOffset {
|
||||||
|
NumberAnimation {
|
||||||
|
easing.type: dockOverlay.shouldHide ? Easing.InExpo : Easing.OutExpo
|
||||||
|
duration: Kirigami.Units.longDuration
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
Kirigami.Theme.inherit: false
|
Kirigami.Theme.inherit: false
|
||||||
Kirigami.Theme.colorSet: Kirigami.Theme.Window
|
Kirigami.Theme.colorSet: Kirigami.Theme.Window
|
||||||
color: Kirigami.Theme.backgroundColor
|
color: Kirigami.Theme.backgroundColor
|
||||||
|
transform: Translate { y: dockOverlay.dockOffset }
|
||||||
}
|
}
|
||||||
|
|
||||||
FavouritesBar {
|
FavouritesBar {
|
||||||
|
|
@ -189,6 +216,7 @@ ContainmentItem {
|
||||||
folio: root.folio
|
folio: root.folio
|
||||||
maskManager: root.maskManager
|
maskManager: root.maskManager
|
||||||
homeScreen: folioHomeScreen
|
homeScreen: folioHomeScreen
|
||||||
|
transform: Translate { y: dockOverlay.dockOffset }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -145,6 +145,8 @@ ContainmentItem {
|
||||||
// desktop) with an exclusive zone equal to the dock height so that KWin
|
// desktop) with an exclusive zone equal to the dock height so that KWin
|
||||||
// shrinks MaximizeArea accordingly. Input-transparent so clicks fall
|
// shrinks MaximizeArea accordingly. Input-transparent so clicks fall
|
||||||
// through to the homescreen dock underneath.
|
// through to the homescreen dock underneath.
|
||||||
|
// When a window is maximized the exclusive zone drops to 0 so the
|
||||||
|
// window reclaims the full screen while the dock auto-hides.
|
||||||
Window {
|
Window {
|
||||||
id: dockSpaceReserver
|
id: dockSpaceReserver
|
||||||
visible: ShellSettings.Settings.convergenceModeEnabled
|
visible: ShellSettings.Settings.convergenceModeEnabled
|
||||||
|
|
@ -157,7 +159,7 @@ ContainmentItem {
|
||||||
LayerShell.Window.scope: "dock-space"
|
LayerShell.Window.scope: "dock-space"
|
||||||
LayerShell.Window.layer: LayerShell.Window.LayerBottom
|
LayerShell.Window.layer: LayerShell.Window.LayerBottom
|
||||||
LayerShell.Window.anchors: LayerShell.Window.AnchorBottom | LayerShell.Window.AnchorLeft | LayerShell.Window.AnchorRight
|
LayerShell.Window.anchors: LayerShell.Window.AnchorBottom | LayerShell.Window.AnchorLeft | LayerShell.Window.AnchorRight
|
||||||
LayerShell.Window.exclusionZone: Kirigami.Units.gridUnit * 3
|
LayerShell.Window.exclusionZone: windowMaximizedTracker.showingWindow ? 0 : Kirigami.Units.gridUnit * 3
|
||||||
LayerShell.Window.keyboardInteractivity: LayerShell.Window.KeyboardInteractivityNone
|
LayerShell.Window.keyboardInteractivity: LayerShell.Window.KeyboardInteractivityNone
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue