From f3f0f611cb4b1b243a3c5c9388e8afdc755e279a Mon Sep 17 00:00:00 2001 From: Ly-sec Date: Tue, 26 Aug 2025 14:31:59 +0200 Subject: [PATCH] Add AppLauncher opacity, topCenter & bottomCenter --- Commons/Settings.qml | 3 +- Modules/Launcher/Launcher.qml | 8 ++++- Modules/SettingsPanel/Tabs/LauncherTab.qml | 42 ++++++++++++++++++++++ Widgets/NPanel.qml | 40 +++++++++++++++------ 4 files changed, 80 insertions(+), 13 deletions(-) diff --git a/Commons/Settings.qml b/Commons/Settings.qml index a9de196..c785ff3 100644 --- a/Commons/Settings.qml +++ b/Commons/Settings.qml @@ -188,8 +188,9 @@ Singleton { property JsonObject appLauncher: JsonObject { // When disabled, Launcher hides clipboard command and ignores cliphist property bool enableClipboardHistory: true - // Position: center, top_left, top_right, bottom_left, bottom_right + // Position: center, top_left, top_right, bottom_left, bottom_right, bottom_center, top_center property string position: "center" + property real backgroundOpacity: 1.0 property list pinnedExecs: [] } diff --git a/Modules/Launcher/Launcher.qml b/Modules/Launcher/Launcher.qml index 6b5f4e0..8bfbae5 100644 --- a/Modules/Launcher/Launcher.qml +++ b/Modules/Launcher/Launcher.qml @@ -18,11 +18,17 @@ NPanel { panelHeight: Math.min(550 * scaling, screen?.height * 0.8) // Positioning derives from Settings.data.bar.position for vertical (top/bottom) // and from Settings.data.appLauncher.position for horizontal vs center. - // Options: center, top_left, top_right, bottom_left, bottom_right + // Options: center, top_left, top_right, bottom_left, bottom_right, bottom_center, top_center readonly property string launcherPosition: Settings.data.appLauncher.position panelAnchorCentered: launcherPosition === "center" panelAnchorLeft: launcherPosition !== "center" && (launcherPosition.endsWith("_left")) panelAnchorRight: launcherPosition !== "center" && (launcherPosition.endsWith("_right")) + panelAnchorBottomCentered: launcherPosition === "bottom_center" + panelAnchorTopCentered: launcherPosition === "top_center" + + // Background opacity following bar's approach + panelBackgroundColor: Qt.rgba(Color.mSurface.r, Color.mSurface.g, Color.mSurface.b, + Settings.data.appLauncher.backgroundOpacity) // Properties property string searchText: "" diff --git a/Modules/SettingsPanel/Tabs/LauncherTab.qml b/Modules/SettingsPanel/Tabs/LauncherTab.qml index ae10ade..d2e6f36 100644 --- a/Modules/SettingsPanel/Tabs/LauncherTab.qml +++ b/Modules/SettingsPanel/Tabs/LauncherTab.qml @@ -89,12 +89,54 @@ ColumnLayout { key: "bottom_right" name: "Bottom Right" } + ListElement { + key: "bottom_center" + name: "Bottom Center" + } + ListElement { + key: "top_center" + name: "Top Center" + } } currentKey: Settings.data.appLauncher.position onSelected: function (key) { Settings.data.appLauncher.position = key } } + + NDivider { + Layout.fillWidth: true + Layout.topMargin: Style.marginL * scaling + Layout.bottomMargin: Style.marginS * scaling + } + + NText { + text: "Launcher Background" + font.pointSize: Style.fontSizeXXL * scaling + font.weight: Style.fontWeightBold + color: Color.mOnSurface + Layout.bottomMargin: Style.marginS * scaling + } + + RowLayout { + NSlider { + id: launcherBgOpacity + Layout.fillWidth: true + from: 0.0 + to: 1.0 + stepSize: 0.01 + value: Settings.data.appLauncher.backgroundOpacity + onMoved: Settings.data.appLauncher.backgroundOpacity = value + cutoutColor: Color.mSurface + } + + NText { + text: Math.floor(Settings.data.appLauncher.backgroundOpacity * 100) + "%" + Layout.alignment: Qt.AlignVCenter + Layout.leftMargin: Style.marginS * scaling + color: Color.mOnSurface + } + } } } } diff --git a/Widgets/NPanel.qml b/Widgets/NPanel.qml index 4d14478..2ab1434 100644 --- a/Widgets/NPanel.qml +++ b/Widgets/NPanel.qml @@ -19,6 +19,9 @@ Loader { property bool panelAnchorCentered: false property bool panelAnchorLeft: false property bool panelAnchorRight: false + property bool panelAnchorBottomCentered: false + property bool panelAnchorTopCentered: false + property color panelBackgroundColor: Color.mSurface // Animation properties readonly property real originalScale: 0.7 @@ -132,7 +135,7 @@ Loader { Rectangle { id: panelBackground - color: Color.mSurface + color: panelBackgroundColor radius: Style.radiusL * scaling border.color: Color.mOutline border.width: Math.max(1, Style.borderS * scaling) @@ -141,18 +144,33 @@ Loader { height: panelHeight anchors { - centerIn: panelAnchorCentered ? parent : null - left: !panelAnchorCentered && panelAnchorLeft ? parent.left : parent.center - right: !panelAnchorCentered && panelAnchorRight ? parent.right : parent.center - top: !panelAnchorCentered && (Settings.data.bar.position === "top") ? parent.top : undefined - bottom: !panelAnchorCentered && (Settings.data.bar.position === "bottom") ? parent.bottom : undefined + // Top/bottom centered modes + horizontalCenter: (panelAnchorTopCentered || panelAnchorBottomCentered) ? parent.horizontalCenter : undefined + top: panelAnchorTopCentered ? parent.top : (!panelAnchorTopCentered && !panelAnchorBottomCentered + && !panelAnchorCentered + && (Settings.data.bar.position === "top") ? parent.top : undefined) + bottom: panelAnchorBottomCentered ? parent.bottom : ((!panelAnchorBottomCentered && !panelAnchorCentered + && (Settings.data.bar.position === "bottom")) ? parent.bottom : undefined) + + // Fully centered mode + centerIn: (!panelAnchorTopCentered && !panelAnchorBottomCentered && panelAnchorCentered) ? parent : null + + // Side-anchored modes + left: (!panelAnchorTopCentered && !panelAnchorBottomCentered && !panelAnchorCentered + && panelAnchorLeft) ? parent.left : parent.center + right: (!panelAnchorTopCentered && !panelAnchorBottomCentered && !panelAnchorCentered + && panelAnchorRight) ? parent.right : parent.center // margins - topMargin: !panelAnchorCentered - && (Settings.data.bar.position === "top") ? Style.marginS * scaling : undefined - bottomMargin: !panelAnchorCentered - && (Settings.data.bar.position === "bottom") ? Style.marginS * scaling : undefined - rightMargin: !panelAnchorCentered && panelAnchorRight ? Style.marginS * scaling : undefined + topMargin: panelAnchorTopCentered ? Style.marginS * scaling : (!panelAnchorBottomCentered + && !panelAnchorCentered + && (Settings.data.bar.position + === "top")) ? Style.marginS * scaling : undefined + bottomMargin: panelAnchorBottomCentered ? Style.marginS * scaling : (!panelAnchorCentered + && (Settings.data.bar.position + === "bottom") ? Style.marginS * scaling : undefined) + rightMargin: (!panelAnchorTopCentered && !panelAnchorBottomCentered && !panelAnchorCentered + && panelAnchorRight) ? Style.marginS * scaling : undefined } scale: root.scaleValue