diff --git a/quickshell/settings/controls/BarEditor.qml b/quickshell/settings/controls/BarEditor.qml index 61e0050..7a172f6 100644 --- a/quickshell/settings/controls/BarEditor.qml +++ b/quickshell/settings/controls/BarEditor.qml @@ -194,26 +194,45 @@ Item { id:optionsColumn visible:card.expanded anchors {left:parent.left;right:parent.right;top:parent.top;topMargin:50;leftMargin:12;rightMargin:10} - spacing:6 + spacing:10 Repeater { model:card.schema - RowLayout { + // Label line (with a toggle or a slider's value), then the control at + // the card's full width: lanes are narrow, so nothing sits beside a field. + ColumnLayout { id:optionRow required property var modelData readonly property var value:root.valueOf(card.modelData,modelData) + readonly property string kind:modelData.type + readonly property bool numeric:kind==="integer" || kind==="number" Layout.fillWidth:true - spacing:8 - Text {text:optionRow.modelData.label;color:Theme.textSecondary;font.pixelSize:11;Layout.fillWidth:true;elide:Text.ElideRight - HoverHandler {id:labelHover} - GlassToolTip { - visible: labelHover.hovered && !!optionRow.modelData.description - delay: 600 - text: optionRow.modelData.description || "" - }} + spacing:3 + RowLayout { + Layout.fillWidth:true + spacing:8 + Text {text:optionRow.modelData.label;color:Theme.textSecondary;font.pixelSize:11;Layout.fillWidth:true;wrapMode:Text.Wrap + HoverHandler {id:labelHover} + GlassToolTip { + visible: labelHover.hovered && !!optionRow.modelData.description + delay: 600 + text: optionRow.modelData.description || "" + }} + GlassToggle { + visible:optionRow.kind==="boolean" + checked:optionRow.value===true + onToggled:root.setOption(card.modelData,optionRow.modelData.key,checked) + } + Text { + visible:optionRow.numeric + text:optionRow.value===undefined ? "" : String(optionRow.value)+(optionRow.modelData.unit ? " "+optionRow.modelData.unit : "") + color:Theme.text;font.pixelSize:11 + horizontalAlignment:Text.AlignRight + } + } GlassComboBox { objectName:"bar-option-"+card.modelData.id+"-"+optionRow.modelData.key - visible:optionRow.modelData.type==="choice" - Layout.preferredWidth:110 + visible:optionRow.kind==="choice" + Layout.fillWidth:true implicitHeight:30 model:(optionRow.modelData.choices || []).map((c,i)=>({text:optionRow.modelData.choiceLabels ? optionRow.modelData.choiceLabels[i] : String(c).charAt(0).toUpperCase()+String(c).slice(1),value:c})) textRole:"text" @@ -221,30 +240,19 @@ Item { currentIndex:(optionRow.modelData.choices || []).indexOf(optionRow.value) onActivated:root.setOption(card.modelData,optionRow.modelData.key,currentValue) } - GlassToggle { - visible:optionRow.modelData.type==="boolean" - checked:optionRow.value===true - onToggled:root.setOption(card.modelData,optionRow.modelData.key,checked) - } - Text { - visible:optionRow.modelData.type==="integer" || optionRow.modelData.type==="number" - text:optionRow.value===undefined ? "" : String(optionRow.value) - color:Theme.text;font.pixelSize:11 - Layout.preferredWidth:26;horizontalAlignment:Text.AlignRight - } GlassSlider { - visible:optionRow.modelData.type==="integer" || optionRow.modelData.type==="number" - Layout.preferredWidth:90 + visible:optionRow.numeric + Layout.fillWidth:true implicitHeight:26 from:Number(optionRow.modelData.min !== undefined ? optionRow.modelData.min : 0) to:Number(optionRow.modelData.max !== undefined ? optionRow.modelData.max : 100) - stepSize:Number(optionRow.modelData.step || (optionRow.modelData.type==="integer" ? 1 : 0.1)) + stepSize:Number(optionRow.modelData.step || (optionRow.kind==="integer" ? 1 : 0.1)) value:Number(optionRow.value || 0) - onMoved:root.setOption(card.modelData,optionRow.modelData.key,optionRow.modelData.type==="integer" ? Math.round(value) : value) + onMoved:root.setOption(card.modelData,optionRow.modelData.key,optionRow.kind==="integer" ? Math.round(value) : value) } GlassTextField { - visible:optionRow.modelData.type==="string" - Layout.preferredWidth:110 + visible:optionRow.kind==="string" + Layout.fillWidth:true implicitHeight:30 text:optionRow.value===undefined ? "" : String(optionRow.value) onEditingFinished:root.setOption(card.modelData,optionRow.modelData.key,text)