forked from Shinonome/dots-hyprland
refractor sidebar toggles group
This commit is contained in:
@@ -132,29 +132,17 @@ Scope {
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
ButtonGroup {
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
Layout.fillHeight: false
|
||||
radius: Appearance.rounding.full
|
||||
spacing: 5
|
||||
padding: 5
|
||||
color: Appearance.colors.colLayer1
|
||||
width: 40 * sidebarQuickControlsRow.children.length + sidebarQuickControlsRow.spacing * (sidebarQuickControlsRow.children.length-1) + 10
|
||||
implicitHeight: sidebarQuickControlsRow.implicitHeight + 10
|
||||
|
||||
|
||||
RowLayout {
|
||||
id: sidebarQuickControlsRow
|
||||
anchors.fill: parent
|
||||
anchors.margins: 5
|
||||
spacing: 5
|
||||
width: 40 * sidebarQuickControlsRow.children.length
|
||||
property int clickIndex: -1
|
||||
|
||||
NetworkToggle {}
|
||||
BluetoothToggle {}
|
||||
NightLight {}
|
||||
GameMode {}
|
||||
IdleInhibitor {}
|
||||
}
|
||||
NetworkToggle {}
|
||||
BluetoothToggle {}
|
||||
NightLight {}
|
||||
GameMode {}
|
||||
IdleInhibitor {}
|
||||
}
|
||||
|
||||
// Center widget group
|
||||
|
||||
@@ -6,23 +6,17 @@ import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
import Quickshell.Io
|
||||
|
||||
RippleButton {
|
||||
GroupButton {
|
||||
id: button
|
||||
rippleEnabled: false
|
||||
property string buttonIcon
|
||||
property int clickIndex: parent?.clickIndex ?? -1
|
||||
baseWidth: 40
|
||||
baseHeight: 40
|
||||
clickedWidth: 60
|
||||
clickedHeight: 40
|
||||
toggled: false
|
||||
buttonRadius: Appearance?.rounding?.full
|
||||
buttonRadius: Math.min(baseHeight, baseWidth) / 2
|
||||
buttonRadiusPressed: Appearance?.rounding?.small
|
||||
|
||||
Layout.fillWidth: (clickIndex - 1 <= parent.children.indexOf(button) && parent.children.indexOf(button) <= clickIndex + 1)
|
||||
implicitWidth: button.down ? 60 : 40
|
||||
implicitHeight: 40
|
||||
|
||||
Behavior on implicitWidth {
|
||||
animation: Appearance.animation.clickBounce.numberAnimation.createObject(this)
|
||||
}
|
||||
|
||||
onDownChanged: {
|
||||
if (button.down) {
|
||||
if (button.parent.clickIndex !== undefined) {
|
||||
|
||||
Reference in New Issue
Block a user