quickshell-config/services/Hover.qml

50 lines
1.4 KiB
QML
Raw Permalink Normal View History

2025-06-24 15:51:34 +02:00
import Quickshell
import QtQuick
import "../config"
MouseArea {
id: root
anchors.fill: parent
hoverEnabled: true
required property ShellScreen screen
// required property Panels panels
required property Item bar
property bool showVolumeMenu: false
property bool isInRightPanel: false
// function withinPanelHeight(panel: Item, x: real, y: real): bool {
// const panelY = Config.border.thickness + panel.y;
// return y >= panelY - Config.border.rounding && y <= panelY + panel.height + Config.border.rounding;
// }
// function inLeftBorder(x: real, y: real): bool {
// return x <= Config.border.thickness;
// }
function inRightPanel(x: real, y: real): bool {
// Cursor is in middle veritcal third of screen
// Cursor is in the right border
return y >= root.screen.height / 3 && y <= (root.screen.height / 3) * 2 && x >= root.screen.width - Config.border.thickness;
}
// Update on mouse cursor movement
onPositionChanged: event => {
const x = event.x;
const y = event.y;
root.isInRightPanel = inRightPanel(x, y);
console.log("In right panel: " + root.isInRightPanel);
console.log("x:" + x + " y: " + y);
}
onContainsMouseChanged: {
if (!containsMouse) {
root.isInRightPanel = false;
}
}
}