initial commit for repositioning bar, currently broken
This commit is contained in:
@@ -61,6 +61,7 @@ JsonObject {
|
|||||||
property bool hideWhenNotif: false
|
property bool hideWhenNotif: false
|
||||||
property Popouts popouts: Popouts {
|
property Popouts popouts: Popouts {
|
||||||
}
|
}
|
||||||
|
property string position: "top"
|
||||||
property int rounding: 8
|
property int rounding: 8
|
||||||
property int smoothing: 32
|
property int smoothing: 32
|
||||||
property Tray tray: Tray {
|
property Tray tray: Tray {
|
||||||
|
|||||||
+37
-2
@@ -11,15 +11,50 @@ Variants {
|
|||||||
|
|
||||||
required property ShellScreen modelData
|
required property ShellScreen modelData
|
||||||
|
|
||||||
|
function rebuild(): void {
|
||||||
|
loader.active = false;
|
||||||
|
loader.active = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
LazyLoader {
|
||||||
|
id: loader
|
||||||
|
|
||||||
|
active: true
|
||||||
|
|
||||||
|
Drawer {
|
||||||
|
screen: scope.modelData
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
function onConfigDashboardPositionChanged(): void {
|
||||||
|
Qt.callLater(scope.rebuild);
|
||||||
|
}
|
||||||
|
|
||||||
|
function onConfigPositionChanged(): void {
|
||||||
|
Qt.callLater(scope.rebuild);
|
||||||
|
}
|
||||||
|
|
||||||
|
target: (loader.item as Drawer)?.geometry ?? null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
component Drawer: Scope {
|
||||||
|
id: drawer
|
||||||
|
|
||||||
|
readonly property alias geometry: content.geometry
|
||||||
|
required property ShellScreen screen
|
||||||
|
|
||||||
Exclusions {
|
Exclusions {
|
||||||
bar: content.bar
|
bar: content.bar
|
||||||
screen: scope.modelData
|
geometry: content.geometry
|
||||||
|
screen: drawer.screen
|
||||||
}
|
}
|
||||||
|
|
||||||
Windows {
|
Windows {
|
||||||
id: content
|
id: content
|
||||||
|
|
||||||
screen: scope.modelData
|
screen: drawer.screen
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,57 @@
|
|||||||
|
import QtQuick
|
||||||
|
import qs.Modules.Bar as Bar
|
||||||
|
|
||||||
|
QtObject {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
required property Bar.BarLoader bar
|
||||||
|
readonly property real barClamped: bar.clampedExtent
|
||||||
|
readonly property real barExtent: bar.extent
|
||||||
|
readonly property bool barOnBottom: position === "bottom"
|
||||||
|
readonly property bool barOnLeft: position === "left"
|
||||||
|
readonly property bool barOnTop: position === "top"
|
||||||
|
required property string configDashboardPosition
|
||||||
|
required property string configPosition
|
||||||
|
readonly property bool dashboardOnLeft: configDashboardPosition === "left" ? !barOnLeft : barOnTop
|
||||||
|
readonly property bool horizontal: position !== "left"
|
||||||
|
readonly property string position: configPosition === "top" || configPosition === "bottom" ? configPosition : "left"
|
||||||
|
required property var win
|
||||||
|
|
||||||
|
function axisPos(x: real, y: real): real {
|
||||||
|
return horizontal ? x : y;
|
||||||
|
}
|
||||||
|
|
||||||
|
function barContains(x: real, y: real, clamped = false): bool {
|
||||||
|
const extent = clamped ? barClamped : barExtent;
|
||||||
|
if (barOnTop)
|
||||||
|
return y < extent;
|
||||||
|
if (barOnBottom)
|
||||||
|
return y > win.height - extent;
|
||||||
|
return x < extent;
|
||||||
|
}
|
||||||
|
|
||||||
|
function insetBottom(border: real, clamped = false): real {
|
||||||
|
return barOnBottom ? (clamped ? barClamped : barExtent) : border;
|
||||||
|
}
|
||||||
|
|
||||||
|
function insetLeft(border: real, clamped = false): real {
|
||||||
|
return barOnLeft ? (clamped ? barClamped : barExtent) : border;
|
||||||
|
}
|
||||||
|
|
||||||
|
function insetTop(border: real, clamped = false): real {
|
||||||
|
return barOnTop ? (clamped ? barClamped : barExtent) : border;
|
||||||
|
}
|
||||||
|
|
||||||
|
function inwardDrag(dragX: real, dragY: real): real {
|
||||||
|
if (barOnTop)
|
||||||
|
return dragY;
|
||||||
|
if (barOnBottom)
|
||||||
|
return -dragY;
|
||||||
|
return dragX;
|
||||||
|
}
|
||||||
|
|
||||||
|
onConfigPositionChanged: {
|
||||||
|
if (!["left", "top", "bottom"].includes(configPosition))
|
||||||
|
console.warn(`Invalid bar position '${configPosition}', falling back to left`);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,19 +9,21 @@ Scope {
|
|||||||
id: root
|
id: root
|
||||||
|
|
||||||
required property Item bar
|
required property Item bar
|
||||||
|
required property EdgeGeometry geometry
|
||||||
required property ShellScreen screen
|
required property ShellScreen screen
|
||||||
|
|
||||||
ExclusionZone {
|
ExclusionZone {
|
||||||
id: top
|
id: top
|
||||||
|
|
||||||
anchors.top: true
|
anchors.top: true
|
||||||
exclusiveZone: root.bar.exclusiveZone
|
hasBar: root.geometry.barOnTop
|
||||||
}
|
}
|
||||||
|
|
||||||
ExclusionZone {
|
ExclusionZone {
|
||||||
id: left
|
id: left
|
||||||
|
|
||||||
anchors.left: true
|
anchors.left: true
|
||||||
|
hasBar: root.geometry.barOnLeft
|
||||||
}
|
}
|
||||||
|
|
||||||
ExclusionZone {
|
ExclusionZone {
|
||||||
@@ -34,6 +36,7 @@ Scope {
|
|||||||
id: bottom
|
id: bottom
|
||||||
|
|
||||||
anchors.bottom: true
|
anchors.bottom: true
|
||||||
|
hasBar: root.geometry.barOnBottom
|
||||||
}
|
}
|
||||||
|
|
||||||
Timer {
|
Timer {
|
||||||
@@ -44,7 +47,9 @@ Scope {
|
|||||||
}
|
}
|
||||||
|
|
||||||
component ExclusionZone: CustomWindow {
|
component ExclusionZone: CustomWindow {
|
||||||
exclusiveZone: Config.bar.border
|
property bool hasBar
|
||||||
|
|
||||||
|
exclusiveZone: hasBar ? root.bar.exclusiveZone : Config.bar.border
|
||||||
implicitHeight: 1
|
implicitHeight: 1
|
||||||
implicitWidth: 1
|
implicitWidth: 1
|
||||||
name: "Bar-Exclusion"
|
name: "Bar-Exclusion"
|
||||||
|
|||||||
+21
-12
@@ -12,6 +12,7 @@ Item {
|
|||||||
required property real borderThickness
|
required property real borderThickness
|
||||||
property bool dashboardShortcutActive
|
property bool dashboardShortcutActive
|
||||||
required property Drawing drawing
|
required property Drawing drawing
|
||||||
|
required property EdgeGeometry geometry
|
||||||
property bool osdShortcutActive
|
property bool osdShortcutActive
|
||||||
required property Panels panels
|
required property Panels panels
|
||||||
required property BarPopouts.Wrapper popouts
|
required property BarPopouts.Wrapper popouts
|
||||||
@@ -21,19 +22,26 @@ Item {
|
|||||||
required property PersistentProperties visibilities
|
required property PersistentProperties visibilities
|
||||||
|
|
||||||
function inBottomPanel(panel: Item, x: real, y: real): bool {
|
function inBottomPanel(panel: Item, x: real, y: real): bool {
|
||||||
return y > root.height - panel.height - Config.bar.border && withinPanelWidth(panel, x, y);
|
return y > root.height - panel.height - geometry.insetBottom(borderThickness) && withinPanelWidth(panel, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
function inLeftPanel(panel: Item, x: real, y: real): bool {
|
function inLeftPanel(panel: Item, x: real, y: real): bool {
|
||||||
return x < panel.x + panel.width + Config.bar.border && withinPanelHeight(panel, x, y);
|
return x < panel.x + panel.width + geometry.insetLeft(borderThickness) && withinPanelHeight(panel, x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
function inPopoutArea(x: real, y: real): bool {
|
||||||
|
const panel = panels.popoutsWrapper;
|
||||||
|
if (!geometry.horizontal)
|
||||||
|
return inLeftPanel(panel, x, y);
|
||||||
|
return withinPanelWidth(panel, x, y) && withinPanelHeight(panel, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
function inRightPanel(panel: Item, x: real, y: real): bool {
|
function inRightPanel(panel: Item, x: real, y: real): bool {
|
||||||
return x > panel.x - Config.bar.border && withinPanelHeight(panel, x, y);
|
return x > panel.x - geometry.insetLeft(borderThickness) && withinPanelHeight(panel, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
function inTopPanel(panel: Item, x: real, y: real): bool {
|
function inTopPanel(panel: Item, x: real, y: real): bool {
|
||||||
return y < bar.implicitHeight + panel.height && withinPanelWidth(panel, x, y);
|
return y < geometry.insetTop(borderThickness) + panel.height && withinPanelWidth(panel, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onWheel(event: WheelEvent): void {
|
function onWheel(event: WheelEvent): void {
|
||||||
@@ -43,12 +51,12 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function withinPanelHeight(panel: Item, x: real, y: real): bool {
|
function withinPanelHeight(panel: Item, x: real, y: real): bool {
|
||||||
const panelY = panel.y + bar.implicitHeight;
|
const panelY = panel.y + geometry.insetTop(borderThickness);
|
||||||
return y >= panelY && y <= panelY + panel.height;
|
return y >= panelY && y <= panelY + panel.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
function withinPanelWidth(panel: Item, x: real, y: real): bool {
|
function withinPanelWidth(panel: Item, x: real, y: real): bool {
|
||||||
const panelX = panel.x + root.borderThickness;
|
const panelX = panel.x + geometry.insetLeft(borderThickness);
|
||||||
return x >= panelX && x <= panelX + panel.width;
|
return x >= panelX && x <= panelX + panel.width;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,20 +89,21 @@ Item {
|
|||||||
if (root.singleGestureTriggered)
|
if (root.singleGestureTriggered)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (centroid.pressPosition.y < root.bar.implicitHeight) {
|
if (root.geometry.barContains(centroid.pressPosition.x, centroid.pressPosition.y, true)) {
|
||||||
if (dragY > 20) {
|
const barDrag = root.geometry.inwardDrag(dragX, dragY);
|
||||||
|
if (barDrag > 20) {
|
||||||
root.visibilities.settings = true;
|
root.visibilities.settings = true;
|
||||||
root.singleGestureTriggered = true;
|
root.singleGestureTriggered = true;
|
||||||
} else if (dragY < -20) {
|
} else if (barDrag < -20) {
|
||||||
root.visibilities.settings = false;
|
root.visibilities.settings = false;
|
||||||
root.singleGestureTriggered = true;
|
root.singleGestureTriggered = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (centroid.pressPosition.y > root.screen.height - Config.bar.border && centroid.pressPosition.x < root.screen.width / 5 && dragY < -50)
|
if (centroid.pressPosition.y > root.screen.height - root.geometry.insetBottom(root.borderThickness) && centroid.pressPosition.x < root.screen.width / 5 && dragY < -50)
|
||||||
root.visibilities.clipboard = true;
|
root.visibilities.clipboard = true;
|
||||||
|
|
||||||
if (!Config.dock.hoverToReveal && centroid.pressPosition.y > root.screen.height - root.bar.implicitHeight && centroid.pressPosition.x > root.screen.width / 5 && !root.visibilities.launcher)
|
if (!Config.dock.hoverToReveal && centroid.pressPosition.y > root.screen.height - root.geometry.insetTop(root.borderThickness) && centroid.pressPosition.x > root.screen.width / 5 && !root.visibilities.launcher)
|
||||||
if (dragY < -10) {
|
if (dragY < -10) {
|
||||||
root.visibilities.dock = true;
|
root.visibilities.dock = true;
|
||||||
root.singleGestureTriggered = true;
|
root.singleGestureTriggered = true;
|
||||||
@@ -193,7 +202,7 @@ Item {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!root.visibilities.bar && Config.bar.autoHide && y < root.bar.implicitHeight)
|
if (!root.visibilities.bar && Config.bar.autoHide && root.geometry.barContains(x, y, true))
|
||||||
root.bar.isHovered = true;
|
root.bar.isHovered = true;
|
||||||
|
|
||||||
if (root.panels.sidebar.offsetScale === 1) {
|
if (root.panels.sidebar.offsetScale === 1) {
|
||||||
|
|||||||
+32
-18
@@ -32,6 +32,7 @@ CustomWindow {
|
|||||||
return 100;
|
return 100;
|
||||||
}
|
}
|
||||||
property real fsTransitionProg: hasFullscreen ? 1 : 0
|
property real fsTransitionProg: hasFullscreen ? 1 : 0
|
||||||
|
readonly property alias geometry: geometry
|
||||||
readonly property bool hasFullscreen: {
|
readonly property bool hasFullscreen: {
|
||||||
if (hasSpecialWorkspace) {
|
if (hasSpecialWorkspace) {
|
||||||
const specialName = monitor?.lastIpcObject.specialWorkspace?.name;
|
const specialName = monitor?.lastIpcObject.specialWorkspace?.name;
|
||||||
@@ -94,13 +95,21 @@ CustomWindow {
|
|||||||
panels.popouts.hasCurrent = false;
|
panels.popouts.hasCurrent = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EdgeGeometry {
|
||||||
|
id: geometry
|
||||||
|
|
||||||
|
bar: bar
|
||||||
|
configPosition: Config.bar.position
|
||||||
|
win: root
|
||||||
|
}
|
||||||
|
|
||||||
Region {
|
Region {
|
||||||
id: emptyRegion
|
id: emptyRegion
|
||||||
|
|
||||||
height: panels.notifications.height
|
height: panels.notifications.height
|
||||||
width: panels.notifications.width
|
width: panels.notifications.width
|
||||||
x: panels.notifications.x + root.borderThickness
|
x: panels.notifications.x + geometry.insetLeft(root.borderThickness)
|
||||||
y: panels.notifications.y + bar.implicitHeight
|
y: panels.notifications.y + geometry.insetTop(root.borderThickness)
|
||||||
|
|
||||||
Region {
|
Region {
|
||||||
height: panels.osd.height
|
height: panels.osd.height
|
||||||
@@ -113,7 +122,7 @@ CustomWindow {
|
|||||||
Regions {
|
Regions {
|
||||||
id: regions
|
id: regions
|
||||||
|
|
||||||
bar: bar
|
geometry: geometry
|
||||||
panels: panels
|
panels: panels
|
||||||
win: root
|
win: root
|
||||||
}
|
}
|
||||||
@@ -192,10 +201,10 @@ CustomWindow {
|
|||||||
BlobInvertedRect {
|
BlobInvertedRect {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: -50
|
anchors.margins: -50
|
||||||
borderBottom: root.borderThickness - anchors.margins - root.sdfBorderOffset
|
borderBottom: geometry.insetBottom(root.borderThickness) - anchors.margins - root.sdfBorderOffset
|
||||||
borderLeft: root.borderThickness - anchors.margins - root.sdfBorderOffset
|
borderLeft: geometry.insetLeft(root.borderThickness) - anchors.margins - root.sdfBorderOffset
|
||||||
borderRight: root.borderThickness - anchors.margins - root.sdfBorderOffset
|
borderRight: root.borderThickness - anchors.margins - root.sdfBorderOffset
|
||||||
borderTop: bar.implicitHeight - anchors.margins - root.sdfBorderOffset
|
borderTop: geometry.insetTop(root.borderThickness) - anchors.margins - root.sdfBorderOffset
|
||||||
group: blobGroup
|
group: blobGroup
|
||||||
radius: root.borderRounding
|
radius: root.borderRounding
|
||||||
}
|
}
|
||||||
@@ -211,7 +220,7 @@ CustomWindow {
|
|||||||
panel: panels.dashboardWrapper
|
panel: panels.dashboardWrapper
|
||||||
radius: Appearance.rounding.normal
|
radius: Appearance.rounding.normal
|
||||||
x: panels.dashboardWrapper.x + panels.dashboard.x + root.borderThickness
|
x: panels.dashboardWrapper.x + panels.dashboard.x + root.borderThickness
|
||||||
y: panels.dashboardWrapper.y + panels.dashboard.y + bar.implicitHeight - panels.dashboard.height * extraHeight
|
y: panels.dashboardWrapper.y + panels.dashboard.y + geometry.insetTop(root.borderThickness) - panels.dashboard.height * extraHeight
|
||||||
}
|
}
|
||||||
|
|
||||||
PanelBg {
|
PanelBg {
|
||||||
@@ -244,8 +253,7 @@ CustomWindow {
|
|||||||
implicitWidth: panels.osd.width
|
implicitWidth: panels.osd.width
|
||||||
panel: panels.osdWrapper
|
panel: panels.osdWrapper
|
||||||
radius: 20
|
radius: 20
|
||||||
x: panels.osdWrapper.x + panels.osd.x + root.borderThickness
|
x: panels.osdWrapper.x + panels.osd.x + geometry.insetLeft(root.borderThickness)
|
||||||
y: panels.osdWrapper.y + panels.osd.y + bar.implicitHeight
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PanelBg {
|
PanelBg {
|
||||||
@@ -267,17 +275,17 @@ CustomWindow {
|
|||||||
PanelBg {
|
PanelBg {
|
||||||
id: popoutBg
|
id: popoutBg
|
||||||
|
|
||||||
property real extraHeight: 0.2
|
property real extraExtent: 0.2
|
||||||
|
|
||||||
deformAmount: panels.popouts.currentName.startsWith("traymenu") ? 0.15 : 0.08
|
deformAmount: panels.popouts.currentName.startsWith("traymenu") ? 0.15 : 0.08
|
||||||
implicitHeight: panels.popouts.height * (1 + extraHeight)
|
implicitHeight: panels.popouts.height * (geometry.horizontal ? 1 + extraExtent : 1)
|
||||||
implicitWidth: panels.popouts.width
|
implicitWidth: panels.popouts.width * (geometry.horizontal ? 1 : 1 + extraExtent)
|
||||||
panel: panels.popoutsWrapper
|
panel: panels.popoutsWrapper
|
||||||
radius: panels.popouts.current?.panelRadius ?? Appearance.rounding.normal
|
radius: panels.popouts.current?.panelRadius ?? Appearance.rounding.normal
|
||||||
x: panels.popoutsWrapper.x + panels.popouts.x + root.borderThickness
|
x: panels.popoutsWrapper.x + panels.popouts.x + geometry.insetLeft(root.borderThickness) - (geometry.horizontal ? 0 : panels.popouts.width * extraExtent)
|
||||||
y: panels.popoutsWrapper.y + panels.popouts.y + bar.implicitHeight - panels.popouts.height * extraHeight
|
y: panels.popoutsWrapper.y + panels.popouts.y + geometry.insetTop(root.borderThickness) - (geometry.barOnTop ? panels.popouts.height * extraExtent : 0)
|
||||||
|
|
||||||
Behavior on extraHeight {
|
Behavior on extraExtent {
|
||||||
Anim {
|
Anim {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -370,6 +378,7 @@ CustomWindow {
|
|||||||
borderThickness: root.borderLayoutThickness
|
borderThickness: root.borderLayoutThickness
|
||||||
drawing: drawing
|
drawing: drawing
|
||||||
enabled: true
|
enabled: true
|
||||||
|
geometry: geometry
|
||||||
panels: panels
|
panels: panels
|
||||||
popouts: panels.popouts
|
popouts: panels.popouts
|
||||||
screen: root.screen
|
screen: root.screen
|
||||||
@@ -381,6 +390,7 @@ CustomWindow {
|
|||||||
bar: bar
|
bar: bar
|
||||||
borderThickness: root.borderThickness
|
borderThickness: root.borderThickness
|
||||||
drawingItem: drawing
|
drawingItem: drawing
|
||||||
|
geometry: geometry
|
||||||
screen: root.screen
|
screen: root.screen
|
||||||
visibilities: visibilities
|
visibilities: visibilities
|
||||||
|
|
||||||
@@ -422,14 +432,18 @@ CustomWindow {
|
|||||||
BarLoader {
|
BarLoader {
|
||||||
id: bar
|
id: bar
|
||||||
|
|
||||||
|
anchors.bottom: geometry.barOnBottom ? parent.bottom : undefined
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.top: geometry.barOnBottom ? undefined : parent.top
|
||||||
enabled: !visibilities.isDrawing
|
enabled: !visibilities.isDrawing
|
||||||
fullscreen: root.hasFullscreen
|
fullscreen: root.hasFullscreen
|
||||||
|
height: geometry.horizontal ? implicitHeight : parent.height
|
||||||
popouts: panels.popouts
|
popouts: panels.popouts
|
||||||
popoutsWrapper: panels.popoutsWrapper
|
popoutsWrapper: panels.popoutsWrapper
|
||||||
|
position: geometry.position
|
||||||
screen: root.screen
|
screen: root.screen
|
||||||
visibilities: visibilities
|
visibilities: visibilities
|
||||||
|
width: geometry.horizontal ? parent.width : implicitWidth
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -442,7 +456,7 @@ CustomWindow {
|
|||||||
implicitHeight: panel.height
|
implicitHeight: panel.height
|
||||||
implicitWidth: panel.width
|
implicitWidth: panel.width
|
||||||
radius: Appearance.rounding.smallest
|
radius: Appearance.rounding.smallest
|
||||||
x: panel.x + root.borderThickness
|
x: panel.x + geometry.insetLeft(root.borderThickness)
|
||||||
y: panel.y + bar.implicitHeight
|
y: panel.y + geometry.insetTop(root.borderThickness)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+38
-17
@@ -9,18 +9,24 @@ import qs.Modules.SysTray
|
|||||||
import qs.Modules.Network
|
import qs.Modules.Network
|
||||||
import qs.Modules.Updates
|
import qs.Modules.Updates
|
||||||
|
|
||||||
RowLayout {
|
GridLayout {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
required property bool fullscreen
|
required property bool fullscreen
|
||||||
|
required property bool horizontal
|
||||||
required property Wrapper popouts
|
required property Wrapper popouts
|
||||||
required property ClipWrapper popoutsWrapper
|
required property ClipWrapper popoutsWrapper
|
||||||
required property ShellScreen screen
|
required property ShellScreen screen
|
||||||
readonly property int vPadding: 6
|
readonly property int vPadding: 6
|
||||||
required property PersistentProperties visibilities
|
required property PersistentProperties visibilities
|
||||||
|
|
||||||
function checkPopout(x: real): void {
|
function axisCenterOf(item: Item): real {
|
||||||
const ch = childAt(x, height / 2) as EntryWrapper;
|
const c = item.mapToItem(root, item.implicitWidth / 2, item.implicitHeight / 2);
|
||||||
|
return horizontal ? c.x : c.y;
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkPopout(pos: real): void {
|
||||||
|
const ch = (horizontal ? childAt(pos, height / 2) : childAt(width / 2, pos)) as EntryWrapper;
|
||||||
const id = ch?.entryId;
|
const id = ch?.entryId;
|
||||||
|
|
||||||
if (!ch || id === undefined) {
|
if (!ch || id === undefined) {
|
||||||
@@ -34,26 +40,21 @@ RowLayout {
|
|||||||
|
|
||||||
if (id === "statusIcons" && Config.bar.popouts.statusIcons) {
|
if (id === "statusIcons" && Config.bar.popouts.statusIcons) {
|
||||||
const items = (ch.item as StatusIcons).items;
|
const items = (ch.item as StatusIcons).items;
|
||||||
const localX = mapToItem(items, x, 0).x;
|
const icon = horizontal ? items.childAt(mapToItem(items, pos, 0).x, items.height / 2) : items.childAt(items.width / 2, mapToItem(items, 0, pos).y);
|
||||||
const icon = items.childAt(localX, items.height / 2);
|
|
||||||
if (icon) {
|
if (icon) {
|
||||||
popouts.currentName = icon.name;
|
popouts.currentName = icon.name;
|
||||||
popouts.currentCenter = Qt.binding(() => icon.mapToItem(root, icon.implicitWidth / 2, 0).x);
|
popouts.currentCenter = Qt.binding(() => axisCenterOf(icon));
|
||||||
popouts.hasCurrent = true;
|
popouts.hasCurrent = true;
|
||||||
}
|
}
|
||||||
} else if (id === "tray" && Config.bar.popouts.tray && Config.bar.tray.showOnHover) {
|
} else if (id === "tray" && Config.bar.popouts.tray && Config.bar.tray.showOnHover) {
|
||||||
const tray = ch.item as TrayIcons;
|
const tray = ch.item as TrayIcons;
|
||||||
const layout = tray.layout;
|
const layout = tray.layout;
|
||||||
const localX = mapToItem(layout, x, 0).x;
|
const trayItem = horizontal ? layout.childAt(mapToItem(layout, pos, 0).x, layout.height / 2) : layout.childAt(items.width / 2, mapToItem(layout, 0, pos).y);
|
||||||
const trayItem = layout.childAt(localX, layout.height / 2);
|
|
||||||
|
|
||||||
if (trayItem) {
|
if (trayItem) {
|
||||||
const idx = trayItem.index;
|
const idx = trayItem.index;
|
||||||
popouts.currentName = `traymenu${idx}`;
|
popouts.currentName = `traymenu${idx}`;
|
||||||
popouts.currentCenter = Qt.binding(() => {
|
popouts.currentCenter = Qt.binding(() => axisCenterOf(trayItem));
|
||||||
const it = tray.items.itemAt(idx);
|
|
||||||
return it ? it.mapToItem(root, it.implicitWidth / 2, 0).x : popouts.currentCenter;
|
|
||||||
});
|
|
||||||
popouts.hasCurrent = true;
|
popouts.hasCurrent = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,12 +64,19 @@ RowLayout {
|
|||||||
|
|
||||||
if (id === "updates") {
|
if (id === "updates") {
|
||||||
popouts.currentName = "updates";
|
popouts.currentName = "updates";
|
||||||
popouts.currentCenter = Qt.binding(() => ch.item.mapToItem(root, (ch.item as Item).implicitWidth / 2, 0).x);
|
popouts.currentCenter = Qt.binding(() => axisCenterOf(ch.item as Item));
|
||||||
popouts.hasCurrent = true;
|
popouts.hasCurrent = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
spacing: Appearance.spacing.small
|
function entryAt(pos: real): string {
|
||||||
|
const ch = (horizontal ? childAt(pos, height / 2) : childAt(width / 2, pos)) as EntryWrapper;
|
||||||
|
return ch?.entryId ?? "";
|
||||||
|
}
|
||||||
|
|
||||||
|
columnSpacing: Appearance.spacing.small
|
||||||
|
columns: horizontal ? -1 : 1
|
||||||
|
rowSpacing: Appearance.spacing.small
|
||||||
|
|
||||||
Repeater {
|
Repeater {
|
||||||
id: repeater
|
id: repeater
|
||||||
@@ -94,7 +102,8 @@ RowLayout {
|
|||||||
roleValue: "spacer"
|
roleValue: "spacer"
|
||||||
|
|
||||||
delegate: EntryWrapper {
|
delegate: EntryWrapper {
|
||||||
Layout.fillWidth: true
|
Layout.fillHeight: !root.horizontal
|
||||||
|
Layout.fillWidth: root.horizontal
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -103,6 +112,7 @@ RowLayout {
|
|||||||
|
|
||||||
delegate: EntryWrapper {
|
delegate: EntryWrapper {
|
||||||
Workspaces {
|
Workspaces {
|
||||||
|
horizontal: root.horizontal
|
||||||
screen: root.screen
|
screen: root.screen
|
||||||
visible: !root.fullscreen
|
visible: !root.fullscreen
|
||||||
}
|
}
|
||||||
@@ -114,6 +124,7 @@ RowLayout {
|
|||||||
|
|
||||||
delegate: EntryWrapper {
|
delegate: EntryWrapper {
|
||||||
TrayIcons {
|
TrayIcons {
|
||||||
|
horizontal: root.horizontal
|
||||||
loader: root
|
loader: root
|
||||||
popouts: root.popouts
|
popouts: root.popouts
|
||||||
visible: !root.fullscreen
|
visible: !root.fullscreen
|
||||||
@@ -126,6 +137,7 @@ RowLayout {
|
|||||||
|
|
||||||
delegate: EntryWrapper {
|
delegate: EntryWrapper {
|
||||||
StatusIcons {
|
StatusIcons {
|
||||||
|
horizontal: root.horizontal
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -135,6 +147,7 @@ RowLayout {
|
|||||||
|
|
||||||
delegate: EntryWrapper {
|
delegate: EntryWrapper {
|
||||||
Resources {
|
Resources {
|
||||||
|
horizontal: root.horizontal
|
||||||
visibilities: root.visibilities
|
visibilities: root.visibilities
|
||||||
visible: !root.fullscreen
|
visible: !root.fullscreen
|
||||||
}
|
}
|
||||||
@@ -146,6 +159,7 @@ RowLayout {
|
|||||||
|
|
||||||
delegate: EntryWrapper {
|
delegate: EntryWrapper {
|
||||||
UpdatesWidget {
|
UpdatesWidget {
|
||||||
|
horizontal: root.horizontal
|
||||||
visible: !root.fullscreen
|
visible: !root.fullscreen
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -156,6 +170,7 @@ RowLayout {
|
|||||||
|
|
||||||
delegate: EntryWrapper {
|
delegate: EntryWrapper {
|
||||||
NotifBell {
|
NotifBell {
|
||||||
|
horizontal: root.horizontal
|
||||||
popouts: root.popouts
|
popouts: root.popouts
|
||||||
visibilities: root.visibilities
|
visibilities: root.visibilities
|
||||||
visible: !root.fullscreen
|
visible: !root.fullscreen
|
||||||
@@ -168,6 +183,7 @@ RowLayout {
|
|||||||
|
|
||||||
delegate: EntryWrapper {
|
delegate: EntryWrapper {
|
||||||
Clock {
|
Clock {
|
||||||
|
horizontal: root.horizontal
|
||||||
loader: root
|
loader: root
|
||||||
popouts: root.popouts
|
popouts: root.popouts
|
||||||
visibilities: root.visibilities
|
visibilities: root.visibilities
|
||||||
@@ -182,6 +198,7 @@ RowLayout {
|
|||||||
delegate: EntryWrapper {
|
delegate: EntryWrapper {
|
||||||
WindowTitle {
|
WindowTitle {
|
||||||
bar: root
|
bar: root
|
||||||
|
horizontal: root.horizontal
|
||||||
visible: !root.fullscreen
|
visible: !root.fullscreen
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -192,6 +209,7 @@ RowLayout {
|
|||||||
|
|
||||||
delegate: EntryWrapper {
|
delegate: EntryWrapper {
|
||||||
NetworkWidget {
|
NetworkWidget {
|
||||||
|
horizontal: root.horizontal
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -201,6 +219,7 @@ RowLayout {
|
|||||||
|
|
||||||
delegate: EntryWrapper {
|
delegate: EntryWrapper {
|
||||||
MediaWidget {
|
MediaWidget {
|
||||||
|
horizontal: root.horizontal
|
||||||
visible: !root.fullscreen
|
visible: !root.fullscreen
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -215,8 +234,10 @@ RowLayout {
|
|||||||
required property var modelData
|
required property var modelData
|
||||||
|
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
Layout.leftMargin: index === 0 ? root.vPadding : (entryId === "statusIcons") ? -root.spacing + Appearance.spacing.extraSmall : 0
|
Layout.bottomMargin: !root.horizontal && index === repeater.count - 1 ? root.vPadding : 0
|
||||||
Layout.rightMargin: index === repeater.count - 1 ? root.vPadding : 0
|
Layout.leftMargin: root.horizontal && index === 0 ? root.vPadding : (entryId === "statusIcons") ? -root.rowSpacing + Appearance.spacing.extraSmall : 0
|
||||||
|
Layout.rightMargin: root.horizontal && index === repeater.count - 1 ? root.vPadding : 0
|
||||||
|
Layout.topMargin: !root.horizontal && index === 0 ? root.vPadding : (entryId === "statusIcons") ? -root.columnSpacing + Appearance.spacing.extraSmall : 0
|
||||||
children: item
|
children: item
|
||||||
implicitHeight: item?.implicitHeight ?? 0
|
implicitHeight: item?.implicitHeight ?? 0
|
||||||
implicitWidth: item?.implicitWidth ?? 0
|
implicitWidth: item?.implicitWidth ?? 0
|
||||||
|
|||||||
+24
-11
@@ -15,31 +15,40 @@ import qs.Modules.Network
|
|||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
readonly property int contentHeight: Config.bar.height + padding * 2
|
readonly property int clampedExtent: Math.max(Config.bar.border, extent)
|
||||||
readonly property int exclusiveZone: Config.bar.autoHide ? Config.bar.border : contentHeight
|
readonly property int contentThickness: Config.bar.height + padding * 2
|
||||||
|
readonly property int exclusiveZone: Config.bar.autoHide ? Config.bar.border : contentThickness
|
||||||
|
property real extent: fullscreen ? 0 : Config.bar.border
|
||||||
required property bool fullscreen
|
required property bool fullscreen
|
||||||
|
readonly property bool horizontal: position !== "left"
|
||||||
property bool isHovered
|
property bool isHovered
|
||||||
readonly property int padding: Math.max(Appearance.padding.smaller, Config.bar.border)
|
readonly property int padding: Math.max(Appearance.padding.smaller, Config.bar.border)
|
||||||
required property Wrapper popouts
|
required property Wrapper popouts
|
||||||
required property ClipWrapper popoutsWrapper
|
required property ClipWrapper popoutsWrapper
|
||||||
|
required property string position
|
||||||
required property ShellScreen screen
|
required property ShellScreen screen
|
||||||
readonly property bool shouldBeVisible: !fullscreen && (!Config.bar.autoHide || visibilities.bar || isHovered)
|
readonly property bool shouldBeVisible: !fullscreen && (!Config.bar.autoHide || visibilities.bar || isHovered)
|
||||||
readonly property int vPadding: 6
|
readonly property int vPadding: 6
|
||||||
required property PersistentProperties visibilities
|
required property PersistentProperties visibilities
|
||||||
|
|
||||||
function checkPopout(x: real): void {
|
function checkPopout(pos: real): void {
|
||||||
content.item?.checkPopout(x);
|
(content.item as Bar)?.checkPopout(pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
implicitHeight: fullscreen ? 0 : Config.bar.border
|
function entryAt(pos: real): string {
|
||||||
visible: height > Config.bar.border
|
return (content.item as Bar)?.entryAt(pos) ?? "";
|
||||||
|
}
|
||||||
|
|
||||||
|
implicitHeight: extent
|
||||||
|
implicitWidth: extent
|
||||||
|
visible: extent > Config.bar.border
|
||||||
|
|
||||||
states: State {
|
states: State {
|
||||||
name: "visible"
|
name: "visible"
|
||||||
when: root.shouldBeVisible
|
when: root.shouldBeVisible
|
||||||
|
|
||||||
PropertyChanges {
|
PropertyChanges {
|
||||||
root.implicitHeight: root.contentHeight
|
root.extent: root.contentThickness
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
transitions: [
|
transitions: [
|
||||||
@@ -50,7 +59,7 @@ Item {
|
|||||||
Anim {
|
Anim {
|
||||||
duration: MaterialEasing.expressiveEffectsTime
|
duration: MaterialEasing.expressiveEffectsTime
|
||||||
easing.bezierCurve: MaterialEasing.expressiveEffects
|
easing.bezierCurve: MaterialEasing.expressiveEffects
|
||||||
property: "implicitHeight"
|
property: "extent"
|
||||||
target: root
|
target: root
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -61,7 +70,7 @@ Item {
|
|||||||
Anim {
|
Anim {
|
||||||
duration: MaterialEasing.expressiveEffectsTime
|
duration: MaterialEasing.expressiveEffectsTime
|
||||||
easing.bezierCurve: MaterialEasing.expressiveEffects
|
easing.bezierCurve: MaterialEasing.expressiveEffects
|
||||||
property: "implicitHeight"
|
property: "extent"
|
||||||
target: root
|
target: root
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -71,13 +80,17 @@ Item {
|
|||||||
id: content
|
id: content
|
||||||
|
|
||||||
active: root.shouldBeVisible || root.visible
|
active: root.shouldBeVisible || root.visible
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: root.position !== "bottom" ? parent.bottom : undefined
|
||||||
anchors.left: parent.left
|
anchors.left: root.horizontal ? parent.left : undefined
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
|
anchors.top: root.position !== "top" ? parent.top : undefined
|
||||||
|
height: root.contentThickness
|
||||||
|
width: root.contentThickness
|
||||||
|
|
||||||
sourceComponent: Bar {
|
sourceComponent: Bar {
|
||||||
fullscreen: root.fullscreen
|
fullscreen: root.fullscreen
|
||||||
height: root.contentHeight
|
height: root.contentHeight
|
||||||
|
horizontal: root.horizontal
|
||||||
popouts: root.popouts
|
popouts: root.popouts
|
||||||
popoutsWrapper: root.popoutsWrapper
|
popoutsWrapper: root.popoutsWrapper
|
||||||
screen: root.screen
|
screen: root.screen
|
||||||
|
|||||||
Reference in New Issue
Block a user