1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-08-04 20:48:29 -04:00

frame: merge bars with frame window and get things on Top layer by

default
This commit is contained in:
bbedward
2026-07-23 14:10:17 -04:00
parent 5854327c28
commit 8af71036cc
21 changed files with 2608 additions and 2121 deletions
+114
View File
@@ -0,0 +1,114 @@
pragma ComponentBehavior: Bound
import QtQuick
import qs.Common
import qs.Modules.DankBar
import qs.Services
// Renders the bar(s) inside the frame surface in connected mode: one DankBarBody per
// active bar edge, positioned in the frame's cutout band. Reuses the existing DankBar
// item (per bar config) as rootWindow so colour-picker, overview loader and widget
// models are shared with the standalone path.
Item {
id: host
required property var frameWindow
required property var targetScreen
readonly property string screenName: targetScreen ? targetScreen.name : ""
readonly property var barSlots: {
SettingsData.barConfigs;
const out = [];
const configs = SettingsData.barConfigs || [];
for (let i = 0; i < configs.length; i++) {
const bc = configs[i];
if (!bc.enabled || (bc.useOverlayLayer ?? false))
continue;
const prefs = bc.screenPreferences || ["all"];
if (!prefs.includes("all") && !SettingsData.isScreenInPreferences(host.targetScreen, prefs))
continue;
let edge = "top";
switch (bc.position ?? 0) {
case SettingsData.Position.Bottom:
edge = "bottom";
break;
case SettingsData.Position.Left:
edge = "left";
break;
case SettingsData.Position.Right:
edge = "right";
break;
}
out.push({
"barId": bc.id,
"edge": edge
});
}
// Horizontal bars own the corners, so render them last (on top) — their edge widget
// must receive the corner click over the vertical bar's hover area beneath it.
out.sort((a, b) => {
const rank = e => (e === "left" || e === "right") ? 0 : 1;
return rank(a.edge) - rank(b.edge);
});
return out;
}
Repeater {
model: host.barSlots
delegate: Item {
id: slot
required property var modelData
readonly property string edge: modelData.edge
readonly property var dankBarItem: BarWidgetService.dankBarItems[modelData.barId] ?? null
readonly property var slotBarConfig: dankBarItem?.barConfig ?? SettingsData.getBarConfig(modelData.barId)
// Each bar spans its full edge (matching the standalone window extent) so
// DankBarContent's own adjacency margins inset it, rather than double-insetting
// against a pre-carved strip.
x: edge === "right" ? host.frameWindow._windowRegionWidth - host.frameWindow.cutoutRightInset : 0
y: edge === "bottom" ? host.frameWindow._windowRegionHeight - host.frameWindow.cutoutBottomInset : 0
width: {
switch (edge) {
case "left":
return host.frameWindow.cutoutLeftInset;
case "right":
return host.frameWindow.cutoutRightInset;
default:
return host.frameWindow._windowRegionWidth;
}
}
height: {
switch (edge) {
case "top":
return host.frameWindow.cutoutTopInset;
case "bottom":
return host.frameWindow.cutoutBottomInset;
default:
return host.frameWindow._windowRegionHeight;
}
}
Loader {
anchors.fill: parent
active: slot.dankBarItem !== null && slot.slotBarConfig !== null
sourceComponent: DankBarBody {
hostWindow: host.frameWindow
modelData: host.targetScreen
rootWindow: slot.dankBarItem
barConfig: slot.slotBarConfig
leftWidgetsModel: slot.dankBarItem?.leftWidgetsModel ?? null
centerWidgetsModel: slot.dankBarItem?.centerWidgetsModel ?? null
rightWidgetsModel: slot.dankBarItem?.rightWidgetsModel ?? null
Component.onCompleted: BarWidgetService.registerFrameBar(host.screenName, this)
Component.onDestruction: BarWidgetService.unregisterFrameBar(host.screenName, this)
}
}
}
}
}
@@ -0,0 +1,30 @@
pragma ComponentBehavior: Bound
import QtQuick
import qs.Common
import qs.Modules.Dock
import qs.Services
// Renders the dock inside the frame surface in connected mode: a single DockBody
// positioned by SettingsData.dockPosition. It fills the frame and positions its own
// content via its internal anchors/geometry using hostWindow.
Item {
id: host
required property var frameWindow
required property var targetScreen
readonly property string screenName: targetScreen ? targetScreen.name : ""
// Exposed so FrameWindow can add the dock's hover strip to its input region.
readonly property alias dockMaskItem: dockBody.inputMaskItem
DockBody {
id: dockBody
anchors.fill: parent
hostWindow: host.frameWindow
modelData: host.targetScreen
contextMenu: BarWidgetService.dockContextMenu
trashContextMenu: BarWidgetService.dockTrashContextMenu
}
}
+32 -7
View File
@@ -16,15 +16,33 @@ Scope {
return SettingsData.getActiveBarEdgesForScreen(screen);
}
// One thin invisible PanelWindow per edge.
// Skips any edge where a bar already provides its own exclusiveZone.
// Overlay-layer bars stay standalone even in connected mode and reserve their own edge.
readonly property var overlayBarEdges: {
SettingsData.barConfigs;
return SettingsData.getOverlayBarEdgesForScreen(root.screen);
}
// One thin invisible PanelWindow per edge. A standalone bar reserves its own edge, so
// that edge is skipped — unless the frame hosts the bar (connected mode), where no bar
// window exists and the exclusion must reserve the full bar thickness itself.
readonly property bool screenEnabled: CompositorService.frameWindowVisibleForScreen(root.screen)
readonly property bool hostsBar: CompositorService.frameHostsSurfacesForScreen(root.screen)
function hostsBandForEdge(edge) {
return root.hostsBar && !root.overlayBarEdges.includes(edge);
}
function exclusionSizeForEdge(edge) {
return root.barEdges.includes(edge) ? SettingsData.frameBarSize : SettingsData.frameThickness;
}
Loader {
active: root.screenEnabled && !root.barEdges.includes("top")
readonly property bool isBarEdge: root.barEdges.includes("top")
active: root.screenEnabled && (!isBarEdge || root.hostsBandForEdge("top"))
sourceComponent: EdgeExclusion {
targetScreen: root.screen
exclusionSize: root.exclusionSizeForEdge("top")
anchorTop: true
anchorLeft: true
anchorRight: true
@@ -32,9 +50,11 @@ Scope {
}
Loader {
active: root.screenEnabled && !root.barEdges.includes("bottom")
readonly property bool isBarEdge: root.barEdges.includes("bottom")
active: root.screenEnabled && (!isBarEdge || root.hostsBandForEdge("bottom"))
sourceComponent: EdgeExclusion {
targetScreen: root.screen
exclusionSize: root.exclusionSizeForEdge("bottom")
anchorBottom: true
anchorLeft: true
anchorRight: true
@@ -42,9 +62,11 @@ Scope {
}
Loader {
active: root.screenEnabled && !root.barEdges.includes("left")
readonly property bool isBarEdge: root.barEdges.includes("left")
active: root.screenEnabled && (!isBarEdge || root.hostsBandForEdge("left"))
sourceComponent: EdgeExclusion {
targetScreen: root.screen
exclusionSize: root.exclusionSizeForEdge("left")
anchorLeft: true
anchorTop: true
anchorBottom: true
@@ -52,9 +74,11 @@ Scope {
}
Loader {
active: root.screenEnabled && !root.barEdges.includes("right")
readonly property bool isBarEdge: root.barEdges.includes("right")
active: root.screenEnabled && (!isBarEdge || root.hostsBandForEdge("right"))
sourceComponent: EdgeExclusion {
targetScreen: root.screen
exclusionSize: root.exclusionSizeForEdge("right")
anchorRight: true
anchorTop: true
anchorBottom: true
@@ -63,6 +87,7 @@ Scope {
component EdgeExclusion: PanelWindow {
required property var targetScreen
property real exclusionSize: SettingsData.frameThickness
screen: targetScreen
property bool anchorTop: false
@@ -72,7 +97,7 @@ Scope {
WlrLayershell.namespace: "dms:frame-exclusion"
WlrLayershell.layer: WlrLayer.Top
exclusiveZone: SettingsData.frameThickness
exclusiveZone: exclusionSize
color: "transparent"
mask: Region {}
implicitWidth: 1
+95 -1
View File
@@ -32,7 +32,41 @@ PanelWindow {
}
color: "transparent"
mask: Region {}
// Click-through everywhere except the bar strips it hosts in connected mode.
mask: Region {
Region {
readonly property bool present: win._connectedActive && win.barEdges.includes("top")
x: 0
y: 0
width: present ? win._windowRegionWidth : 0
height: present ? win.cutoutTopInset : 0
}
Region {
readonly property bool present: win._connectedActive && win.barEdges.includes("bottom")
x: 0
y: present ? win._windowRegionHeight - win.cutoutBottomInset : 0
width: present ? win._windowRegionWidth : 0
height: present ? win.cutoutBottomInset : 0
}
Region {
readonly property bool present: win._connectedActive && win.barEdges.includes("left")
x: 0
y: 0
width: present ? win.cutoutLeftInset : 0
height: present ? win._windowRegionHeight : 0
}
Region {
readonly property bool present: win._connectedActive && win.barEdges.includes("right")
x: present ? win._windowRegionWidth - win.cutoutRightInset : 0
y: 0
width: present ? win.cutoutRightInset : 0
height: present ? win._windowRegionHeight : 0
}
// The frame-hosted dock's hover strip, so hover-reveal works through the frame surface.
Region {
item: frameDockHostLoader.item ? frameDockHostLoader.item.dockMaskItem : null
}
}
readonly property var barEdges: {
SettingsData.barConfigs;
@@ -51,6 +85,16 @@ PanelWindow {
readonly property var _modalDescriptor: ConnectedModeState.surfaceDescriptor(win._screenName, "modal")
readonly property bool _connectedActive: CompositorService.usesConnectedFrameChromeForScreen(win.targetScreen)
readonly property bool _dockHostedHere: {
if (!win._connectedActive || !SettingsData.showDock || SettingsData.dockUseOverlayLayer)
return false;
const screens = SettingsData.getFilteredScreens("dock");
for (let i = 0; i < screens.length; i++) {
if (screens[i] && screens[i].name === win._screenName)
return true;
}
return false;
}
readonly property string _barSide: {
const edges = win.barEdges;
if (edges.includes("top"))
@@ -191,6 +235,33 @@ PanelWindow {
return Math.max(0, Math.round(Theme.px(value, win._dpr)));
}
function _pointInBand(lx, ly, bx, by, bw, bh, pad) {
return lx >= bx - pad && lx < bx + bw + pad && ly >= by - pad && ly < by + bh + pad;
}
function containsGlobalPoint(gx, gy, padding) {
if (!win._connectedActive || !win.contentItem)
return false;
const origin = win.contentItem.mapToItem(null, 0, 0);
if (!origin)
return false;
const pad = padding !== undefined ? padding : 16;
const lx = gx - origin.x;
const ly = gy - origin.y;
const w = win._windowRegionWidth;
const h = win._windowRegionHeight;
const edges = win.barEdges;
if (edges.includes("top") && win._pointInBand(lx, ly, 0, 0, w, win.cutoutTopInset, pad))
return true;
if (edges.includes("bottom") && win._pointInBand(lx, ly, 0, h - win.cutoutBottomInset, w, win.cutoutBottomInset, pad))
return true;
if (edges.includes("left") && win._pointInBand(lx, ly, 0, 0, win.cutoutLeftInset, h, pad))
return true;
if (edges.includes("right") && win._pointInBand(lx, ly, w - win.cutoutRightInset, 0, win.cutoutRightInset, h, pad))
return true;
return false;
}
readonly property int cutoutTopInset: win._regionInt(barEdges.includes("top") ? SettingsData.frameBarSize : SettingsData.frameThickness)
readonly property int cutoutBottomInset: win._regionInt(barEdges.includes("bottom") ? SettingsData.frameBarSize : SettingsData.frameThickness)
readonly property int cutoutLeftInset: win._regionInt(barEdges.includes("left") ? SettingsData.frameBarSize : SettingsData.frameThickness)
@@ -1049,10 +1120,12 @@ PanelWindow {
}
Component.onCompleted: {
KeyboardFocus.registerBarWindow(win);
win._scheduleBlurRebuild();
win._scheduleSurfaceRefresh();
}
Component.onDestruction: {
KeyboardFocus.unregisterBarWindow(win);
blurRebuildAction.cancel();
surfaceRefreshAction.cancel();
win._teardownBlur();
@@ -1101,4 +1174,25 @@ PanelWindow {
property vector4d chromeK3: win._sdfSlots[3].k
property vector4d chromeParam3: win._sdfSlots[3].param
}
Loader {
anchors.fill: parent
z: 1
active: win._connectedActive
sourceComponent: FrameBarHost {
frameWindow: win
targetScreen: win.targetScreen
}
}
Loader {
id: frameDockHostLoader
anchors.fill: parent
z: 1
active: win._dockHostedHere
sourceComponent: FrameDockHost {
frameWindow: win
targetScreen: win.targetScreen
}
}
}