dock: pinned mode acts as screen split - bar shrinks, corners adjust, opaque background

This commit is contained in:
Damocles 2026-04-25 21:48:35 +02:00
parent c22eb51dcd
commit f501f977d1
9 changed files with 52 additions and 21 deletions

View file

@ -14,11 +14,11 @@ PanelWindow {
required property var screen required property var screen
visible: D.DockState.open visible: S.DockState.open
color: "transparent" color: "transparent"
WlrLayershell.layer: D.DockState.mode === "pinned" ? WlrLayer.Top : WlrLayer.Overlay WlrLayershell.layer: S.DockState.mode === "pinned" ? WlrLayer.Top : WlrLayer.Overlay
WlrLayershell.exclusiveZone: D.DockState.mode === "pinned" ? _dockWidth : 0 WlrLayershell.exclusiveZone: S.DockState.mode === "pinned" ? _dockWidth : 0
WlrLayershell.namespace: "nova-dock" WlrLayershell.namespace: "nova-dock"
anchors.top: true anchors.top: true
@ -31,8 +31,21 @@ PanelWindow {
implicitWidth: _dockWidth implicitWidth: _dockWidth
// Set reserved width for bar/corners when pinned
onVisibleChanged: {
if (S.DockState.mode === "pinned")
S.DockState.reservedWidth = _dockWidth;
}
Connections {
target: S.DockState
function onModeChanged() {
if (S.DockState.mode === "pinned")
S.DockState.reservedWidth = root._dockWidth;
}
}
// Slide animation // Slide animation
property real _slideX: D.DockState.open ? 0 : _dockWidth property real _slideX: S.DockState.open ? 0 : _dockWidth
Behavior on _slideX { Behavior on _slideX {
enabled: !S.Theme.reducedMotion enabled: !S.Theme.reducedMotion
@ -46,7 +59,7 @@ PanelWindow {
HoverHandler { HoverHandler {
id: _dockHover id: _dockHover
onHoveredChanged: { onHoveredChanged: {
if (!hovered && D.DockState.mode === "overlay") if (!hovered && S.DockState.mode === "overlay")
_overlayCloseTimer.restart(); _overlayCloseTimer.restart();
else else
_overlayCloseTimer.stop(); _overlayCloseTimer.stop();
@ -56,16 +69,16 @@ PanelWindow {
Timer { Timer {
id: _overlayCloseTimer id: _overlayCloseTimer
interval: 200 interval: 200
onTriggered: if (D.DockState.mode === "overlay") onTriggered: if (S.DockState.mode === "overlay")
D.DockState.close() S.DockState.close()
} }
// Background // Background - fully opaque when pinned, semi-transparent in overlay
Rectangle { Rectangle {
id: _bg id: _bg
anchors.fill: parent anchors.fill: parent
color: S.Theme.base00 color: S.Theme.base00
opacity: Math.max(S.Theme.barOpacity, 0.85) opacity: S.DockState.mode === "pinned" ? 1.0 : Math.max(S.Theme.barOpacity, 0.85)
transform: Translate { transform: Translate {
x: root._slideX x: root._slideX
@ -355,7 +368,7 @@ PanelWindow {
_runner.command = cmd; _runner.command = cmd;
_runner.running = true; _runner.running = true;
} }
onDismiss: D.DockState.close() onDismiss: S.DockState.close()
} }
} }
} }
@ -370,13 +383,13 @@ PanelWindow {
M.ProcessList { M.ProcessList {
id: _cpuProcs id: _cpuProcs
sortBy: "cpu" sortBy: "cpu"
active: _cpuCard.expanded && D.DockState.open active: _cpuCard.expanded && S.DockState.open
} }
M.ProcessList { M.ProcessList {
id: _memProcs id: _memProcs
sortBy: "mem" sortBy: "mem"
active: _memCard.expanded && D.DockState.open active: _memCard.expanded && S.DockState.open
} }
PwObjectTracker { PwObjectTracker {

View file

@ -1,7 +1,7 @@
import QtQuick import QtQuick
import Quickshell import Quickshell
import Quickshell.Wayland import Quickshell.Wayland
import "." as D import "../services" as S
// Invisible 2px-wide PanelWindow at the right screen edge. // Invisible 2px-wide PanelWindow at the right screen edge.
// When cursor enters, opens the dock in overlay mode. // When cursor enters, opens the dock in overlay mode.
@ -10,7 +10,7 @@ PanelWindow {
required property var screen required property var screen
visible: !D.DockState.open visible: !S.DockState.open
color: "transparent" color: "transparent"
WlrLayershell.layer: WlrLayer.Overlay WlrLayershell.layer: WlrLayer.Overlay
@ -25,8 +25,8 @@ PanelWindow {
HoverHandler { HoverHandler {
onHoveredChanged: { onHoveredChanged: {
if (hovered && !D.DockState.open) if (hovered && !S.DockState.open)
D.DockState.openOverlay(); S.DockState.openOverlay();
} }
} }
} }

View file

@ -3,5 +3,4 @@ module dock
AppletDock 1.0 AppletDock.qml AppletDock 1.0 AppletDock.qml
DockCard 1.0 DockCard.qml DockCard 1.0 DockCard.qml
DockEdgeTrigger 1.0 DockEdgeTrigger.qml DockEdgeTrigger 1.0 DockEdgeTrigger.qml
singleton DockState 1.0 DockState.qml
# keep-sorted end # keep-sorted end

View file

@ -19,6 +19,8 @@ PanelWindow {
right: true right: true
} }
margins.right: S.DockState.reservedWidth
implicitHeight: S.Theme.barHeight implicitHeight: S.Theme.barHeight
exclusiveZone: implicitHeight exclusiveZone: implicitHeight

View file

@ -1,15 +1,14 @@
import QtQuick import QtQuick
import "." as M import "." as M
import "../services" as S import "../services" as S
import "../dock" as D
M.BarModule { M.BarModule {
id: root id: root
tooltip: D.DockState.open ? "Close dock" : "Open dock" tooltip: S.DockState.open ? "Close dock" : "Open dock"
onTapped: D.DockState.toggle() onTapped: S.DockState.toggle()
M.BarIcon { M.BarIcon {
icon: D.DockState.open ? "\uDB80\uDD8B" : "\uDB80\uDD89" icon: S.DockState.open ? "\uDB80\uDD8B" : "\uDB80\uDD89"
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
} }

View file

@ -80,6 +80,7 @@ Item {
corner: 1 corner: 1
anchors.top: true anchors.top: true
anchors.right: true anchors.right: true
margins.right: S.DockState.reservedWidth
} }
Corner { Corner {
corner: 2 corner: 2
@ -90,5 +91,6 @@ Item {
corner: 3 corner: 3
anchors.bottom: true anchors.bottom: true
anchors.right: true anchors.right: true
margins.right: S.DockState.reservedWidth
} }
} }

View file

@ -7,6 +7,15 @@ QtObject {
property string mode: "closed" property string mode: "closed"
readonly property bool open: mode !== "closed" readonly property bool open: mode !== "closed"
// Screen space reserved by the dock when pinned.
// Bar, screen corners, etc. read this to adjust layout.
property int reservedWidth: 0
onModeChanged: {
if (mode !== "pinned")
reservedWidth = 0;
}
function openPinned() { function openPinned() {
mode = "pinned"; mode = "pinned";
} }

View file

@ -4,6 +4,7 @@ NotifItem 1.0 NotifItem.qml
singleton BacklightService 1.0 BacklightService.qml singleton BacklightService 1.0 BacklightService.qml
singleton BatteryService 1.0 BatteryService.qml singleton BatteryService 1.0 BatteryService.qml
singleton BluetoothService 1.0 BluetoothService.qml singleton BluetoothService 1.0 BluetoothService.qml
singleton DockState 1.0 DockState.qml
singleton IdleInhibitService 1.0 IdleInhibitService.qml singleton IdleInhibitService 1.0 IdleInhibitService.qml
singleton LockService 1.0 LockService.qml singleton LockService 1.0 LockService.qml
singleton Modules 1.0 Modules.qml singleton Modules 1.0 Modules.qml

View file

@ -33,7 +33,10 @@ shell/modules/BarModule.qml: Member "accentColor" not found on type "QQuickItem"
shell/modules/BarModule.qml: Member "keepOpen" not found on type "QObject" [missing-property] shell/modules/BarModule.qml: Member "keepOpen" not found on type "QObject" [missing-property]
shell/modules/BarModule.qml: Member "screen" not found on type "QObject" [missing-property] shell/modules/BarModule.qml: Member "screen" not found on type "QObject" [missing-property]
shell/modules/BarModule.qml: Unqualified access [unqualified] shell/modules/BarModule.qml: Unqualified access [unqualified]
shell/modules/Bar.qml: Could not find property "right". [missing-property]
shell/modules/Bar.qml: Type margins is used but it is not resolved [unresolved-type]
shell/modules/Bar.qml: Type PanelWindow is not creatable. [uncreatable-type] shell/modules/Bar.qml: Type PanelWindow is not creatable. [uncreatable-type]
shell/modules/Bar.qml: unknown grouped property scope margins. [unqualified]
shell/modules/BatteryModule.qml: Unqualified access [unqualified] shell/modules/BatteryModule.qml: Unqualified access [unqualified]
shell/modules/BluetoothModule.qml: Unqualified access [unqualified] shell/modules/BluetoothModule.qml: Unqualified access [unqualified]
shell/modules/ClockModule.qml: Unqualified access [unqualified] shell/modules/ClockModule.qml: Unqualified access [unqualified]
@ -58,7 +61,10 @@ shell/modules/NotifPopup.qml: Unqualified access [unqualified]
shell/modules/OverviewBackdrop.qml: Type PanelWindow is not creatable. [uncreatable-type] shell/modules/OverviewBackdrop.qml: Type PanelWindow is not creatable. [uncreatable-type]
shell/modules/PowerModule.qml: Unqualified access [unqualified] shell/modules/PowerModule.qml: Unqualified access [unqualified]
shell/modules/ScreenCapture.qml: Type PanelWindow is not creatable. [uncreatable-type] shell/modules/ScreenCapture.qml: Type PanelWindow is not creatable. [uncreatable-type]
shell/modules/ScreenCorners.qml: Could not find property "right". [missing-property]
shell/modules/ScreenCorners.qml: Type margins is used but it is not resolved [unresolved-type]
shell/modules/ScreenCorners.qml: Type PanelWindow is not creatable. [uncreatable-type] shell/modules/ScreenCorners.qml: Type PanelWindow is not creatable. [uncreatable-type]
shell/modules/ScreenCorners.qml: unknown grouped property scope margins. [unqualified]
shell/modules/ScreenCorners.qml: Unqualified access [unqualified] shell/modules/ScreenCorners.qml: Unqualified access [unqualified]
shell/modules/TemperatureModule.qml: Unqualified access [unqualified] shell/modules/TemperatureModule.qml: Unqualified access [unqualified]
shell/modules/ThemedIcon.qml: Unqualified access [unqualified] shell/modules/ThemedIcon.qml: Unqualified access [unqualified]