mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
Merge pull request #1913 from tibssy/fix/dock-alignment-and-triggers
Fix/dock alignment and triggers
This commit is contained in:
+28
-3
@@ -94,6 +94,11 @@ Loader {
|
||||
// Bar detection and positioning properties
|
||||
readonly property bool hasBar: modelData && modelData.name ? (Settings.data.bar.monitors.includes(modelData.name) || (Settings.data.bar.monitors.length === 0)) : false
|
||||
readonly property bool barAtSameEdge: hasBar && Settings.getBarPositionForScreen(modelData?.name) === dockPosition
|
||||
readonly property string barPosition: Settings.getBarPositionForScreen(modelData?.name)
|
||||
readonly property bool barIsVertical: barPosition === "left" || barPosition === "right"
|
||||
readonly property bool barIsFramed: Settings.data.bar.barType === "framed" && hasBar
|
||||
readonly property real barMarginH: Settings.data.bar.floating ? Math.ceil(Settings.data.bar.marginHorizontal) : 0
|
||||
readonly property real barMarginV: Settings.data.bar.floating ? Math.ceil(Settings.data.bar.marginVertical) : 0
|
||||
readonly property int barHeight: Style.getBarHeightForScreen(modelData?.name)
|
||||
readonly property int peekEdgeLength: {
|
||||
const edgeSize = isVertical ? Math.round(modelData?.height || maxHeight) : Math.round(modelData?.width || maxWidth);
|
||||
@@ -104,12 +109,34 @@ Loader {
|
||||
if (isVertical)
|
||||
return 0;
|
||||
const edgeSize = Math.round(modelData?.width || maxWidth);
|
||||
if (barIsVertical) {
|
||||
if (barPosition === "left") {
|
||||
const availableStart = (barIsFramed ? 0 : barMarginH) + barHeight;
|
||||
const availableWidth = edgeSize - availableStart - (barIsFramed ? Settings.data.bar.frameThickness : 0);
|
||||
return Math.max(0, Math.round(availableStart + (availableWidth - peekEdgeLength) / 2));
|
||||
}
|
||||
if (barPosition === "right") {
|
||||
const availableWidth = edgeSize - (barIsFramed ? 0 : barMarginH) - barHeight - (barIsFramed ? Settings.data.bar.frameThickness : 0);
|
||||
return Math.max(0, Math.round((barIsFramed ? Settings.data.bar.frameThickness : 0) + (availableWidth - peekEdgeLength) / 2));
|
||||
}
|
||||
}
|
||||
return Math.max(0, Math.round((edgeSize - peekEdgeLength) / 2));
|
||||
}
|
||||
readonly property int peekCenterOffsetY: {
|
||||
if (!isVertical)
|
||||
return 0;
|
||||
const edgeSize = Math.round(modelData?.height || maxHeight);
|
||||
if (!barIsVertical) {
|
||||
if (barPosition === "top") {
|
||||
const availableStart = (barIsFramed ? 0 : barMarginV) + barHeight;
|
||||
const availableHeight = edgeSize - availableStart - (barIsFramed ? Settings.data.bar.frameThickness : 0);
|
||||
return Math.max(0, Math.round(availableStart + (availableHeight - peekEdgeLength) / 2));
|
||||
}
|
||||
if (barPosition === "bottom") {
|
||||
const availableHeight = edgeSize - (barIsFramed ? 0 : barMarginV) - barHeight - (barIsFramed ? Settings.data.bar.frameThickness : 0);
|
||||
return Math.max(0, Math.round((barIsFramed ? Settings.data.bar.frameThickness : 0) + (availableHeight - peekEdgeLength) / 2));
|
||||
}
|
||||
}
|
||||
return Math.max(0, Math.round((edgeSize - peekEdgeLength) / 2));
|
||||
}
|
||||
readonly property bool showFrameIndicator: {
|
||||
@@ -648,9 +675,7 @@ Loader {
|
||||
implicitWidth: isVertical ? ((showFrameIndicator || barAtSameEdge) ? indicatorThickness : peekHeight) : peekEdgeLength
|
||||
|
||||
Rectangle {
|
||||
anchors.centerIn: parent
|
||||
width: isVertical ? indicatorThickness : frameIndicatorLength
|
||||
height: isVertical ? frameIndicatorLength : indicatorThickness
|
||||
anchors.fill: parent
|
||||
radius: indicatorThickness
|
||||
color: Qt.alpha(Color.mPrimary, 0.6)
|
||||
opacity: showFrameIndicator && frameIndicatorLength > 0 ? 1 : 0
|
||||
|
||||
@@ -19,6 +19,7 @@ Item {
|
||||
required property int extraRight
|
||||
property alias dockContainer: dockContainer
|
||||
readonly property bool isStaticMode: Settings.data.dock.dockType === "static"
|
||||
readonly property string tooltipDirection: dockRoot.dockPosition === "top" ? "bottom" : "top"
|
||||
|
||||
Rectangle {
|
||||
id: dockContainer
|
||||
@@ -288,7 +289,7 @@ Item {
|
||||
|
||||
onEntered: {
|
||||
dockRoot.anyAppHovered = true;
|
||||
TooltipService.show(launcherButton, I18n.tr("actions.open-launcher"), "top");
|
||||
TooltipService.show(launcherButton, I18n.tr("actions.open-launcher"), tooltipDirection);
|
||||
if (dockRoot.autoHide) {
|
||||
dockRoot.showTimer.stop();
|
||||
dockRoot.hideTimer.stop();
|
||||
@@ -664,7 +665,7 @@ Item {
|
||||
const appName = appButton.appTitle || appButton.appId || "Unknown";
|
||||
const tooltipText = appName.length > 40 ? appName.substring(0, 37) + "..." : appName;
|
||||
if (!contextMenu.visible) {
|
||||
TooltipService.show(appButton, tooltipText, "top");
|
||||
TooltipService.show(appButton, tooltipText, tooltipDirection);
|
||||
}
|
||||
if (dockRoot.autoHide) {
|
||||
dockRoot.showTimer.stop();
|
||||
|
||||
Reference in New Issue
Block a user