small tweak to stats button, check the new config

This commit is contained in:
SomeElse
2026-04-29 07:50:20 +00:00
parent 1682c0a208
commit cd4e373898
4 changed files with 53 additions and 12 deletions

View File

@@ -136,15 +136,51 @@ Rectangle {
HoverHandler { id: hov }
property bool showAlt: false
onShowAltChanged: arc.requestPaint()
Connections {
target: hov
function onHoveredChanged() {
if (!hov.hovered) ring.showAlt = false
}
}
TapHandler {
enabled: !Cfg.Config.statsHideTextUntilHover || hov.hovered
onTapped: ring.showAlt = !ring.showAlt
}
Text {
anchors.centerIn: parent
text: Cfg.Config.statsShowPercentByDefault
? (hov.hovered ? ring.label : Math.round(ring.value) + "%")
: (hov.hovered ? Math.round(ring.value) + "%" : ring.label)
text: {
if (Cfg.Config.statsHideTextUntilHover) {
if (!hov.hovered) return ""
var showPct = ring.showAlt
? !Cfg.Config.statsShowPercentByDefault
: Cfg.Config.statsShowPercentByDefault
return showPct ? Math.round(ring.value) + "%" : ring.label
} else {
var baseShowPct = Cfg.Config.statsShowPercentByDefault
? !hov.hovered
: hov.hovered
var finalShowPct = ring.showAlt ? !baseShowPct : baseShowPct
return finalShowPct ? Math.round(ring.value) + "%" : ring.label
}
}
color: ring.labelColor
font.pixelSize: Cfg.Config.statsRingFontSize
font.bold: true
font.family: "monospace"
opacity: (Cfg.Config.statsHideTextUntilHover && !hov.hovered) ? 0 : 1
Behavior on opacity {
NumberAnimation { duration: 180; easing.type: Easing.OutCubic }
}
}
}
@@ -178,4 +214,3 @@ Rectangle {
}
}
}

View File

@@ -29,7 +29,7 @@ QtObject {
property var rightModules: ["Tray", "Notifications", "Volume", "Clock"]
// ── Arch Logo ─────────────────────────────────────────────────────────────
property int logoIconSize: 22 // icon font size; container width scales with it
property int logoIconSize: 23 // icon font size; container width scales with it
property string logoIcon: "󱄅" // Nerd Font glyph for the logo
// ── Panel Styling ─────────────────────────────────────────────────────────
@@ -54,9 +54,15 @@ QtObject {
property int trayIconSize: 20
// ── Stats Styling ─────────────────────────────────────────────────────────
property int statsRingSize: 25
property int statsRingFontSize: 10
property bool statsShowPercentByDefault: true
property int statsRingSize: 23
property int statsRingFontSize: 10
// If true, the % value is shown by default; hovering shows the label, clicking swaps back.
// If false, the label is shown by default; hovering shows the %, clicking swaps back.
property bool statsShowPercentByDefault: true
// If true, text is hidden completely until you hover a ring.
// • Hover → shows the "default" value (% when statsShowPercentByDefault, label otherwise)
// • Click → swaps to the "other" value (label / %)
property bool statsHideTextUntilHover: false
// ── Volume Module ─────────────────────────────────────────────────────────
property int volumeIconSize: 20

View File

@@ -167,7 +167,7 @@ QtObject {
readonly property color notifHistoryEmpty: textDim
// ── BgDate Module ──────────────────────────────────────────────────────────
readonly property color bgDateText: textMain // Date string color
readonly property color bgDateShadow: "#66000000" // Drop shadow for both texts
readonly property color bgDateSecondsText: textMain // Seconds clock — sun-glow gold
readonly property color bgDateText: "#ffffffff" // Pure white (brightest possible)
readonly property color bgDateShadow: "#88000000" // Slightly softer shadow to let the white glow
readonly property color bgDateSecondsText: bgDateText // Brighter, more "sunlight" gold/yellow
}

View File

@@ -11,7 +11,7 @@ import "config" as Cfg
ShellRoot {
id: root
readonly property bool isTop: Cfg.Config.barPosition === "top"
property color frameBackground: Cfg.Config.theme.bgFrame