Files
lucid/HeldPointer.qml
T
Sn3aky c0ebc5c3bc Shell: the tray, Lucid's own pointer, the clock engine, network drives and the bar's content size
- Tray: both looks rebuilt in Material You, every app in a slot of its own or
  three stacked with a count; a click opens the tray, each app a row with its
  menu opening in place
- Pointer: Bibata Modern's shapes drawn from source in the palette's colours,
  fading with it, the tilt card, and the shell drawing the pointer itself in drags
- Clock's engine in the shell (Alarms, ClockLink): alarms ring with the app
  closed and always post Snooze and Stop
- Lumen: network drives (Connect to server, shares, Nearby); Lens: videos
- Bar: Content size, notch edges as quarter ellipses up to 64 px, frosted and lit
  on hover; fixes across the dock, desktop, widgets, LucidShot and Settings

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 12:57:29 +01:00

83 lines
2.6 KiB
QML

import QtQuick
import Quickshell
import Quickshell.Wayland
import qs
// fill whatever takes the press of a drag with it, over it. while `held`, the window draws
// the pointer itself, in the same frame as what follows it, and the compositor's
// goes, wherever nothing could cover the one drawn: the compositor shows its own a
// frame or two before a window catches up, so whatever a drag moves trails it
Item {
id: hp
property bool held: false
// the shape the pointer has meanwhile, as for cursorShape
property int cursor: Qt.ArrowCursor
// the surface, for what could cover the pointer: a WlrLayer, or -1 for an app's
// own window. a panel window counts as over the windows unless it says
// otherwise with a pointerSurface of its own
property int surface: {
const w = hp.QsWindow.window;
if (!w)
return -1;
if (w.pointerSurface !== undefined)
return w.pointerSurface;
return w.aboveWindows === undefined ? -1 : (w.aboveWindows ? WlrLayer.Top : WlrLayer.Bottom);
}
// an item on an overlay surface to draw the pointer on instead, for a window
// under the others that keeps the drag: seen everywhere then. it has to cover
// the same part of the screen as this window
property Item stage: null
anchors.fill: parent
// above what takes the press, which it sees first and lets through
z: 1000
onHeldChanged: {
if (!hp.held)
return ;
PointerPictures.refresh();
}
// watches the press and never takes it from what it moves
PointHandler {
id: follow
acceptedButtons: Qt.AllButtons
}
// over everything else in the window
Item {
id: cover
readonly property bool on: hp.held && follow.active
readonly property point at: follow.point.scenePosition
readonly property bool open: cover.on && cover.at.x >= 0 && cover.at.y >= 0 && cover.at.x < cover.width && cover.at.y < cover.height && (hp.stage !== null || PointerPictures.openAt(hp.QsWindow.window ? hp.QsWindow.window.screen : null, cover.at.x, cover.at.y, hp.surface))
parent: hp.Window.contentItem
anchors.fill: parent
z: 999999
DrawnPointer {
id: drawn
parent: hp.stage !== null ? hp.stage : cover
cursor: hp.cursor
active: cover.on
px: cover.at.x
py: cover.at.y
visible: cover.open && drawn.ready
}
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.NoButton
cursorShape: drawn.onScreen ? Qt.BlankCursor : undefined
}
}
}