Files
illogical-impulse/.config/quickshell/ii/modules/common/widgets/SelectionGroupButton.qml
T
2025-09-01 22:19:16 +02:00

50 lines
1.6 KiB
QML

import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import Quickshell
import Quickshell.Io
import Quickshell.Hyprland
import qs.services
import qs.modules.common
import qs.modules.common.widgets
GroupButton {
id: root
horizontalPadding: 12
verticalPadding: 8
bounce: false
property string buttonIcon
property bool leftmost: false
property bool rightmost: false
leftRadius: (toggled || leftmost) ? (height / 2) : Appearance.rounding.unsharpenmore
rightRadius: (toggled || rightmost) ? (height / 2) : Appearance.rounding.unsharpenmore
colBackground: Appearance.colors.colSecondaryContainer
colBackgroundHover: Appearance.colors.colSecondaryContainerHover
colBackgroundActive: Appearance.colors.colSecondaryContainerActive
contentItem: RowLayout {
spacing: 4
Loader {
Layout.alignment: Qt.AlignVCenter
active: root.buttonIcon && root.buttonIcon.length > 0
visible: active
sourceComponent: Item {
implicitWidth: materialSymbol.implicitWidth
MaterialSymbol {
id: materialSymbol
anchors.centerIn: parent
text: root.buttonIcon
iconSize: Appearance.font.pixelSize.larger
color: root.toggled ? Appearance.colors.colOnPrimary : Appearance.colors.colOnSecondaryContainer
}
}
}
StyledText {
color: root.toggled ? Appearance.colors.colOnPrimary : Appearance.colors.colOnSecondaryContainer
text: root.buttonText
}
}
}