The indicators rendered visibly smaller than the rest of the bar because qs.Ui.BarIndicator sets fontSize to Style.font.caption, while every stock bar widget uses Style.bar.iconFont — 20px against 26px at base-size 24. Nothing in the six indicator files sets a size of its own, and BarIndicator lives in /usr/share, which is off limits. Rather than fork the 471-line Indicators.qml, this drops a 51-line copy of BarIndicator.qml beside the indicator files, differing in that one line. QML resolves same-directory types before imported modules, so Dnd, Dictation, NightLight, Reminder, ScreenRecording and StayAwake all pick it up with no change of their own, and Indicators.qml stays byte-identical to upstream. The copy needs an explicit `import qs.Ui` for BarIconButton, which the original gets implicitly by living inside that module. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
59 lines
2.5 KiB
QML
59 lines
2.5 KiB
QML
import QtQuick
|
|
import qs.Commons
|
|
import qs.Ui // BarIconButton: implicit for the original inside qs.Ui, explicit here
|
|
|
|
BarIconButton {
|
|
id: root
|
|
|
|
property string moduleName: ""
|
|
property var settings: ({})
|
|
property string activeText: ""
|
|
property string inactiveText: activeText
|
|
property string activeTooltipText: ""
|
|
property string inactiveTooltipText: activeTooltipText
|
|
property string indicatorBlock: "single"
|
|
property var indicatorHost: null
|
|
property var activeOverride: null
|
|
readonly property bool effectiveActive: activeOverride === null || activeOverride === undefined ? active : activeOverride === true
|
|
readonly property bool belongsInBlock: indicatorBlock === "active" ? effectiveActive : (indicatorBlock === "inactive" ? !effectiveActive : true)
|
|
readonly property bool inactiveRevealed: !effectiveActive && !!indicatorHost && indicatorHost.revealInactiveIndicators
|
|
|
|
function extractData(raw) {
|
|
return Util.parseModuleJson(raw)
|
|
}
|
|
|
|
function syncIndicatorOpacity() {
|
|
root.opacity = !belongsInBlock ? 0 : (effectiveActive ? 1 : (inactiveRevealed ? 0.45 : 0))
|
|
}
|
|
|
|
Component.onCompleted: syncIndicatorOpacity()
|
|
onActiveChanged: syncIndicatorOpacity()
|
|
onEffectiveActiveChanged: syncIndicatorOpacity()
|
|
onBarChanged: syncIndicatorOpacity()
|
|
onBelongsInBlockChanged: syncIndicatorOpacity()
|
|
onInactiveRevealedChanged: syncIndicatorOpacity()
|
|
onIndicatorBlockChanged: syncIndicatorOpacity()
|
|
|
|
visible: belongsInBlock && (text !== "" || keepSpace)
|
|
text: effectiveActive ? activeText : inactiveText
|
|
tooltipText: effectiveActive ? activeTooltipText : inactiveTooltipText
|
|
keepSpace: true
|
|
dimmed: !effectiveActive
|
|
concealed: !effectiveActive && !inactiveRevealed
|
|
interactive: belongsInBlock && (effectiveActive || indicatorBlock === "inactive" || inactiveRevealed)
|
|
useActiveColor: false
|
|
maintainIndicatorReveal: indicatorBlock === "inactive"
|
|
revealHost: indicatorHost
|
|
// Stock uses Style.font.caption (20px at base-size 24), which left the
|
|
// indicators visibly smaller than every other bar icon. Style.bar.iconFont
|
|
// is what BarIconButton uses for the stock widgets (26px), so they now
|
|
// match. This local copy shadows qs.Ui.BarIndicator because QML resolves
|
|
// same-directory types before imported modules — the indicator files next
|
|
// to it pick this up without any change of their own.
|
|
fontSize: Style.bar.iconFont
|
|
horizontalMargin: 5
|
|
verticalPadding: 5
|
|
fixedWidth: vertical ? -1 : Style.bar.statusSlot
|
|
fixedHeight: vertical ? Style.bar.statusSlot : -1
|
|
}
|