feat(bar): add support for fractional sizes, fit to contents

This commit is contained in:
bbedward
2026-09-21 13:27:14 -04:00
parent 0bd3e85150
commit a3f1a3d620
24 changed files with 623 additions and 90 deletions
@@ -1,5 +1,4 @@
import QtQuick
import Quickshell
import qs.Common
import qs.Services
import qs.Widgets
@@ -17,13 +16,13 @@ PluginComponent {
ccWidgetIsActive: isEnabled
onCcWidgetToggled: {
isEnabled = !isEnabled
clickCount += 1
isEnabled = !isEnabled;
clickCount += 1;
if (pluginService) {
pluginService.savePluginData("controlCenterExample", "isEnabled", isEnabled)
pluginService.savePluginData("controlCenterExample", "clickCount", clickCount)
pluginService.savePluginData("controlCenterExample", "isEnabled", isEnabled);
pluginService.savePluginData("controlCenterExample", "clickCount", clickCount);
}
ToastService.showInfo("Example Toggle", isEnabled ? "Activated!" : "Deactivated!")
ToastService.showInfo("Example Toggle", isEnabled ? "Activated!" : "Deactivated!");
}
horizontalBarPill: Component {
@@ -33,14 +32,14 @@ PluginComponent {
DankIcon {
name: root.isEnabled ? "toggle_on" : "toggle_off"
color: root.isEnabled ? Theme.primary : Theme.surfaceVariantText
font.pixelSize: Theme.iconSize - 4
size: root.iconSize
anchors.verticalCenter: parent.verticalCenter
}
StyledText {
text: `${root.clickCount}`
color: root.isEnabled ? Theme.primary : Theme.surfaceVariantText
font.pixelSize: Theme.fontSizeMedium
font.pixelSize: root.textSize
anchors.verticalCenter: parent.verticalCenter
}
}
@@ -53,14 +52,14 @@ PluginComponent {
DankIcon {
name: root.isEnabled ? "toggle_on" : "toggle_off"
color: root.isEnabled ? Theme.primary : Theme.surfaceVariantText
font.pixelSize: Theme.iconSize - 4
size: root.iconSize
anchors.horizontalCenter: parent.horizontalCenter
}
StyledText {
text: `${root.clickCount}`
color: root.isEnabled ? Theme.primary : Theme.surfaceVariantText
font.pixelSize: Theme.fontSizeSmall
font.pixelSize: root.textSize
anchors.horizontalCenter: parent.horizontalCenter
}
}