Add Launcher settings, rename AppLauncher to Launcher

This commit is contained in:
Ly-sec 2025-08-21 15:26:33 +02:00
parent ae332b3f82
commit fac816137a
9 changed files with 133 additions and 30 deletions

View file

@ -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<string> pinnedExecs: []
}

View file

@ -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

View file

@ -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",

View file

@ -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 => {

View file

@ -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
}
}
}
}
}
}

View file

@ -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)

View file

@ -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
}