drawers: dont use hyprland cursor pos
Use mousearea with positionChanged and containsMouse
This commit is contained in:
parent
c2ee9a52bd
commit
7d1ee06807
3 changed files with 27 additions and 41 deletions
|
|
@ -116,6 +116,7 @@ Variants {
|
||||||
Interactions {
|
Interactions {
|
||||||
screen: scope.modelData
|
screen: scope.modelData
|
||||||
visibilities: visibilities
|
visibilities: visibilities
|
||||||
|
panels: panels
|
||||||
|
|
||||||
Panels {
|
Panels {
|
||||||
id: panels
|
id: panels
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ MouseArea {
|
||||||
|
|
||||||
required property ShellScreen screen
|
required property ShellScreen screen
|
||||||
required property PersistentProperties visibilities
|
required property PersistentProperties visibilities
|
||||||
|
required property Panels panels
|
||||||
|
|
||||||
property bool osdHovered
|
property bool osdHovered
|
||||||
property point dragStart
|
property point dragStart
|
||||||
|
|
@ -31,35 +32,32 @@ MouseArea {
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
|
|
||||||
onPressed: event => dragStart = Qt.point(event.x, event.y)
|
onPressed: event => dragStart = Qt.point(event.x, event.y)
|
||||||
|
onContainsMouseChanged: {
|
||||||
|
if (!containsMouse) {
|
||||||
|
visibilities.osd = false;
|
||||||
|
osdHovered = false;
|
||||||
|
visibilities.dashboard = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Connections {
|
onPositionChanged: ({x, y}) => {
|
||||||
target: Hyprland
|
|
||||||
|
|
||||||
function onCursorPosChanged(): void {
|
|
||||||
let {
|
|
||||||
x,
|
|
||||||
y
|
|
||||||
} = Hyprland.cursorPos;
|
|
||||||
x -= QsWindow.window.margins.left + Hyprland.focusedMonitor.x;
|
|
||||||
y -= QsWindow.window.margins.top + Hyprland.focusedMonitor.y;
|
|
||||||
|
|
||||||
// Show osd on hover
|
// Show osd on hover
|
||||||
const showOsd = root.inRightPanel(panels.osd, x, y);
|
const showOsd = inRightPanel(panels.osd, x, y);
|
||||||
root.visibilities.osd = showOsd;
|
visibilities.osd = showOsd;
|
||||||
root.osdHovered = showOsd;
|
osdHovered = showOsd;
|
||||||
|
|
||||||
// Show/hide session on drag
|
// Show/hide session on drag
|
||||||
if (root.pressed && root.withinPanelHeight(panels.session, x, y)) {
|
if (pressed && withinPanelHeight(panels.session, x, y)) {
|
||||||
const dragX = x - root.dragStart.x;
|
const dragX = x - dragStart.x;
|
||||||
if (dragX < -SessionConfig.dragThreshold)
|
if (dragX < -SessionConfig.dragThreshold)
|
||||||
root.visibilities.session = true;
|
visibilities.session = true;
|
||||||
else if (dragX > SessionConfig.dragThreshold)
|
else if (dragX > SessionConfig.dragThreshold)
|
||||||
root.visibilities.session = false;
|
visibilities.session = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Show dashboard on hover
|
||||||
const showDashboard = root.inTopPanel(panels.dashboard, x, y);
|
const showDashboard = root.inTopPanel(panels.dashboard, x, y);
|
||||||
root.visibilities.dashboard = showDashboard;
|
visibilities.dashboard = showDashboard;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Osd.Interactions {
|
Osd.Interactions {
|
||||||
|
|
|
||||||
|
|
@ -39,19 +39,6 @@ Singleton {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FrameAnimation {
|
|
||||||
running: true
|
|
||||||
onTriggered: getCursorPos.running = true
|
|
||||||
}
|
|
||||||
|
|
||||||
Process {
|
|
||||||
id: getCursorPos
|
|
||||||
command: ["hyprctl", "cursorpos"]
|
|
||||||
stdout: SplitParser {
|
|
||||||
onRead: data => root.cursorPos = data
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Process {
|
Process {
|
||||||
id: getClients
|
id: getClients
|
||||||
command: ["sh", "-c", "hyprctl -j clients | jq -c"]
|
command: ["sh", "-c", "hyprctl -j clients | jq -c"]
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue