From e57bf529cd6af1ebdb8a852d46e9446cf39399d4 Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Tue, 20 May 2025 10:17:04 +0200 Subject: [PATCH] bar: introduce borderless mode --- .config/quickshell/modules/bar/Battery.qml | 3 ++- .config/quickshell/modules/bar/ClockWidget.qml | 3 ++- .config/quickshell/modules/bar/Media.qml | 3 ++- .config/quickshell/modules/bar/Resources.qml | 3 ++- .config/quickshell/modules/bar/UtilButtons.qml | 4 +++- .config/quickshell/modules/bar/Workspaces.qml | 3 ++- .config/quickshell/modules/common/ConfigOptions.qml | 1 + 7 files changed, 14 insertions(+), 6 deletions(-) diff --git a/.config/quickshell/modules/bar/Battery.qml b/.config/quickshell/modules/bar/Battery.qml index 2c75d0597..5def8560e 100644 --- a/.config/quickshell/modules/bar/Battery.qml +++ b/.config/quickshell/modules/bar/Battery.qml @@ -8,6 +8,7 @@ import Quickshell.Services.UPower Rectangle { id: root + property bool borderless: ConfigOptions.bar.borderless readonly property var chargeState: UPower.displayDevice.state readonly property bool isCharging: chargeState == UPowerDeviceState.Charging readonly property bool isPluggedIn: isCharging || chargeState == UPowerDeviceState.PendingCharge @@ -18,7 +19,7 @@ Rectangle { implicitWidth: rowLayout.implicitWidth + rowLayout.spacing * 2 implicitHeight: 32 - color: Appearance.colors.colLayer1 + color: borderless ? "transparent" : Appearance.colors.colLayer1 radius: Appearance.rounding.small RowLayout { diff --git a/.config/quickshell/modules/bar/ClockWidget.qml b/.config/quickshell/modules/bar/ClockWidget.qml index e44ac7f5a..080dfb9b8 100644 --- a/.config/quickshell/modules/bar/ClockWidget.qml +++ b/.config/quickshell/modules/bar/ClockWidget.qml @@ -5,9 +5,10 @@ import QtQuick import QtQuick.Layouts Rectangle { + property bool borderless: ConfigOptions.bar.borderless implicitWidth: rowLayout.implicitWidth + rowLayout.spacing * 6 // idk, text seems nicer w/ more padding implicitHeight: 32 - color: Appearance.colors.colLayer1 + color: borderless ? "transparent" : Appearance.colors.colLayer1 radius: Appearance.rounding.small RowLayout { diff --git a/.config/quickshell/modules/bar/Media.qml b/.config/quickshell/modules/bar/Media.qml index 2cebc4d35..f4b8606b9 100644 --- a/.config/quickshell/modules/bar/Media.qml +++ b/.config/quickshell/modules/bar/Media.qml @@ -11,6 +11,7 @@ import Quickshell.Hyprland Item { id: root + property bool borderless: ConfigOptions.bar.borderless readonly property MprisPlayer activePlayer: MprisController.activePlayer readonly property string cleanedTitle: StringUtils.cleanMusicTitle(activePlayer?.trackTitle) || qsTr("No media") @@ -45,7 +46,7 @@ Item { anchors.centerIn: parent width: parent.width implicitHeight: 32 - color: Appearance.colors.colLayer1 + color: borderless ? "transparent" : Appearance.colors.colLayer1 radius: Appearance.rounding.small } diff --git a/.config/quickshell/modules/bar/Resources.qml b/.config/quickshell/modules/bar/Resources.qml index db7741b2c..3f82c9950 100644 --- a/.config/quickshell/modules/bar/Resources.qml +++ b/.config/quickshell/modules/bar/Resources.qml @@ -8,9 +8,10 @@ import Quickshell.Io import Quickshell.Services.Mpris Rectangle { + property bool borderless: ConfigOptions.bar.borderless implicitWidth: rowLayout.implicitWidth + rowLayout.anchors.leftMargin + rowLayout.anchors.rightMargin implicitHeight: 32 - color: Appearance.colors.colLayer1 + color: borderless ? "transparent" : Appearance.colors.colLayer1 radius: Appearance.rounding.small RowLayout { diff --git a/.config/quickshell/modules/bar/UtilButtons.qml b/.config/quickshell/modules/bar/UtilButtons.qml index 62c1f45be..1f0a09f91 100644 --- a/.config/quickshell/modules/bar/UtilButtons.qml +++ b/.config/quickshell/modules/bar/UtilButtons.qml @@ -7,10 +7,12 @@ import Quickshell.Io import Quickshell.Hyprland Rectangle { + id: root + property bool borderless: ConfigOptions.bar.borderless Layout.alignment: Qt.AlignVCenter implicitWidth: rowLayout.implicitWidth + rowLayout.spacing * 2 implicitHeight: 32 - color: Appearance.colors.colLayer1 + color: borderless ? "transparent" : Appearance.colors.colLayer1 radius: Appearance.rounding.small RowLayout { diff --git a/.config/quickshell/modules/bar/Workspaces.qml b/.config/quickshell/modules/bar/Workspaces.qml index d3a701e8c..b00738f61 100644 --- a/.config/quickshell/modules/bar/Workspaces.qml +++ b/.config/quickshell/modules/bar/Workspaces.qml @@ -15,6 +15,7 @@ import Qt5Compat.GraphicalEffects Item { required property var bar + property bool borderless: ConfigOptions.bar.borderless readonly property HyprlandMonitor monitor: Hyprland.monitorFor(bar.screen) readonly property Toplevel activeWindow: ToplevelManager.activeToplevel @@ -66,7 +67,7 @@ Item { implicitHeight: 32 implicitWidth: rowLayout.implicitWidth + widgetPadding * 2 radius: Appearance.rounding.small - color: Appearance.colors.colLayer1 + color: borderless ? "transparent" : Appearance.colors.colLayer1 } // Scroll to switch workspaces diff --git a/.config/quickshell/modules/common/ConfigOptions.qml b/.config/quickshell/modules/common/ConfigOptions.qml index 8b8b5f4e9..e2bc31b33 100644 --- a/.config/quickshell/modules/common/ConfigOptions.qml +++ b/.config/quickshell/modules/common/ConfigOptions.qml @@ -25,6 +25,7 @@ Singleton { property int batteryLowThreshold: 20 property string topLeftIcon: "spark" // Options: distro, spark property bool showBackground: true + property bool borderless: false property QtObject resources: QtObject { property bool alwaysShowSwap: true property bool alwaysShowCpu: false