mirror of
https://github.com/end-4/dots-hyprland.git
synced 2026-06-05 23:09:26 -05:00
49 lines
1.5 KiB
QML
49 lines
1.5 KiB
QML
import QtQuick
|
|
import QtQuick.Controls
|
|
import QtQuick.Layouts
|
|
import Quickshell
|
|
import Quickshell.Io
|
|
import Quickshell.Hyprland
|
|
import "root:/services/"
|
|
import "root:/modules/common/"
|
|
import "root:/modules/common/widgets/"
|
|
import "root:/modules/common/functions/color_utils.js" as ColorUtils
|
|
import "root:/modules/common/functions/file_utils.js" as FileUtils
|
|
|
|
Flow {
|
|
id: root
|
|
Layout.fillWidth: true
|
|
spacing: 2
|
|
property list<var> options: []
|
|
property string configOptionName: ""
|
|
property var currentValue: null
|
|
|
|
signal selected(var newValue)
|
|
|
|
Repeater {
|
|
model: root.options
|
|
delegate: SelectionGroupButton {
|
|
id: paletteButton
|
|
required property var modelData
|
|
required property int index
|
|
onYChanged: {
|
|
if (index === 0) {
|
|
paletteButton.leftmost = true
|
|
} else {
|
|
var prev = root.children[index - 1]
|
|
var thisIsOnNewLine = prev && prev.y !== paletteButton.y
|
|
paletteButton.leftmost = thisIsOnNewLine
|
|
prev.rightmost = thisIsOnNewLine
|
|
}
|
|
}
|
|
leftmost: index === 0
|
|
rightmost: index === root.options.length - 1
|
|
buttonText: modelData.displayName;
|
|
toggled: root.currentValue === modelData.value
|
|
onClicked: {
|
|
root.selected(modelData.value);
|
|
}
|
|
}
|
|
}
|
|
}
|