Files
Panama/config/dot/quickshell/widgets/Toggle.qml
T
Gabriel Brown d96863b687 Convert British spellings to American across the repo
colour -> color, behaviour -> behavior, centre -> center, favourite ->
favorite, and about twenty other pairs, applied consistently across
comments, docs, error/UI copy, and a handful of QML identifiers that
used the British spelling as their actual name: SystemSettings'
serialiseValue/serialiseTable/normaliseGradient, Displays'
normaliseModes, Wallpaper's normalisePolicy, SettingsBackup's
serialiseHomeState, DateTime's ntpSynchronised property, Clipboard's
_normalise helper, and ShortcutCapture's cancelled signal (with its
onCancelled handler in ShortcutsPage.qml). Every call site and the two
tests that assert on the literal source text (settings-ownership and
settings-backup-live contracts) were updated in lockstep.

Left untouched: config/dot/espanso/match/packages/misspell-en/ is a
vendored third-party autocorrect dictionary -- its entries are typo
corrections, not our prose, and rewriting them would fight the
package's own purpose (and any future re-sync from upstream).

The already-American `favorites` property (Home page pinned
accessories) was never actually misspelled -- only nearby comments and
error strings said "favourites" -- so no data migration was needed
there.

Claude-Session: https://claude.ai/code/session_01E6TJUAh41HaP25MVHWkhRZ
2026-08-19 08:07:55 -04:00

106 lines
3.0 KiB
QML

// A GNOME-style quick-settings tile: big rounded button with an icon and a
// label, filled with the accent color when active.
import QtQuick
import Quickshell
import Quickshell.Widgets
import qs.config
Rectangle {
id: root
property string icon: "" // freedesktop icon name
property string label: ""
property string sublabel: ""
property bool active: false
property bool enabled: true
signal toggled
// Emitted on right-click / long press — used to open the relevant detail
// panel (pick a wifi network, pick an output device).
signal expanded
implicitWidth: 168
implicitHeight: 56
radius: Theme.cardRadius
border.width: 0
opacity: enabled ? 1.0 : 0.45
color: {
if (root.active)
return mouse.containsMouse ? Qt.lighter(Theme.accent, 1.12) : Theme.accent;
if (mouse.pressed)
return Theme.alpha(Theme.fg, Theme.activeAlpha);
if (mouse.containsMouse)
return Theme.alpha(Theme.fg, Theme.hoverAlpha);
return Theme.alpha(Theme.fg, 0.07);
}
Behavior on color {
ColorAnimation {
duration: Theme.durFast
}
}
readonly property color contentColor: root.active ? Theme.bgDark : Theme.fg
Row {
anchors.fill: parent
anchors.leftMargin: 12
anchors.rightMargin: 12
spacing: 10
// ThemedIcon, not a bare IconImage: Adwaita's symbolic SVGs carry a
// hardcoded #2e3436 fill and Qt does not recolor them the way GTK
// does, so drawn directly they are all but invisible on this palette.
ThemedIcon {
anchors.verticalCenter: parent.verticalCenter
size: 22
icon: root.icon
tint: root.contentColor
visible: root.icon !== ""
}
Column {
anchors.verticalCenter: parent.verticalCenter
spacing: 1
Text {
text: root.label
color: root.contentColor
font.family: Theme.fontFamily
font.pixelSize: Theme.fontSize
font.weight: Font.Medium
elide: Text.ElideRight
width: Math.min(implicitWidth, 108)
}
Text {
text: root.sublabel
visible: root.sublabel !== ""
color: root.active ? Theme.alpha(Theme.bgDark, 0.7) : Theme.fgDim
font.family: Theme.fontFamily
font.pixelSize: Theme.fontSizeSmall
elide: Text.ElideRight
width: Math.min(implicitWidth, 108)
}
}
}
MouseArea {
id: mouse
anchors.fill: parent
enabled: root.enabled
hoverEnabled: true
acceptedButtons: Qt.LeftButton | Qt.RightButton
cursorShape: Qt.PointingHandCursor
onClicked: event => {
if (event.button === Qt.RightButton)
root.expanded();
else
root.toggled();
}
}
}