From fac816137a5b33b8dd4c88f75d8c56912e1001c9 Mon Sep 17 00:00:00 2001 From: Ly-sec Date: Thu, 21 Aug 2025 15:26:33 +0200 Subject: [PATCH] Add Launcher settings, rename AppLauncher to Launcher --- Commons/Settings.qml | 4 + .../{AppLauncher => Launcher}/Calculator.qml | 0 .../ClipboardHistory.qml | 0 .../AppLauncher.qml => Launcher/Launcher.qml} | 56 ++++++------ Modules/SettingsPanel/SettingsPanel.qml | 10 +++ Modules/SettingsPanel/Tabs/BarTab.qml | 2 +- Modules/SettingsPanel/Tabs/LauncherTab.qml | 85 +++++++++++++++++++ README.md | 2 +- shell.qml | 4 +- 9 files changed, 133 insertions(+), 30 deletions(-) rename Modules/{AppLauncher => Launcher}/Calculator.qml (100%) rename Modules/{AppLauncher => Launcher}/ClipboardHistory.qml (100%) rename Modules/{AppLauncher/AppLauncher.qml => Launcher/Launcher.qml} (87%) create mode 100644 Modules/SettingsPanel/Tabs/LauncherTab.qml diff --git a/Commons/Settings.qml b/Commons/Settings.qml index 2f411ff..f83be15 100644 --- a/Commons/Settings.qml +++ b/Commons/Settings.qml @@ -194,6 +194,10 @@ Singleton { property JsonObject appLauncher 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 + property string position: "center" property list pinnedExecs: [] } diff --git a/Modules/AppLauncher/Calculator.qml b/Modules/Launcher/Calculator.qml similarity index 100% rename from Modules/AppLauncher/Calculator.qml rename to Modules/Launcher/Calculator.qml diff --git a/Modules/AppLauncher/ClipboardHistory.qml b/Modules/Launcher/ClipboardHistory.qml similarity index 100% rename from Modules/AppLauncher/ClipboardHistory.qml rename to Modules/Launcher/ClipboardHistory.qml diff --git a/Modules/AppLauncher/AppLauncher.qml b/Modules/Launcher/Launcher.qml similarity index 87% rename from Modules/AppLauncher/AppLauncher.qml rename to Modules/Launcher/Launcher.qml index 5adb8a3..9991f1a 100644 --- a/Modules/AppLauncher/AppLauncher.qml +++ b/Modules/Launcher/Launcher.qml @@ -16,7 +16,13 @@ NPanel { id: root panelWidth: Math.min(700 * scaling, screen?.width * 0.75) panelHeight: Math.min(550 * scaling, screen?.height * 0.8) - panelAnchorCentered: true + // 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 + readonly property string launcherPosition: Settings.data.appLauncher.position + panelAnchorCentered: launcherPosition === "center" + panelAnchorLeft: launcherPosition !== "center" && (launcherPosition.endsWith("_left")) + panelAnchorRight: launcherPosition !== "center" && (launcherPosition.endsWith("_right")) onOpened: { // Reset state when panel opens to avoid sticky modes @@ -38,7 +44,7 @@ NPanel { id: clipRefreshTimer interval: 2000 repeat: true - running: searchText.startsWith(">clip") + running: Settings.data.appLauncher.enableClipboardHistory && searchText.startsWith(">clip") onTriggered: clipboardHistory.refresh() } @@ -49,7 +55,7 @@ NPanel { // Refresh clipboard when user starts typing clipboard commands onSearchTextChanged: { - if (searchText.startsWith(">clip")) { + if (Settings.data.appLauncher.enableClipboardHistory && searchText.startsWith(">clip")) { clipboardHistory.refresh() } } @@ -57,11 +63,11 @@ NPanel { // Main filtering logic property var filteredEntries: { // Explicit dependency so changes to items/decoded images retrigger this binding - const _clipItems = CliphistService.items - const _clipRev = CliphistService.revision + const _clipItems = Settings.data.appLauncher.enableClipboardHistory ? CliphistService.items : [] + const _clipRev = Settings.data.appLauncher.enableClipboardHistory ? CliphistService.revision : 0 var query = searchText ? searchText.toLowerCase() : "" - if (query.startsWith(">clip")) { + if (Settings.data.appLauncher.enableClipboardHistory && query.startsWith(">clip")) { return clipboardHistory.processQuery(query, _clipItems) } @@ -88,14 +94,15 @@ NPanel { "icon": "calculate", "execute": executeCalcCommand }) - - results.push({ - "isCommand": true, - "name": ">clip", - "content": "Clipboard history - browse and restore clipboard items", - "icon": "content_paste", - "execute": executeClipCommand - }) + if (Settings.data.appLauncher.enableClipboardHistory) { + results.push({ + "isCommand": true, + "name": ">clip", + "content": "Clipboard history - browse and restore clipboard items", + "icon": "content_paste", + "execute": executeClipCommand + }) + } return results } @@ -106,7 +113,7 @@ NPanel { } // Handle direct math expressions after ">" - if (query.startsWith(">") && query.length > 1 && !query.startsWith(">clip") && !query.startsWith(">calc")) { + if (query.startsWith(">") && query.length > 1 && (!Settings.data.appLauncher.enableClipboardHistory || !query.startsWith(">clip")) && !query.startsWith(">calc")) { const mathResults = calculator.processQuery(query, "direct") if (mathResults.length > 0) { return mathResults @@ -189,14 +196,16 @@ NPanel { } Component.onCompleted: { - Logger.log("AppLauncher", "Component completed") - Logger.log("AppLauncher", "DesktopEntries available:", typeof DesktopEntries !== 'undefined') + Logger.log("Launcher", "Component completed") + Logger.log("Launcher", "DesktopEntries available:", typeof DesktopEntries !== 'undefined') if (typeof DesktopEntries !== 'undefined') { - Logger.log("AppLauncher", "DesktopEntries.entries:", + Logger.log("Launcher", "DesktopEntries.entries:", DesktopEntries.entries ? DesktopEntries.entries.length : 'undefined') } - // Start clipboard refresh immediately on open - clipboardHistory.refresh() + // Start clipboard refresh immediately on open if enabled + if (Settings.data.appLauncher.enableClipboardHistory) { + clipboardHistory.refresh() + } } // Main content container @@ -486,12 +495,7 @@ NPanel { // Results count NText { - text: searchText.startsWith( - ">clip") ? `${filteredEntries.length} clipboard item${filteredEntries.length - !== 1 ? 's' : ''}` : searchText.startsWith( - ">calc") ? `${filteredEntries.length} result${filteredEntries.length - !== 1 ? 's' : ''}` : `${filteredEntries.length} application${filteredEntries.length - !== 1 ? 's' : ''}` + text: searchText.startsWith(">clip") ? (Settings.data.appLauncher.enableClipboardHistory ? `${filteredEntries.length} clipboard item${filteredEntries.length !== 1 ? 's' : ''}` : `Clipboard history is disabled`) : searchText.startsWith(">calc") ? `${filteredEntries.length} result${filteredEntries.length !== 1 ? 's' : ''}` : `${filteredEntries.length} application${filteredEntries.length !== 1 ? 's' : ''}` font.pointSize: Style.fontSizeXS * scaling color: Color.mOnSurface horizontalAlignment: Text.AlignHCenter diff --git a/Modules/SettingsPanel/SettingsPanel.qml b/Modules/SettingsPanel/SettingsPanel.qml index 43fb19c..2df15d9 100644 --- a/Modules/SettingsPanel/SettingsPanel.qml +++ b/Modules/SettingsPanel/SettingsPanel.qml @@ -20,6 +20,7 @@ NPanel { About, AudioService, Bar, + Launcher, Brightness, ColorScheme, Display, @@ -38,6 +39,10 @@ NPanel { id: generalTab Tabs.GeneralTab {} } + Component { + id: launcherTab + Tabs.LauncherTab {} + } Component { id: barTab Tabs.BarTab {} @@ -94,6 +99,11 @@ NPanel { "label": "Bar", "icon": "web_asset", "source": barTab + }, { + "id": SettingsPanel.Tab.Launcher, + "label": "Launcher", + "icon": "apps", + "source": launcherTab }, { "id": SettingsPanel.Tab.AudioService, "label": "Audio", diff --git a/Modules/SettingsPanel/Tabs/BarTab.qml b/Modules/SettingsPanel/Tabs/BarTab.qml index e0bb137..9a8a030 100644 --- a/Modules/SettingsPanel/Tabs/BarTab.qml +++ b/Modules/SettingsPanel/Tabs/BarTab.qml @@ -133,7 +133,7 @@ ColumnLayout { } NToggle { - label: "Always show battery percentage" + label: "Show Battery Percentage" description: "Show battery percentage at all times (otherwise only when charging or low)." checked: Settings.data.bar.alwaysShowBatteryPercentage onToggled: checked => { diff --git a/Modules/SettingsPanel/Tabs/LauncherTab.qml b/Modules/SettingsPanel/Tabs/LauncherTab.qml new file mode 100644 index 0000000..8650f96 --- /dev/null +++ b/Modules/SettingsPanel/Tabs/LauncherTab.qml @@ -0,0 +1,85 @@ +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import qs.Commons +import qs.Services +import qs.Widgets + +ColumnLayout { + id: root + + spacing: 0 + + ScrollView { + id: scrollView + + Layout.fillWidth: true + Layout.fillHeight: true + padding: Style.marginM * scaling + clip: true + ScrollBar.horizontal.policy: ScrollBar.AlwaysOff + ScrollBar.vertical.policy: ScrollBar.AsNeeded + + ColumnLayout { + width: scrollView.availableWidth + spacing: 0 + + Item { + Layout.fillWidth: true + Layout.preferredHeight: 0 + } + + ColumnLayout { + spacing: Style.marginL * scaling + Layout.fillWidth: true + + NText { + text: "Launcher" + font.pointSize: Style.fontSizeXXL * scaling + font.weight: Style.fontWeightBold + color: Color.mOnSurface + } + + NToggle { + label: "Enable Clipboard History" + description: "Show clipboard history in the Launcher (command >clip)." + checked: Settings.data.appLauncher.enableClipboardHistory + onToggled: checked => { + Settings.data.appLauncher.enableClipboardHistory = checked + } + } + + NDivider { Layout.fillWidth: true; Layout.topMargin: Style.marginL * scaling; Layout.bottomMargin: Style.marginS * scaling } + + NText { + text: "Launcher Position" + font.pointSize: Style.fontSizeXXL * scaling + font.weight: Style.fontWeightBold + color: Color.mOnSurface + Layout.bottomMargin: Style.marginS * scaling + } + + NComboBox { + id: launcherPosition + label: "Position" + description: "Choose where the Launcher panel appears." + Layout.fillWidth: true + model: ListModel { + ListElement { key: "center"; name: "Center (default)" } + ListElement { key: "top_left"; name: "Top Left" } + ListElement { key: "top_right"; name: "Top Right" } + ListElement { key: "bottom_left"; name: "Bottom Left" } + ListElement { key: "bottom_right"; name: "Bottom Right" } + } + currentKey: Settings.data.appLauncher.position + onSelected: function(key) { + Settings.data.appLauncher.position = key + } + } + + } + } + } +} + + diff --git a/README.md b/README.md index eed86bf..c85c468 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ A sleek, minimal, and thoughtfully crafted desktop shell for Wayland using **Qui ## Preview -![Applauncher](https://noctalia.dev/assets/screenshots/AppLauncher.png) +![Launcher](https://noctalia.dev/assets/screenshots/Launcher.png) ![SettingsPanel](https://noctalia.dev/assets/screenshots/SettingsPanel.png) diff --git a/shell.qml b/shell.qml index 6bfe060..c337f11 100644 --- a/shell.qml +++ b/shell.qml @@ -13,7 +13,7 @@ import Quickshell.Io import Quickshell.Services.Pipewire import Quickshell.Widgets import qs.Commons -import qs.Modules.AppLauncher +import qs.Modules.Launcher import qs.Modules.Background import qs.Modules.Bar import qs.Modules.Calendar @@ -38,7 +38,7 @@ ShellRoot { Bar {} Dock {} - AppLauncher { + Launcher { id: appLauncherPanel }