popouts: fix multimonitor
This commit is contained in:
parent
5d2f46082a
commit
fc4eff7271
7 changed files with 47 additions and 46 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
import "root:/widgets"
|
import "root:/widgets"
|
||||||
import "root:/services"
|
import "root:/services"
|
||||||
import "root:/config"
|
import "root:/config"
|
||||||
|
import "root:/modules/bar/popouts" as BarPopouts
|
||||||
import "components"
|
import "components"
|
||||||
import "components/workspaces"
|
import "components/workspaces"
|
||||||
import Quickshell
|
import Quickshell
|
||||||
|
|
@ -10,6 +11,7 @@ Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
required property ShellScreen screen
|
required property ShellScreen screen
|
||||||
|
required property BarPopouts.Wrapper popouts
|
||||||
|
|
||||||
function checkPopout(y: real): void {
|
function checkPopout(y: real): void {
|
||||||
const spacing = Appearance.spacing.small;
|
const spacing = Appearance.spacing.small;
|
||||||
|
|
@ -30,30 +32,30 @@ Item {
|
||||||
const by = statusIcons.y + statusIconsInner.y + b.y - spacing / 2;
|
const by = statusIcons.y + statusIconsInner.y + b.y - spacing / 2;
|
||||||
|
|
||||||
if (y >= awy && y <= awy + aw.implicitHeight) {
|
if (y >= awy && y <= awy + aw.implicitHeight) {
|
||||||
Popouts.currentName = "activewindow";
|
popouts.currentName = "activewindow";
|
||||||
Popouts.currentCenter = Qt.binding(() => activeWindow.y + aw.y + aw.implicitHeight / 2);
|
popouts.currentCenter = Qt.binding(() => activeWindow.y + aw.y + aw.implicitHeight / 2);
|
||||||
Popouts.hasCurrent = true;
|
popouts.hasCurrent = true;
|
||||||
} else if (y > ty && y < ty + th) {
|
} else if (y > ty && y < ty + th) {
|
||||||
const index = Math.floor(((y - ty) / th) * trayItems.count);
|
const index = Math.floor(((y - ty) / th) * trayItems.count);
|
||||||
const item = trayItems.itemAt(index);
|
const item = trayItems.itemAt(index);
|
||||||
|
|
||||||
Popouts.currentName = `traymenu${index}`;
|
popouts.currentName = `traymenu${index}`;
|
||||||
Popouts.currentCenter = Qt.binding(() => tray.y + item.y + item.implicitHeight / 2);
|
popouts.currentCenter = Qt.binding(() => tray.y + item.y + item.implicitHeight / 2);
|
||||||
Popouts.hasCurrent = true;
|
popouts.hasCurrent = true;
|
||||||
} else if (y >= ny && y <= ny + n.implicitHeight + spacing) {
|
} else if (y >= ny && y <= ny + n.implicitHeight + spacing) {
|
||||||
Popouts.currentName = "network";
|
popouts.currentName = "network";
|
||||||
Popouts.currentCenter = Qt.binding(() => statusIcons.y + statusIconsInner.y + n.y + n.implicitHeight / 2);
|
popouts.currentCenter = Qt.binding(() => statusIcons.y + statusIconsInner.y + n.y + n.implicitHeight / 2);
|
||||||
Popouts.hasCurrent = true;
|
popouts.hasCurrent = true;
|
||||||
} else if (y >= bls && y <= ble) {
|
} else if (y >= bls && y <= ble) {
|
||||||
Popouts.currentName = "bluetooth";
|
popouts.currentName = "bluetooth";
|
||||||
Popouts.currentCenter = Qt.binding(() => statusIcons.y + statusIconsInner.y + statusIconsInner.bs + (statusIconsInner.be - statusIconsInner.bs) / 2);
|
popouts.currentCenter = Qt.binding(() => statusIcons.y + statusIconsInner.y + statusIconsInner.bs + (statusIconsInner.be - statusIconsInner.bs) / 2);
|
||||||
Popouts.hasCurrent = true;
|
popouts.hasCurrent = true;
|
||||||
} else if (y >= by && y <= by + b.implicitHeight + spacing) {
|
} else if (y >= by && y <= by + b.implicitHeight + spacing) {
|
||||||
Popouts.currentName = "battery";
|
popouts.currentName = "battery";
|
||||||
Popouts.currentCenter = Qt.binding(() => statusIcons.y + statusIconsInner.y + b.y + b.implicitHeight / 2);
|
popouts.currentCenter = Qt.binding(() => statusIcons.y + statusIconsInner.y + b.y + b.implicitHeight / 2);
|
||||||
Popouts.hasCurrent = true;
|
popouts.hasCurrent = true;
|
||||||
} else {
|
} else {
|
||||||
Popouts.hasCurrent = false;
|
popouts.hasCurrent = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,9 +11,23 @@ Item {
|
||||||
|
|
||||||
required property ShellScreen screen
|
required property ShellScreen screen
|
||||||
|
|
||||||
|
property string currentName
|
||||||
|
property real currentCenter
|
||||||
|
property bool hasCurrent
|
||||||
|
|
||||||
|
Behavior on currentCenter {
|
||||||
|
enabled: root.hasCurrent
|
||||||
|
|
||||||
|
NumberAnimation {
|
||||||
|
duration: Appearance.anim.durations.normal
|
||||||
|
easing.type: Easing.BezierSpline
|
||||||
|
easing.bezierCurve: Appearance.anim.curves.emphasized
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
|
|
||||||
implicitWidth: Popouts.hasCurrent ? (content.children.find(c => c.shouldBeActive)?.implicitWidth ?? 0) + Appearance.padding.large * 2 : 0
|
implicitWidth: root.hasCurrent ? (content.children.find(c => c.shouldBeActive)?.implicitWidth ?? 0) + Appearance.padding.large * 2 : 0
|
||||||
implicitHeight: (content.children.find(c => c.shouldBeActive)?.implicitHeight ?? 0) + Appearance.padding.large * 2
|
implicitHeight: (content.children.find(c => c.shouldBeActive)?.implicitHeight ?? 0) + Appearance.padding.large * 2
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
|
|
@ -70,7 +84,7 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
Behavior on implicitHeight {
|
Behavior on implicitHeight {
|
||||||
enabled: Popouts.hasCurrent
|
enabled: root.hasCurrent
|
||||||
|
|
||||||
Anim {
|
Anim {
|
||||||
easing.bezierCurve: Appearance.anim.curves.emphasized
|
easing.bezierCurve: Appearance.anim.curves.emphasized
|
||||||
|
|
@ -81,7 +95,7 @@ Item {
|
||||||
id: popout
|
id: popout
|
||||||
|
|
||||||
required property string name
|
required property string name
|
||||||
property bool shouldBeActive: Popouts.currentName === name
|
property bool shouldBeActive: root.currentName === name
|
||||||
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,10 @@ Item {
|
||||||
|
|
||||||
required property ShellScreen screen
|
required property ShellScreen screen
|
||||||
|
|
||||||
|
property alias currentName: content.currentName
|
||||||
|
property alias currentCenter: content.currentCenter
|
||||||
|
property alias hasCurrent: content.hasCurrent
|
||||||
|
|
||||||
visible: width > 0 && height > 0
|
visible: width > 0 && height > 0
|
||||||
|
|
||||||
implicitWidth: content.implicitWidth
|
implicitWidth: content.implicitWidth
|
||||||
|
|
|
||||||
|
|
@ -117,6 +117,7 @@ Variants {
|
||||||
|
|
||||||
Interactions {
|
Interactions {
|
||||||
screen: scope.modelData
|
screen: scope.modelData
|
||||||
|
popouts: panels.popouts
|
||||||
visibilities: visibilities
|
visibilities: visibilities
|
||||||
panels: panels
|
panels: panels
|
||||||
bar: bar
|
bar: bar
|
||||||
|
|
@ -134,6 +135,7 @@ Variants {
|
||||||
id: bar
|
id: bar
|
||||||
|
|
||||||
screen: scope.modelData
|
screen: scope.modelData
|
||||||
|
popouts: panels.popouts
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import "root:/services"
|
import "root:/services"
|
||||||
import "root:/config"
|
import "root:/config"
|
||||||
|
import "root:/modules/bar/popouts" as BarPopouts
|
||||||
import "root:/modules/osd" as Osd
|
import "root:/modules/osd" as Osd
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import QtQuick
|
import QtQuick
|
||||||
|
|
@ -8,6 +9,7 @@ MouseArea {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
required property ShellScreen screen
|
required property ShellScreen screen
|
||||||
|
required property BarPopouts.Wrapper popouts
|
||||||
required property PersistentProperties visibilities
|
required property PersistentProperties visibilities
|
||||||
required property Panels panels
|
required property Panels panels
|
||||||
required property Item bar
|
required property Item bar
|
||||||
|
|
@ -38,7 +40,7 @@ MouseArea {
|
||||||
visibilities.osd = false;
|
visibilities.osd = false;
|
||||||
osdHovered = false;
|
osdHovered = false;
|
||||||
visibilities.dashboard = false;
|
visibilities.dashboard = false;
|
||||||
Popouts.hasCurrent = false;
|
popouts.hasCurrent = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -68,9 +70,9 @@ MouseArea {
|
||||||
bar.checkPopout(y);
|
bar.checkPopout(y);
|
||||||
else
|
else
|
||||||
// Keep on hover
|
// Keep on hover
|
||||||
Popouts.hasCurrent = withinPanelHeight(popout, x, y);
|
popouts.hasCurrent = withinPanelHeight(popout, x, y);
|
||||||
} else
|
} else
|
||||||
Popouts.hasCurrent = false;
|
popouts.hasCurrent = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Osd.Interactions {
|
Osd.Interactions {
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ Item {
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.verticalCenter: parent.top
|
anchors.verticalCenter: parent.top
|
||||||
anchors.verticalCenterOffset: {
|
anchors.verticalCenterOffset: {
|
||||||
const off = Popouts.currentCenter - BorderConfig.thickness;
|
const off = root.popouts.currentCenter - BorderConfig.thickness;
|
||||||
const diff = root.height - Math.floor(off + implicitHeight / 2);
|
const diff = root.height - Math.floor(off + implicitHeight / 2);
|
||||||
if (diff < 0)
|
if (diff < 0)
|
||||||
return off + diff;
|
return off + diff;
|
||||||
|
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
pragma Singleton
|
|
||||||
|
|
||||||
import "root:/config"
|
|
||||||
import Quickshell
|
|
||||||
import QtQuick
|
|
||||||
|
|
||||||
Singleton {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
property string currentName
|
|
||||||
property real currentCenter
|
|
||||||
property bool hasCurrent
|
|
||||||
|
|
||||||
Behavior on currentCenter {
|
|
||||||
enabled: root.hasCurrent
|
|
||||||
|
|
||||||
NumberAnimation {
|
|
||||||
duration: Appearance.anim.durations.normal
|
|
||||||
easing.type: Easing.BezierSpline
|
|
||||||
easing.bezierCurve: Appearance.anim.curves.emphasized
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Add table
Reference in a new issue