Bar: add floating setting

This commit is contained in:
Ly-sec 2025-09-13 10:11:57 +02:00
parent ae931b791f
commit 50d8b54adf
4 changed files with 216 additions and 1 deletions

View file

@ -267,6 +267,14 @@ Singleton {
property real backgroundOpacity: 1.0
property list<string> monitors: []
// Floating bar settings
property bool floating: false
property real rounding: 12.0
property real marginTop: 16.0
property real marginBottom: 16.0
property real marginLeft: 16.0
property real marginRight: 16.0
property bool showActiveWindowIcon: true // TODO: delete
property bool alwaysShowBatteryPercentage: false // TODO: delete
property bool showNetworkStats: false // TODO: delete

View file

@ -7,7 +7,7 @@ import qs.Services
import qs.Widgets
Loader {
active: Settings.data.general.showScreenCorners
active: Settings.data.general.showScreenCorners && !Settings.data.bar.floating
sourceComponent: Variants {
model: Quickshell.screens

View file

@ -44,6 +44,14 @@ Variants {
right: true
}
// Floating bar margins - only apply when floating is enabled
margins {
top: Settings.data.bar.marginTop
bottom: Settings.data.bar.marginBottom
left: Settings.data.bar.floating ? Settings.data.bar.marginLeft : 0
right: Settings.data.bar.floating ? Settings.data.bar.marginRight : 0
}
Item {
anchors.fill: parent
clip: true
@ -54,6 +62,9 @@ Variants {
anchors.fill: parent
color: Qt.alpha(Color.mSurface, Settings.data.bar.backgroundOpacity)
// Floating bar rounded corners
radius: Settings.data.bar.floating ? Settings.data.bar.rounding : 0
}
// ------------------------------

View file

@ -86,6 +86,202 @@ ColumnLayout {
}
}
}
NToggle {
Layout.fillWidth: true
label: "Floating Bar"
description: "Make the bar float with rounded corners and margins. This will hide screen corners."
checked: Settings.data.bar.floating
onToggled: checked => Settings.data.bar.floating = checked
}
// Floating bar options - only show when floating is enabled
ColumnLayout {
visible: Settings.data.bar.floating
spacing: Style.marginXXS * scaling
Layout.fillWidth: true
NText {
text: "Rounding"
font.pointSize: Style.fontSizeL * scaling
font.weight: Style.fontWeightBold
color: Color.mOnSurface
}
NText {
text: "Adjust the corner rounding of the floating bar."
font.pointSize: Style.fontSizeXS * scaling
color: Color.mOnSurfaceVariant
wrapMode: Text.WordWrap
Layout.fillWidth: true
}
RowLayout {
NSlider {
Layout.fillWidth: true
from: 0
to: 50
stepSize: 1
value: Settings.data.bar.rounding
onMoved: Settings.data.bar.rounding = value
cutoutColor: Color.mSurface
}
NText {
text: Math.round(Settings.data.bar.rounding) + "px"
Layout.alignment: Qt.AlignVCenter
Layout.leftMargin: Style.marginS * scaling
Layout.preferredWidth: 50
horizontalAlignment: Text.AlignRight
color: Color.mOnSurface
}
}
NText {
text: "Margins"
font.pointSize: Style.fontSizeL * scaling
font.weight: Style.fontWeightBold
color: Color.mOnSurface
Layout.topMargin: Style.marginM * scaling
}
NText {
text: "Adjust the margins around the floating bar."
font.pointSize: Style.fontSizeXS * scaling
color: Color.mOnSurfaceVariant
wrapMode: Text.WordWrap
Layout.fillWidth: true
}
GridLayout {
columns: 2
Layout.fillWidth: true
rowSpacing: Style.marginS * scaling
columnSpacing: Style.marginS * scaling
ColumnLayout {
spacing: Style.marginXXS * scaling
NText {
text: "Top"
font.pointSize: Style.fontSizeXS * scaling
color: Color.mOnSurfaceVariant
}
RowLayout {
NSlider {
Layout.fillWidth: true
from: 0
to: 50
stepSize: 1
value: Settings.data.bar.marginTop
onMoved: Settings.data.bar.marginTop = value
cutoutColor: Color.mSurface
}
NText {
text: Math.round(Settings.data.bar.marginTop) + "px"
Layout.alignment: Qt.AlignVCenter
Layout.leftMargin: Style.marginXS * scaling
color: Color.mOnSurface
}
}
}
ColumnLayout {
spacing: Style.marginXXS * scaling
NText {
text: "Bottom"
font.pointSize: Style.fontSizeXS * scaling
color: Color.mOnSurfaceVariant
}
RowLayout {
NSlider {
Layout.fillWidth: true
from: 0
to: 50
stepSize: 1
value: Settings.data.bar.marginBottom
onMoved: Settings.data.bar.marginBottom = value
cutoutColor: Color.mSurface
}
NText {
text: Math.round(Settings.data.bar.marginBottom) + "px"
Layout.alignment: Qt.AlignVCenter
Layout.leftMargin: Style.marginXS * scaling
Layout.preferredWidth: 50
horizontalAlignment: Text.AlignRight
color: Color.mOnSurface
}
}
}
ColumnLayout {
spacing: Style.marginXXS * scaling
NText {
text: "Left"
font.pointSize: Style.fontSizeXS * scaling
color: Color.mOnSurfaceVariant
}
RowLayout {
NSlider {
Layout.fillWidth: true
from: 0
to: 50
stepSize: 1
value: Settings.data.bar.marginLeft
onMoved: Settings.data.bar.marginLeft = value
cutoutColor: Color.mSurface
}
NText {
text: Math.round(Settings.data.bar.marginLeft) + "px"
Layout.alignment: Qt.AlignVCenter
Layout.leftMargin: Style.marginXS * scaling
Layout.preferredWidth: 50
horizontalAlignment: Text.AlignRight
color: Color.mOnSurface
}
}
}
ColumnLayout {
spacing: Style.marginXXS * scaling
NText {
text: "Right"
font.pointSize: Style.fontSizeXS * scaling
color: Color.mOnSurfaceVariant
}
RowLayout {
NSlider {
Layout.fillWidth: true
from: 0
to: 50
stepSize: 1
value: Settings.data.bar.marginRight
onMoved: Settings.data.bar.marginRight = value
cutoutColor: Color.mSurface
}
NText {
text: Math.round(Settings.data.bar.marginRight) + "px"
Layout.alignment: Qt.AlignVCenter
Layout.leftMargin: Style.marginXS * scaling
Layout.preferredWidth: 50
horizontalAlignment: Text.AlignRight
color: Color.mOnSurface
}
}
}
}
}
}
NDivider {