Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion manual/05-the-top-bar.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ Removing either service takes its widget back off the bar.

## Indicators

The little cluster in the center is the indicators widget. These are status glyphs for modes you've turned on: do not disturb, night light, a queued [reminder](09-reminders.md), an active screen recording, stay awake, and [dictation](11-text-extraction-dictation.md). They light up when the mode is active and otherwise stay out of the way — hover anywhere on the bar to peek at the inactive ones. Clicking an indicator toggles that mode. One more is status only: a remote session lights up red while someone is connected to this machine through gliff.
The little cluster in the center is the indicators widget. These are status glyphs for modes you've turned on: do not disturb, night light, a queued [reminder](09-reminders.md), an active screen recording, stay awake, and [dictation](11-text-extraction-dictation.md). They light up when the mode is active and otherwise stay out of the way — hover just beside them, where the inactive ones would sit, to peek at those. Clicking an indicator toggles that mode. One more is status only: a remote session lights up red while someone is connected to this machine through gliff.

If you'd rather they were always visible, set `alwaysShow` to `true` on the widget. And if you only care about some of them, list the ones you want in `items`: `["Dnd", "Reminder", "NightLight"]`. You can have more than one indicators widget, so different sections can show different subsets.

Expand Down
8 changes: 0 additions & 8 deletions shell/Ui/PluginBarApi.qml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,8 @@ QtObject {
property int barSize: 0
property bool transparent: false
property bool foregroundAnimationEnabled: true
property bool centerSectionRevealHeld: false
property bool traySectionDragActive: false
property bool traySectionPopoutOpen: false
property bool _centerHoverRevealSuppressed: false
readonly property bool centerHoverRevealSuppressed: _centerHoverRevealSuppressed
property var activePopout: null
property var clickTargets: []
property var layoutConfig: ({})
Expand All @@ -43,11 +40,6 @@ QtObject {
property var _targetBelongsToWindow: null
property var _moduleWidgets: null
property var _run: null
property var _setCenterHoverRevealSuppressed: null

function setCenterHoverRevealSuppressed(value) {
if (_setCenterHoverRevealSuppressed) _setCenterHoverRevealSuppressed(!!value)
}

function showTooltip(target, text) {
if (_showTooltip) _showTooltip(target, String(text || ""))
Expand Down
80 changes: 2 additions & 78 deletions shell/plugins/bar/Bar.qml
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,6 @@ Item {
// The look the blur behind the bar was last synced for. A background set by
// editing shell.json skips the CLI, so the bar syncs Hyprland's blur itself.
property string glassSyncedLook: ""
// One bar surface exists per monitor and each reports into this count, so a
// pointer crossing from one monitor's bar to another's stays counted however
// the enter and leave interleave. A single shared bool would be left false by
// whichever event landed last.
property int barHoverCount: 0
// True while the pointer is over any bar, widgets included.
readonly property bool barHovered: barHoverCount > 0
// The indicator peek, open while the pointer is on any bar. Plugins read it
// by this name through their bar API.
property bool centerSectionRevealHeld: false
property bool centerHoverRevealSuppressed: false
property int barConfigSerial: 0
property string position: "top"
// Resolves through fontconfig at paint time (Style.font.family defaults
Expand Down Expand Up @@ -240,8 +229,6 @@ Item {
api.barSize = Qt.binding(function() { return root.barSize })
api.transparent = Qt.binding(function() { return root.transparent })
api.foregroundAnimationEnabled = Qt.binding(function() { return root.foregroundAnimationEnabled })
api.centerSectionRevealHeld = Qt.binding(function() { return root.centerSectionRevealHeld })
api._centerHoverRevealSuppressed = Qt.binding(function() { return root.centerHoverRevealSuppressed })
api.traySectionDragActive = Qt.binding(function() { return root.traySectionDragActive })
api.traySectionPopoutOpen = Qt.binding(function() { return root.traySectionPopoutOpen })
root.syncPluginBarApiObjects(api)
Expand Down Expand Up @@ -385,10 +372,7 @@ Item {
return String(requestedId || "") === String(moduleName || "")
? root.moduleWidgets(moduleName) : []
},
_run: function(command) { root.run(command) },
_setCenterHoverRevealSuppressed: function(value) {
root.centerHoverRevealSuppressed = !!value
}
_run: function(command) { root.run(command) }
})
if (!api) return null
root.bindPluginBarApi(api)
Expand Down Expand Up @@ -1007,34 +991,6 @@ Item {

Component.onCompleted: applyBarConfig()

// The indicator peek opens as the pointer comes onto the bar and holds until
// it leaves, or crosses onto the clock at the start of the center box
// (BarModel.peeksAt). Revealing the indicators widens their section, which
// can slide a widget under a stationary pointer, so nothing narrower than the
// stretch of bar up to that edge, held still while the peek is open
// (BarModel.nextPeekEdge), can hold it without opening and closing it in a
// loop.
function setBarHovered(hovered) {
barHoverCount = Math.max(0, barHoverCount + (hovered ? 1 : -1))
if (barHoverCount > 0) {
centerSectionRevealTimer.stop()
centerSectionRevealHeld = true
} else {
centerSectionRevealTimer.restart()
}
}

function setCenterHoverRevealSuppressed(value) {
centerHoverRevealSuppressed = !!value
}

Timer {
id: centerSectionRevealTimer
interval: 120
// A pointer that dips off the bar and straight back leaves the peek open.
onTriggered: if (!root.barHovered) root.centerSectionRevealHeld = false
}

function run(command) {
if (!command) return

Expand Down Expand Up @@ -1134,7 +1090,7 @@ Item {
}

// A dragged widget that changes size, as a clock ticking over or the
// indicator peek does, takes its room and its ghost with it. The ghost's
// indicators revealing do, takes its room and its ghost with it. The ghost's
// copy of it is taken again once the size settles, rather than on every
// frame of a widget animating its size.
function resizeBarDrag() {
Expand Down Expand Up @@ -1773,10 +1729,6 @@ Item {

// The same thickness the bar publishes for its screen (screenBarSizes).
readonly property int thickness: root.thicknessFor(screen)
// Where the center box starts along the bar, set by the drawn center
// sections. Hovering past it, over the clock, its trailing widgets and the
// right section, leaves the indicator peek shut.
property real peekEdge: 0

// The surface spans its screen at all times, transparent past the strip
// it paints; a drag toggles only its input region. Growing the surface
Expand Down Expand Up @@ -1836,17 +1788,6 @@ Item {
Loader {
anchors.fill: parent
sourceComponent: root.vertical ? verticalBar : horizontalBar

// A child of the loader, not a sibling of the sections: an ancestor stays
// hovered while the pointer is over a widget, where a sibling would lose
// hover to the section the pointer entered.
HoverHandler {
readonly property bool peeking: hovered && BarModel.peeksAt(point.position, barWindow.peekEdge, root.vertical)
onPeekingChanged: root.setBarHovered(peeking)
// Unplugging a monitor destroys its bar without a leave event, which
// would strand this surface's tally and hold the peek open for good.
Component.onDestruction: if (peeking) root.setBarHovered(false)
}
}
}

Expand Down Expand Up @@ -2311,23 +2252,6 @@ Item {
implicitWidth: root.vertical ? root.barSize : beginList.width + centerBox.width + endList.width
implicitHeight: root.vertical ? beginList.height + centerBox.height + endList.height : root.barSize

// Both placements sit at the bar surface's origin or anchor off its edge,
// so the box's start in the sections is its start on the surface.
readonly property real boxStart: root.vertical ? y + centerBox.y : x + centerBox.x
onBoxStartChanged: syncPeekEdge()
onActiveChanged: syncPeekEdge()
onWindowChanged: syncPeekEdge()
Component.onCompleted: syncPeekEdge()

function syncPeekEdge() {
if (active && window) window.peekEdge = BarModel.nextPeekEdge(window.peekEdge, boxStart, root.centerSectionRevealHeld)
}

Connections {
target: root
function onCenterSectionRevealHeldChanged() { sections.syncPeekEdge() }
}

ModuleList {
id: beginList
keys: sections.active ? root.layoutWidgets.sections.centerBegin : []
Expand Down
20 changes: 0 additions & 20 deletions shell/plugins/bar/BarModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -653,24 +653,6 @@ function barSizeFor(sizes, screenName, fallback) {
return size > 0 ? size : fallback
}

// The indicator peek opens over the bar from its start up to where the center
// box starts, and stays shut past it, over the clock and the panel icons.
// `position` is the pointer's point on the bar surface.
function peeksAt(position, edge, vertical) {
if (!position) return false
return (vertical ? position.y : position.x) < edge
}

// Revealing the indicators can move the center box's start: beside a display
// notch the center sections hang off the right section, so indicators in
// centerEnd or the right section pull it toward the start. An edge that
// followed would slip out from under a stationary pointer and close the peek,
// and closing would slide it back and reopen it. So the edge is measured only
// while the peek is shut and held where it was while it is open.
function nextPeekEdge(edge, measured, held) {
return held ? edge : measured
}

// Whether a workspace holds a real fullscreen window, which fades the bar out
// and has to take the clicks along its edge. Hyprland reports a maximized
// window as fullscreen 1 and a real one with bit 2 set; only the latter hides
Expand All @@ -689,8 +671,6 @@ function fullscreenOn(toplevels, workspaceId) {
if (typeof module !== "undefined") {
module.exports = {
barSizeFor: barSizeFor,
nextPeekEdge: nextPeekEdge,
peeksAt: peeksAt,
fullscreenOn: fullscreenOn,
centerBesideRight: centerBesideRight,
cutoutPending: cutoutPending,
Expand Down
70 changes: 41 additions & 29 deletions shell/plugins/bar/widgets/Indicators.qml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@ BarWidget {
property var indicatorActiveStates: ({})
property bool indicatorAreaHovered: false
property bool indicatorItemHovered: false
// Held a moment after the pointer leaves, so crossing between icons, or a
// frame where the widget moves under a still pointer, doesn't flicker them.
property bool hoverRevealHeld: false
readonly property bool alwaysShowIndicators: setting("alwaysShow", false) === true
readonly property bool revealInactiveIndicators: alwaysShowIndicators || indicatorAreaHovered || indicatorItemHovered || (bar && bar.centerSectionRevealHeld === true && bar.centerHoverRevealSuppressed !== true)
readonly property bool revealInactiveIndicators: alwaysShowIndicators || hoverRevealHeld
// The active block sits against the widget's fixed edge, and everything that
// grows the widget (revealed inactive icons, newly active ones) goes on its
// far side, so the icons already showing keep their click targets. A
Expand Down Expand Up @@ -75,14 +78,18 @@ BarWidget {

function setIndicatorAreaHovered(hovered) {
indicatorAreaHovered = hovered
if (hovered) indicatorHideTimer.stop()
else indicatorHideTimer.restart()
syncHoverReveal()
}

function setIndicatorItemHovered(hovered) {
if (hovered) {
indicatorItemHovered = true
indicatorItemHovered = hovered
syncHoverReveal()
}

function syncHoverReveal() {
if (indicatorAreaHovered || indicatorItemHovered) {
indicatorHideTimer.stop()
hoverRevealHeld = true
} else {
indicatorHideTimer.restart()
}
Expand Down Expand Up @@ -210,10 +217,7 @@ BarWidget {
Timer {
id: indicatorHideTimer
interval: 120
onTriggered: {
if (!root.indicatorAreaHovered)
root.indicatorItemHovered = false
}
onTriggered: if (!root.indicatorAreaHovered && !root.indicatorItemHovered) root.hoverRevealHeld = false
}

Component.onCompleted: {
Expand All @@ -229,22 +233,44 @@ BarWidget {
sourceComponent: root.vertical ? verticalIndicatorsTree : horizontalIndicatorsTree
}

// Where the hidden icons would show: hovering there reveals them, and the
// rest of the bar leaves them hidden. Hidden, they take no room, so the zone
// reaches past the widget on the side they grow toward. Revealed, it keeps
// half that reach: in the centered box the widget slides half its growth
// back the other way as the box re-centers, and a zone that stopped at the
// widget's edge would lose the pointer that opened it, closing and
// reopening in a loop. Above the icons, which a hover handler doesn't block.
Item {
objectName: "hiddenBlockZone"

readonly property real reach: (orientationLoader.item ? orientationLoader.item.inactiveLength : 0) * (root.revealInactiveIndicators ? 0.5 : 1)
readonly property real alongStart: root.fixedAtStart ? 0 : -reach
readonly property real alongLength: (root.vertical ? root.implicitHeight : root.implicitWidth) + reach

x: root.vertical ? 0 : alongStart
y: root.vertical ? alongStart : 0
width: root.vertical ? root.implicitWidth : alongLength
height: root.vertical ? alongLength : root.implicitHeight
Comment thread
greptile-apps[bot] marked this conversation as resolved.
Resolved

HoverHandler {
onHoveredChanged: root.setIndicatorAreaHovered(hovered)
}
}

// The two blocks are placed by hand rather than by a Row or Column: a
// Column cannot reverse its order, and the inactive area has to go on
// whichever side is away from the fixed edge.
Component {
id: horizontalIndicatorsTree

Item {
readonly property real inactiveLength: inactiveHorizontalBlock.implicitWidth

implicitWidth: activeHorizontalBlock.implicitWidth + inactiveHorizontalArea.implicitWidth
implicitHeight: Math.max(activeHorizontalBlock.implicitHeight, inactiveHorizontalArea.implicitHeight)
width: implicitWidth
height: implicitHeight

HoverHandler {
onHoveredChanged: root.setIndicatorAreaHovered(hovered)
}

Item {
id: inactiveHorizontalArea

Expand All @@ -264,10 +290,6 @@ BarWidget {
horizontal: true
reportActiveState: !root.vertical
}

HoverHandler {
onHoveredChanged: root.setIndicatorAreaHovered(hovered)
}
}

ActiveIndicatorBlock {
Expand All @@ -285,15 +307,13 @@ BarWidget {
id: verticalIndicatorsTree

Item {
readonly property real inactiveLength: inactiveVerticalBlock.implicitHeight

implicitWidth: Math.max(activeVerticalBlock.implicitWidth, inactiveVerticalArea.implicitWidth)
implicitHeight: activeVerticalBlock.implicitHeight + inactiveVerticalArea.implicitHeight
width: implicitWidth
height: implicitHeight

HoverHandler {
onHoveredChanged: root.setIndicatorAreaHovered(hovered)
}

Item {
id: inactiveVerticalArea

Expand All @@ -313,10 +333,6 @@ BarWidget {
horizontal: false
reportActiveState: root.vertical
}

HoverHandler {
onHoveredChanged: root.setIndicatorAreaHovered(hovered)
}
}

ActiveIndicatorBlock {
Expand All @@ -330,10 +346,6 @@ BarWidget {
}
}

HoverHandler {
onHoveredChanged: root.setIndicatorAreaHovered(hovered)
}

component ActiveIndicatorBlock: Item {
id: activeIndicatorBlockRoot

Expand Down
18 changes: 0 additions & 18 deletions shell/plugins/panels/clock/Panel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -95,18 +95,9 @@ Panel {
function open() {
refresh()
root.controller.show()
// Set after showing, not before: showing hands the popout coordinator
// over, which closes whichever panel was open, and that close clears the
// shared flag. Deferring means the panel taking over always wins, while
// a handoff to a panel that does not manage the flag still leaves it
// cleared rather than stuck on.
Qt.callLater(function() {
if (root.opened) setCenterHoverRevealSuppressed(true)
})
}

function close() {
setCenterHoverRevealSuppressed(false)
// Dismissing the panel mid-edit would otherwise leave the inputs up,
// waiting behind a closed popup for the next time it opens.
if (root.editingLife) root.cancelEditingLife()
Expand All @@ -124,15 +115,6 @@ Panel {
return false
}

// Summoning by hotkey moves no pointer, so a hover the bar was still
// holding must not keep the center indicators revealed behind the panel.
function setCenterHoverRevealSuppressed(value) {
if (root.bar && typeof root.bar.setCenterHoverRevealSuppressed === "function")
root.bar.setCenterHoverRevealSuppressed(value)
else if (root.bar && "centerHoverRevealSuppressed" in root.bar)
root.bar.centerHoverRevealSuppressed = value
}

function refresh() {
root.today = new Date()
root.goToToday()
Expand Down
Loading
Loading