Refine quickshell bar and Noctalia compatibility

This commit is contained in:
Ryan Hughes
2026-05-14 02:21:48 -04:00
parent 5086654d51
commit 7d2745b6a6
28 changed files with 1096 additions and 699 deletions
@@ -1,16 +1,26 @@
import QtQuick
import QtQuick.Controls
import qs.Commons
Switch {
Rectangle {
id: root
property string label: ""
indicator: Rectangle {
implicitWidth: 32
implicitHeight: 18
x: root.leftPadding
y: root.height / 2 - height / 2
property string label: ""
property string text: ""
property bool checked: false
signal toggled(var value)
signal clicked()
implicitWidth: labelItem.visible ? indicator.width + 8 + labelItem.implicitWidth : indicator.width
implicitHeight: Math.max(indicator.height, labelItem.implicitHeight)
color: "transparent"
opacity: enabled ? 1 : 0.4
Rectangle {
id: indicator
width: 32
height: 18
anchors.verticalCenter: parent.verticalCenter
radius: height / 2
color: root.checked ? Color.mPrimary : Color.mSurfaceVariant
border.color: Color.mOutline
@@ -27,12 +37,28 @@ Switch {
}
}
contentItem: Text {
leftPadding: 38
Text {
id: labelItem
visible: (root.label || root.text) !== ""
anchors.left: indicator.right
anchors.leftMargin: 8
anchors.verticalCenter: parent.verticalCenter
text: root.label || root.text
color: Color.mOnSurface
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: Style.fontSizeS
verticalAlignment: Text.AlignVCenter
}
MouseArea {
anchors.fill: parent
hoverEnabled: true
enabled: root.enabled
cursorShape: Qt.PointingHandCursor
onClicked: {
root.checked = !root.checked
root.clicked()
root.toggled(root.checked)
}
}
}