forked from Shinonome/dots-hyprland
wactioncenter: bluetooth menu
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls
|
||||
import qs.modules.common
|
||||
import qs.modules.common.widgets
|
||||
import qs.modules.waffle.looks
|
||||
|
||||
Switch {
|
||||
id: root
|
||||
|
||||
PointingHandInteraction {}
|
||||
|
||||
implicitWidth: 40
|
||||
implicitHeight: 20
|
||||
property real indicatorHeight: 12
|
||||
property real indicatorPressedHeight: 14
|
||||
property real indicatorPressedWidth: 17
|
||||
property color checkedColor: Looks.colors.accent
|
||||
property color uncheckedColor: Looks.colors.bg1
|
||||
property color borderColor: Looks.colors.controlBgInactive
|
||||
|
||||
readonly property real indicatorPressedWidthDiff: indicatorPressedWidth - indicatorHeight
|
||||
|
||||
background: Rectangle {
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
radius: height / 2
|
||||
color: root.checked ? root.checkedColor : root.uncheckedColor
|
||||
border.width: 1
|
||||
border.color: root.checked ? root.checkedColor : root.borderColor
|
||||
|
||||
Behavior on color {
|
||||
animation: Appearance.animation.elementMoveFast.colorAnimation.createObject(this)
|
||||
}
|
||||
Behavior on border.color {
|
||||
animation: Appearance.animation.elementMoveFast.colorAnimation.createObject(this)
|
||||
}
|
||||
}
|
||||
|
||||
// Custom thumb styling
|
||||
indicator: Rectangle {
|
||||
implicitWidth: (root.pressed || root.down) ? root.indicatorPressedWidth : root.indicatorHeight
|
||||
implicitHeight: (root.pressed || root.down) ? root.indicatorPressedHeight : root.indicatorHeight
|
||||
radius: height / 2
|
||||
color: root.checked ? Looks.colors.accentFg : root.borderColor
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: {
|
||||
if (root.checked) {
|
||||
return 24 - (root.pressed || root.down ? root.indicatorPressedWidthDiff : 0);
|
||||
} else {
|
||||
return (root.pressed || root.down) ? 3 : 4
|
||||
}
|
||||
}
|
||||
|
||||
Behavior on anchors.leftMargin {
|
||||
animation: Looks.transition.enter.createObject(this)
|
||||
}
|
||||
Behavior on implicitWidth {
|
||||
animation: Looks.transition.resize.createObject(this)
|
||||
}
|
||||
Behavior on implicitHeight {
|
||||
animation: Looks.transition.resize.createObject(this)
|
||||
}
|
||||
Behavior on color {
|
||||
animation: Looks.transition.color.createObject(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user