Merge branch 'main' into vertical-bar

This commit is contained in:
LemmyCook 2025-09-13 13:06:21 -04:00
commit de72236fe5
5 changed files with 69 additions and 172 deletions

View file

@ -269,11 +269,8 @@ Singleton {
// Floating bar settings // Floating bar settings
property bool floating: false property bool floating: false
property real rounding: 12.0 property real marginVertical: 0.25
property real marginTop: 16.0 property real marginHorizontal: 0.25
property real marginBottom: 16.0
property real marginLeft: 16.0
property real marginRight: 16.0
property bool showActiveWindowIcon: true // TODO: delete property bool showActiveWindowIcon: true // TODO: delete
property bool alwaysShowBatteryPercentage: false // TODO: delete property bool alwaysShowBatteryPercentage: false // TODO: delete

View file

@ -47,10 +47,10 @@ Variants {
// Floating bar margins - only apply when floating is enabled // Floating bar margins - only apply when floating is enabled
margins { margins {
top: Settings.data.bar.floating ? Settings.data.bar.marginTop : 0 top: Settings.data.bar.floating ? Settings.data.bar.marginVertical * Style.marginXL : 0
bottom: Settings.data.bar.floating ? Settings.data.bar.marginBottom : 0 bottom: Settings.data.bar.floating ? Settings.data.bar.marginVertical * Style.marginXL : 0
left: Settings.data.bar.floating ? Settings.data.bar.marginLeft : 0 left: Settings.data.bar.floating ? Settings.data.bar.marginHorizontal * Style.marginXL : 0
right: Settings.data.bar.floating ? Settings.data.bar.marginRight : 0 right: Settings.data.bar.floating ? Settings.data.bar.marginHorizontal * Style.marginXL : 0
} }
Item { Item {
@ -65,7 +65,7 @@ Variants {
color: Qt.alpha(Color.mSurface, Settings.data.bar.backgroundOpacity) color: Qt.alpha(Color.mSurface, Settings.data.bar.backgroundOpacity)
// Floating bar rounded corners // Floating bar rounded corners
radius: Settings.data.bar.floating ? Settings.data.bar.rounding : 0 radius: Settings.data.bar.floating ? Style.radiusL : 0
} }
// For vertical bars, use a single column layout // For vertical bars, use a single column layout

View file

@ -209,7 +209,7 @@ Variants {
anchors.centerIn: parent anchors.centerIn: parent
radius: Style.radiusL * scaling radius: Style.radiusL * scaling
border.width: Math.max(1, Style.borderS * scaling) border.width: Math.max(1, Style.borderS * scaling)
border.color: Color.mOutline border.color: Qt.alpha(Color.mOutline, Settings.data.dock.backgroundOpacity)
MouseArea { MouseArea {
id: dockMouseArea id: dockMouseArea

View file

@ -106,72 +106,23 @@ ColumnLayout {
// Floating bar options - only show when floating is enabled // Floating bar options - only show when floating is enabled
ColumnLayout { ColumnLayout {
visible: Settings.data.bar.floating visible: Settings.data.bar.floating
spacing: Style.marginXXS * scaling spacing: Style.marginS * scaling
Layout.fillWidth: true Layout.fillWidth: true
NText { NLabel {
text: "Rounding" label: "Margins"
font.pointSize: Style.fontSizeL * scaling description: "Adjust the margins around the floating bar."
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 { 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 Layout.fillWidth: true
} spacing: Style.marginL * scaling
GridLayout {
columns: 2
Layout.fillWidth: true
rowSpacing: Style.marginS * scaling
columnSpacing: Style.marginS * scaling
ColumnLayout { ColumnLayout {
spacing: Style.marginXXS * scaling spacing: Style.marginXXS * scaling
NText { NText {
text: "Top" text: "Vertical"
font.pointSize: Style.fontSizeXS * scaling font.pointSize: Style.fontSizeXS * scaling
color: Color.mOnSurfaceVariant color: Color.mOnSurfaceVariant
} }
@ -180,44 +131,15 @@ ColumnLayout {
NSlider { NSlider {
Layout.fillWidth: true Layout.fillWidth: true
from: 0 from: 0
to: 50 to: 1
stepSize: 1 stepSize: 0.01
value: Settings.data.bar.marginTop value: Settings.data.bar.marginVertical
onMoved: Settings.data.bar.marginTop = value onMoved: Settings.data.bar.marginVertical = value
cutoutColor: Color.mSurface cutoutColor: Color.mSurface
} }
NText { NText {
text: Math.round(Settings.data.bar.marginTop) + "px" text: Math.round(Settings.data.bar.marginVertical * 100) + "%"
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.alignment: Qt.AlignVCenter
Layout.leftMargin: Style.marginXS * scaling Layout.leftMargin: Style.marginXS * scaling
Layout.preferredWidth: 50 Layout.preferredWidth: 50
@ -231,7 +153,7 @@ ColumnLayout {
spacing: Style.marginXXS * scaling spacing: Style.marginXXS * scaling
NText { NText {
text: "Left" text: "Horizontal"
font.pointSize: Style.fontSizeXS * scaling font.pointSize: Style.fontSizeXS * scaling
color: Color.mOnSurfaceVariant color: Color.mOnSurfaceVariant
} }
@ -240,46 +162,15 @@ ColumnLayout {
NSlider { NSlider {
Layout.fillWidth: true Layout.fillWidth: true
from: 0 from: 0
to: 50 to: 1
stepSize: 1 stepSize: 0.01
value: Settings.data.bar.marginLeft value: Settings.data.bar.marginHorizontal
onMoved: Settings.data.bar.marginLeft = value onMoved: Settings.data.bar.marginHorizontal = value
cutoutColor: Color.mSurface cutoutColor: Color.mSurface
} }
NText { NText {
text: Math.round(Settings.data.bar.marginLeft) + "px" text: Math.round(Settings.data.bar.marginHorizontal * 100) + "%"
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.alignment: Qt.AlignVCenter
Layout.leftMargin: Style.marginXS * scaling Layout.leftMargin: Style.marginXS * scaling
Layout.preferredWidth: 50 Layout.preferredWidth: 50

View file

@ -15,6 +15,8 @@ Singleton {
property bool isHyprland: false property bool isHyprland: false
property bool isNiri: false property bool isNiri: false
readonly property string hyprlandSignature: Quickshell.env("HYPRLAND_INSTANCE_SIGNATURE")
// Generic workspace and window data // Generic workspace and window data
property ListModel workspaces: ListModel {} property ListModel workspaces: ListModel {}
property var windows: [] property var windows: []
@ -50,42 +52,49 @@ Singleton {
} }
// Hyprland connections // Hyprland connections
Connections { Loader {
target: Hyprland.workspaces active: isHyprland
enabled: isHyprland sourceComponent: Component {
function onValuesChanged() { Item {
try { Connections {
updateHyprlandWorkspaces() target: Hyprland.workspaces
workspaceChanged() enabled: isHyprland
} catch (e) { function onValuesChanged() {
Logger.error("Compositor", "Error in workspaces onValuesChanged:", e) try {
} updateHyprlandWorkspaces()
} workspaceChanged()
} } catch (e) {
Logger.error("Compositor", "Error in workspaces onValuesChanged:", e)
}
}
}
Connections { Connections {
target: Hyprland.toplevels target: Hyprland.toplevels
enabled: isHyprland enabled: isHyprland
function onValuesChanged() { function onValuesChanged() {
try { try {
// Use debounced update to prevent too frequent calls // Use debounced update to prevent too frequent calls
updateTimer.restart() updateTimer.restart()
} catch (e) { } catch (e) {
Logger.error("Compositor", "Error in toplevels onValuesChanged:", e) Logger.error("Compositor", "Error in toplevels onValuesChanged:", e)
} }
} }
} }
Connections { Connections {
target: Hyprland target: Hyprland
enabled: isHyprland enabled: isHyprland
function onRawEvent(event) { function onRawEvent(event) {
try { try {
updateHyprlandWorkspaces() updateHyprlandWorkspaces()
workspaceChanged() workspaceChanged()
updateTimer.restart() updateTimer.restart()
} catch (e) { } catch (e) {
Logger.error("Compositor", "Error in rawEvent:", e) Logger.error("Compositor", "Error in rawEvent:", e)
}
}
}
} }
} }
} }
@ -93,7 +102,7 @@ Singleton {
function detectCompositor() { function detectCompositor() {
try { try {
// Try Hyprland first // Try Hyprland first
if (Hyprland.eventSocketPath) { if (hyprlandSignature && hyprlandSignature.length > 0) {
compositorType = "hyprland" compositorType = "hyprland"
isHyprland = true isHyprland = true
isNiri = false isNiri = false