forked from Shinonome/dots-hyprland
sidebar: grey out bluetooth button if unavailable
This commit is contained in:
+1
@@ -12,6 +12,7 @@ AndroidQuickToggleButton {
|
||||
name: Translation.tr("Bluetooth")
|
||||
statusText: BluetoothStatus.firstActiveDevice?.name ?? Translation.tr("No device")
|
||||
|
||||
available: BluetoothStatus.available
|
||||
toggled: BluetoothStatus.enabled
|
||||
buttonIcon: BluetoothStatus.connected ? "bluetooth_connected" : BluetoothStatus.enabled ? "bluetooth" : "bluetooth_disabled"
|
||||
mainAction: () => {
|
||||
|
||||
+4
-2
@@ -15,6 +15,7 @@ GroupButton {
|
||||
required property string name
|
||||
required property var mainAction
|
||||
property string statusText: toggled ? Translation.tr("Active") : Translation.tr("Inactive")
|
||||
property bool available: true
|
||||
|
||||
required property real baseCellWidth
|
||||
required property real baseCellHeight
|
||||
@@ -42,6 +43,7 @@ GroupButton {
|
||||
|
||||
signal openMenu()
|
||||
|
||||
enabled: available || editMode
|
||||
padding: 6
|
||||
horizontalPadding: padding
|
||||
verticalPadding: padding
|
||||
@@ -52,8 +54,8 @@ GroupButton {
|
||||
colBackgroundToggledActive: (altAction && expandedSize) ? Appearance.colors.colLayer2Active : Appearance.colors.colPrimaryActive
|
||||
buttonRadius: toggled ? Appearance.rounding.large : height / 2
|
||||
buttonRadiusPressed: Appearance.rounding.normal
|
||||
property color colText: (toggled && !(altAction && expandedSize)) ? Appearance.colors.colOnPrimary : Appearance.colors.colOnLayer2
|
||||
property color colIcon: expandedSize ? (root.toggled ? Appearance.colors.colOnPrimary : Appearance.colors.colOnLayer3) : colText
|
||||
property color colText: (toggled && !(altAction && expandedSize) && enabled) ? Appearance.colors.colOnPrimary : ColorUtils.transparentize(Appearance.colors.colOnLayer2, enabled ? 0 : 0.7)
|
||||
property color colIcon: expandedSize ? ((root.toggled) ? Appearance.colors.colOnPrimary : Appearance.colors.colOnLayer3) : colText
|
||||
|
||||
onClicked: {
|
||||
if (root.expandedSize && root.altAction) root.altAction();
|
||||
|
||||
Reference in New Issue
Block a user