diff options
| author | Leander Scherer <leander@schererleander.de> | 2026-05-18 21:48:24 +0200 |
|---|---|---|
| committer | Leander Scherer <leander@schererleander.de> | 2026-05-28 22:42:07 +0200 |
| commit | 9a7cf1242d296dbdb9c03df48ab09054960295aa (patch) | |
| tree | f1a2d5c77ef6bdb049c995afcc4c663c1ffd1373 /modules/system/quickshell/Toggle.qml | |
| parent | 3ef8b4973bcae26445f99467d50ad75730d204b5 (diff) | |
feat(quickshell): basic bar, tray, notification
Diffstat (limited to 'modules/system/quickshell/Toggle.qml')
| -rw-r--r-- | modules/system/quickshell/Toggle.qml | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/modules/system/quickshell/Toggle.qml b/modules/system/quickshell/Toggle.qml new file mode 100644 index 0000000..76eb36c --- /dev/null +++ b/modules/system/quickshell/Toggle.qml @@ -0,0 +1,31 @@ +import QtQuick + +// iOS-style on/off switch. `checked` is the visual state; the parent +// owns truth and handles `toggled` by flipping it. Uses Item.enabled +// for the disabled visual + input gating. +Rectangle { + id: root + property bool checked: false + signal toggled() + + width: 40 + height: 22 + radius: 11 + color: checked ? Theme.accent : Theme.sliderTrack + opacity: enabled ? 1.0 : 0.4 + + Rectangle { + width: 18 + height: 18 + radius: 9 + color: Theme.text + anchors { verticalCenter: parent.verticalCenter } + x: root.checked ? parent.width - width - 2 : 2 + Behavior on x { NumberAnimation { duration: 150 } } + } + + MouseArea { + anchors { fill: parent } + onClicked: root.toggled() + } +} |
