feat: dashboard show on hover, media and weather tabs added
This commit is contained in:
+75
-55
@@ -19,7 +19,7 @@ Item {
|
||||
required property ShellScreen screen
|
||||
property bool singleGestureTriggered: false
|
||||
property bool utilitiesShortcutActive
|
||||
required property PersistentProperties visibilities
|
||||
required property ScreenState screenState
|
||||
|
||||
function inBottomPanel(panel: Item, x: real, y: real): bool {
|
||||
const panelHeight = panel.height * (1 - (panel.offsetScale ?? 0));
|
||||
@@ -63,7 +63,7 @@ Item {
|
||||
|
||||
cursorShape: (active && centroid.pressPosition.y < root.bar.implicitHeight) ? Qt.ClosedHandCursor : undefined
|
||||
dragThreshold: 0
|
||||
enabled: !root.visibilities.isDrawing
|
||||
enabled: !root.screenState.isDrawing
|
||||
grabPermissions: PointerHandler.CanTakeOverFromHandlersOfSameType | PointerHandler.ApprovesTakeOverByAnything
|
||||
maximumPointCount: 1
|
||||
minimumPointCount: 1
|
||||
@@ -76,48 +76,60 @@ Item {
|
||||
onCentroidChanged: {
|
||||
const x = centroid.position.x;
|
||||
const y = centroid.position.y;
|
||||
const dragX = x - centroid.pressPosition.x;
|
||||
const dragY = y - centroid.pressPosition.y;
|
||||
const pressX = centroid.pressPosition.x;
|
||||
const pressY = centroid.pressPosition.y;
|
||||
const dragX = x - pressX;
|
||||
const dragY = y - pressY;
|
||||
|
||||
if (centroid.pressPosition.y >= root.screen.height - Config.bar.border && centroid.pressPosition.x > root.screen.width / 5 && dragY < -Config.launcher.dragThreshold)
|
||||
root.visibilities.launcher = true;
|
||||
if (pressY >= root.screen.height - Config.bar.border && pressX > root.screen.width / 5 && dragY < -Config.launcher.dragThreshold)
|
||||
root.screenState.launcher = true;
|
||||
|
||||
if (root.singleGestureTriggered)
|
||||
return;
|
||||
|
||||
if (root.geometry.insetTop(root.borderThickness) > centroid.pressPosition.y) {
|
||||
if (dragY > 20) {
|
||||
root.visibilities.settings = true;
|
||||
root.singleGestureTriggered = true;
|
||||
} else if (dragY < -20) {
|
||||
root.visibilities.settings = false;
|
||||
root.singleGestureTriggered = true;
|
||||
}
|
||||
}
|
||||
// if (root.geometry.insetTop(root.borderThickness) > pressY) {
|
||||
// if (dragY > 20) {
|
||||
// root.screenState.settings = true;
|
||||
// root.singleGestureTriggered = true;
|
||||
// } else if (dragY < -20) {
|
||||
// root.screenState.settings = false;
|
||||
// root.singleGestureTriggered = true;
|
||||
// }
|
||||
// }
|
||||
|
||||
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;
|
||||
if (pressY > root.screen.height - root.geometry.insetBottom(root.borderThickness) && pressX < root.screen.width / 5 && dragY < -50)
|
||||
root.screenState.clipboard = true;
|
||||
|
||||
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 (!Config.dock.hoverToReveal && pressY > root.screen.height - root.geometry.insetTop(root.borderThickness) && pressX > root.screen.width / 5 && !root.screenState.launcher)
|
||||
if (dragY < -10) {
|
||||
root.visibilities.dock = true;
|
||||
root.screenState.dock = true;
|
||||
root.singleGestureTriggered = true;
|
||||
}
|
||||
|
||||
if (centroid.pressPosition.x > root.screen.width - Config.bar.border && centroid.pressPosition.y < (root.screen.height / 2) && dragX < -Config.sidebar.dragThreshold) {
|
||||
root.visibilities.sidebar = true;
|
||||
if (pressX > root.screen.width - Config.bar.border && pressY < (root.screen.height / 2) && dragX < -Config.sidebar.dragThreshold) {
|
||||
root.screenState.sidebar = true;
|
||||
root.singleGestureTriggered = true;
|
||||
}
|
||||
|
||||
if (centroid.pressPosition.x >= root.screen.width - Config.bar.border && centroid.pressPosition.y > (root.screen.height / 2) && dragX < -20) {
|
||||
if (pressX >= root.screen.width - Config.bar.border && pressY > (root.screen.height / 2) && dragX < -20) {
|
||||
Hypr.dispatch(`hl.dsp.focus({ workspace = 'r+1', on_current_monitor = true })`);
|
||||
root.singleGestureTriggered = true;
|
||||
}
|
||||
|
||||
if (centroid.pressPosition.x <= Config.bar.border && dragX > 20) {
|
||||
if (pressX <= Config.bar.border && dragX > 20) {
|
||||
Hypr.dispatch(`hl.dsp.focus({ workspace = 'r-1', on_current_monitor = true })`);
|
||||
root.singleGestureTriggered = true;
|
||||
}
|
||||
|
||||
if (root.inTopPanel(root.panels.dashboardWrapper, pressX, pressY) && root.withinPanelWidth(root.panels.dashboardWrapper, x, y)) {
|
||||
if (dragY > Config.dashboard.dragThreshold) {
|
||||
root.screenState.dashboard = true;
|
||||
root.singleGestureTriggered = true;
|
||||
} else if (dragY < -Config.dashboard.dragThreshold) {
|
||||
root.screenState.dashboard = false;
|
||||
root.singleGestureTriggered = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,7 +139,7 @@ Item {
|
||||
property bool setInitialPoint: false
|
||||
|
||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||
enabled: root.visibilities.isDrawing && (!root.inLeftPanel(root.panels.drawing, hoverHandler.point.position.x, hoverHandler.point.position.y) || !root.panels.drawing.expanded)
|
||||
enabled: root.screenState.isDrawing && (!root.inLeftPanel(root.panels.drawing, hoverHandler.point.position.x, hoverHandler.point.position.y) || !root.panels.drawing.expanded)
|
||||
|
||||
onActiveChanged: {
|
||||
if (!active) {
|
||||
@@ -178,12 +190,12 @@ Item {
|
||||
HoverHandler {
|
||||
id: hoverHandler
|
||||
|
||||
cursorShape: root.visibilities.isDrawing && !root.inLeftPanel(root.panels.drawing, point.position.x, point.position.y) ? Qt.BlankCursor : undefined
|
||||
cursorShape: root.screenState.isDrawing && !root.inLeftPanel(root.panels.drawing, point.position.x, point.position.y) ? Qt.BlankCursor : undefined
|
||||
|
||||
onHoveredChanged: {
|
||||
if (!hovered) {
|
||||
if (!root.osdShortcutActive) {
|
||||
root.visibilities.osd = false;
|
||||
root.screenState.osd = false;
|
||||
root.panels.osd.hovered = false;
|
||||
}
|
||||
|
||||
@@ -193,13 +205,16 @@ Item {
|
||||
|
||||
if (Config.bar.autoHide || root.bar.fullscreen)
|
||||
root.bar.isHovered = false;
|
||||
|
||||
if (root.screenState.dashboard && Config.dashboard.showOnHover)
|
||||
root.screenState.dashboard = false;
|
||||
}
|
||||
}
|
||||
onPointChanged: {
|
||||
const x = point.position.x;
|
||||
const y = point.position.y;
|
||||
|
||||
if (root.visibilities.isDrawing) {
|
||||
if (root.screenState.isDrawing) {
|
||||
if (root.inLeftPanel(root.panels.drawing, x, y) && !(drawingHandler.point.pressedButtons & Qt.LeftButton)) {
|
||||
root.panels.drawing.expand();
|
||||
root.drawing.content.hideHover();
|
||||
@@ -210,7 +225,7 @@ Item {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!root.visibilities.bar && Config.bar.autoHide && root.geometry.barContains(x, y, true))
|
||||
if (!root.screenState.bar && Config.bar.autoHide && root.geometry.barContains(x, y, true))
|
||||
root.bar.isHovered = true;
|
||||
|
||||
if (root.bar.fullscreen && !root.bar.isHovered)
|
||||
@@ -228,7 +243,7 @@ Item {
|
||||
const showOsd = outOfSidebar && root.inRightPanel(root.panels.osdWrapper, x, y);
|
||||
|
||||
if (!root.osdShortcutActive) {
|
||||
root.visibilities.osd = showOsd;
|
||||
root.screenState.osd = showOsd;
|
||||
root.panels.osd.hovered = showOsd;
|
||||
} else if (showOsd) {
|
||||
root.osdShortcutActive = false;
|
||||
@@ -236,8 +251,13 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
if (Config.dock.enable && Config.dock.hoverToReveal && !root.visibilities.dock && !root.visibilities.launcher && root.inBottomPanel(root.panels.dock, x, y))
|
||||
root.visibilities.dock = true;
|
||||
if (Config.dock.enable && Config.dock.hoverToReveal && !root.screenState.dock && !root.screenState.launcher && root.inBottomPanel(root.panels.dock, x, y))
|
||||
root.screenState.dock = true;
|
||||
|
||||
const inDashboard = root.inTopPanel(root.panels.dashboardWrapper, x, y);
|
||||
|
||||
if (Config.dashboard.showOnHover)
|
||||
root.screenState.dashboard = inDashboard;
|
||||
|
||||
if (root.geometry.barContains(x, y))
|
||||
root.bar.checkPopout(root.geometry.axisPos(x, y));
|
||||
@@ -246,16 +266,16 @@ Item {
|
||||
|
||||
Connections {
|
||||
function onDashboardChanged() {
|
||||
if (root.visibilities.dashboard) {
|
||||
if (root.screenState.dashboard) {
|
||||
const inDashboardArea = root.inTopPanel(root.panels.dashboard, root.mouseX, root.mouseY);
|
||||
if (!inDashboardArea) {
|
||||
root.dashboardShortcutActive = true;
|
||||
}
|
||||
if (root.panels.launcher.x + root.panels.launcher.width > root.panels.dashboardWrapper.x)
|
||||
root.visibilities.launcher = false;
|
||||
root.screenState.launcher = false;
|
||||
|
||||
root.visibilities.settings = false;
|
||||
root.visibilities.sidebar = false;
|
||||
root.screenState.settings = false;
|
||||
root.screenState.sidebar = false;
|
||||
root.popouts.hasCurrent = false;
|
||||
} else {
|
||||
root.dashboardShortcutActive = false;
|
||||
@@ -263,12 +283,12 @@ Item {
|
||||
}
|
||||
|
||||
function onIsDrawingChanged() {
|
||||
if (!root.visibilities.isDrawing)
|
||||
if (!root.screenState.isDrawing)
|
||||
root.drawing.clear();
|
||||
}
|
||||
|
||||
function onLauncherChanged() {
|
||||
if (!root.visibilities.launcher) {
|
||||
if (!root.screenState.launcher) {
|
||||
root.dashboardShortcutActive = false;
|
||||
root.osdShortcutActive = false;
|
||||
root.utilitiesShortcutActive = false;
|
||||
@@ -276,23 +296,23 @@ Item {
|
||||
const inOsdArea = root.inRightPanel(root.panels.osd, root.mouseX, root.mouseY);
|
||||
|
||||
if (!inOsdArea) {
|
||||
root.visibilities.osd = false;
|
||||
root.screenState.osd = false;
|
||||
root.panels.osd.hovered = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (root.visibilities.launcher) {
|
||||
if (root.screenState.launcher) {
|
||||
if (root.panels.dashboardWrapper.x < root.panels.launcher.x + root.panels.launcher.width) {
|
||||
root.visibilities.dashboard = false;
|
||||
root.screenState.dashboard = false;
|
||||
}
|
||||
|
||||
root.visibilities.dock = false;
|
||||
root.visibilities.settings = false;
|
||||
root.screenState.dock = false;
|
||||
root.screenState.settings = false;
|
||||
}
|
||||
}
|
||||
|
||||
function onOsdChanged() {
|
||||
if (root.visibilities.osd) {
|
||||
if (root.screenState.osd) {
|
||||
const inOsdArea = root.inRightPanel(root.panels.osd, root.mouseX, root.mouseY);
|
||||
if (!inOsdArea) {
|
||||
root.osdShortcutActive = true;
|
||||
@@ -303,32 +323,32 @@ Item {
|
||||
}
|
||||
|
||||
function onResourcesChanged() {
|
||||
if (root.visibilities.resources && (root.popouts.currentName.startsWith("audio") || root.popouts.currentName.startsWith("updates"))) {
|
||||
if (root.screenState.resources && (root.popouts.currentName.startsWith("audio") || root.popouts.currentName.startsWith("updates"))) {
|
||||
root.popouts.hasCurrent = false;
|
||||
}
|
||||
|
||||
if (root.visibilities.resources)
|
||||
root.visibilities.settings = false;
|
||||
if (root.screenState.resources)
|
||||
root.screenState.settings = false;
|
||||
}
|
||||
|
||||
function onSettingsChanged() {
|
||||
if (root.visibilities.settings) {
|
||||
root.visibilities.resources = false;
|
||||
root.visibilities.dashboard = false;
|
||||
root.visibilities.sidebar = false;
|
||||
if (root.screenState.settings) {
|
||||
root.screenState.resources = false;
|
||||
root.screenState.dashboard = false;
|
||||
root.screenState.sidebar = false;
|
||||
root.panels.popouts.hasCurrent = false;
|
||||
root.visibilities.launcher = false;
|
||||
root.screenState.launcher = false;
|
||||
}
|
||||
}
|
||||
|
||||
function onSidebarChanged() {
|
||||
if (root.visibilities.sidebar) {
|
||||
root.visibilities.dashboard = false;
|
||||
root.visibilities.settings = false;
|
||||
if (root.screenState.sidebar) {
|
||||
root.screenState.dashboard = false;
|
||||
root.screenState.settings = false;
|
||||
root.popouts.hasCurrent = false;
|
||||
}
|
||||
}
|
||||
|
||||
target: root.visibilities
|
||||
target: root.screenState
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user