From 47c9d63210c11aba178d5c91d5e68ddb3da0a49e Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Sat, 21 Jun 2025 01:03:56 +0200 Subject: [PATCH] add center title config option --- .../modules/common/ConfigOptions.qml | 1 + .config/quickshell/modules/settings/Style.qml | 25 ++++++++++++++----- .config/quickshell/settings.qml | 7 +++++- .config/quickshell/welcome.qml | 7 +++++- 4 files changed, 32 insertions(+), 8 deletions(-) diff --git a/.config/quickshell/modules/common/ConfigOptions.qml b/.config/quickshell/modules/common/ConfigOptions.qml index 58331e368..d928aa3f3 100644 --- a/.config/quickshell/modules/common/ConfigOptions.qml +++ b/.config/quickshell/modules/common/ConfigOptions.qml @@ -154,6 +154,7 @@ Singleton { property QtObject windows: QtObject { property bool showTitlebar: true // Client-side decoration for shell apps + property bool centerTitle: true } property QtObject hacks: QtObject { diff --git a/.config/quickshell/modules/settings/Style.qml b/.config/quickshell/modules/settings/Style.qml index c86bce534..b168ba536 100644 --- a/.config/quickshell/modules/settings/Style.qml +++ b/.config/quickshell/modules/settings/Style.qml @@ -212,13 +212,26 @@ ContentPage { ContentSection { title: "Shell windows" + spacing: 4 - ConfigSwitch { - text: "Title bar" - checked: ConfigOptions.windows.showTitlebar - onClicked: checked = !checked; - onCheckedChanged: { - ConfigLoader.setConfigValueAndSave("windows.showTitlebar", checked); + RowLayout { + spacing: 10 + uniformCellSizes: true + ConfigSwitch { + text: "Title bar" + checked: ConfigOptions.windows.showTitlebar + onClicked: checked = !checked; + onCheckedChanged: { + ConfigLoader.setConfigValueAndSave("windows.showTitlebar", checked); + } + } + ConfigSwitch { + text: "Center title" + checked: ConfigOptions.windows.centerTitle + onClicked: checked = !checked; + onCheckedChanged: { + ConfigLoader.setConfigValueAndSave("windows.centerTitle", checked); + } } } } diff --git a/.config/quickshell/settings.qml b/.config/quickshell/settings.qml index f5a4b5838..eac2e65b9 100644 --- a/.config/quickshell/settings.qml +++ b/.config/quickshell/settings.qml @@ -73,7 +73,12 @@ ApplicationWindow { implicitHeight: Math.max(titleText.implicitHeight, windowControlsRow.implicitHeight) StyledText { id: titleText - anchors.centerIn: parent + anchors { + left: ConfigOptions.windows.centerTitle ? undefined : parent.left + horizontalCenter: ConfigOptions.windows.centerTitle ? parent.horizontalCenter : undefined + verticalCenter: parent.verticalCenter + leftMargin: 12 + } color: Appearance.colors.colOnLayer0 text: "Settings" font.pixelSize: Appearance.font.pixelSize.title diff --git a/.config/quickshell/welcome.qml b/.config/quickshell/welcome.qml index 4b7286be6..ee5a28eb5 100644 --- a/.config/quickshell/welcome.qml +++ b/.config/quickshell/welcome.qml @@ -65,7 +65,12 @@ ApplicationWindow { implicitHeight: Math.max(welcomeText.implicitHeight, windowControlsRow.implicitHeight) StyledText { id: welcomeText - anchors.centerIn: parent + anchors { + left: ConfigOptions.windows.centerTitle ? undefined : parent.left + horizontalCenter: ConfigOptions.windows.centerTitle ? parent.horizontalCenter : undefined + verticalCenter: parent.verticalCenter + leftMargin: 12 + } color: Appearance.colors.colOnLayer0 text: "Yooooo hi there" font.pixelSize: Appearance.font.pixelSize.title