mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2026-08-15 18:43:59 +00:00
Launcher: add custom launch prefix
This commit is contained in:
@@ -202,7 +202,26 @@ Item {
|
||||
// Record usage and persist asynchronously
|
||||
if (Settings.data.appLauncher.sortByMostUsed)
|
||||
recordUsage(app)
|
||||
if (Settings.data.appLauncher.useApp2Unit && app.id) {
|
||||
if (Settings.data.appLauncher.customLaunchPrefixEnabled && Settings.data.appLauncher.customLaunchPrefix) {
|
||||
// Use custom launch prefix
|
||||
const prefix = Settings.data.appLauncher.customLaunchPrefix.split(" ")
|
||||
|
||||
if (app.runInTerminal) {
|
||||
// For terminal apps, use the app command directly
|
||||
const command = prefix.concat(app.command)
|
||||
Quickshell.execDetached(command)
|
||||
} else if (app.id) {
|
||||
// For GUI apps, try to use the app name/executable name instead of desktop file
|
||||
// This works better with commands like "niri msg action spawn --"
|
||||
const appName = app.executableName || app.name.toLowerCase().replace(/\s+/g, '-')
|
||||
const command = prefix.concat([appName])
|
||||
Quickshell.execDetached(command)
|
||||
} else {
|
||||
// Fallback to direct command execution
|
||||
const command = prefix.concat(app.command)
|
||||
Quickshell.execDetached(command)
|
||||
}
|
||||
} else if (Settings.data.appLauncher.useApp2Unit && app.id) {
|
||||
Logger.d("ApplicationsPlugin", `Using app2unit for: ${app.id}`)
|
||||
if (app.runInTerminal)
|
||||
Quickshell.execDetached(["app2unit", "--", app.id + ".desktop"])
|
||||
|
||||
@@ -96,11 +96,14 @@ ColumnLayout {
|
||||
label: I18n.tr("settings.launcher.settings.use-app2unit.label")
|
||||
description: I18n.tr("settings.launcher.settings.use-app2unit.description")
|
||||
checked: Settings.data.appLauncher.useApp2Unit && ProgramCheckerService.app2unitAvailable
|
||||
enabled: ProgramCheckerService.app2unitAvailable
|
||||
enabled: ProgramCheckerService.app2unitAvailable && !Settings.data.appLauncher.customLaunchPrefixEnabled
|
||||
opacity: ProgramCheckerService.app2unitAvailable ? 1.0 : 0.6
|
||||
onToggled: checked => {
|
||||
if (ProgramCheckerService.app2unitAvailable) {
|
||||
Settings.data.appLauncher.useApp2Unit = checked
|
||||
if (checked) {
|
||||
Settings.data.appLauncher.customLaunchPrefixEnabled = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -115,6 +118,31 @@ ColumnLayout {
|
||||
}
|
||||
}
|
||||
|
||||
NToggle {
|
||||
label: I18n.tr("settings.launcher.settings.custom-launch-prefix-enabled.label")
|
||||
description: I18n.tr("settings.launcher.settings.custom-launch-prefix-enabled.description")
|
||||
checked: Settings.data.appLauncher.customLaunchPrefixEnabled
|
||||
enabled: !Settings.data.appLauncher.useApp2Unit
|
||||
onToggled: checked => {
|
||||
Settings.data.appLauncher.customLaunchPrefixEnabled = checked
|
||||
if (checked) {
|
||||
Settings.data.appLauncher.useApp2Unit = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NTextInput {
|
||||
label: I18n.tr("settings.launcher.settings.custom-launch-prefix.label")
|
||||
description: I18n.tr("settings.launcher.settings.custom-launch-prefix.description")
|
||||
Layout.fillWidth: true
|
||||
text: Settings.data.appLauncher.customLaunchPrefix
|
||||
enabled: Settings.data.appLauncher.customLaunchPrefixEnabled
|
||||
visible: Settings.data.appLauncher.customLaunchPrefixEnabled
|
||||
onEditingFinished: {
|
||||
Settings.data.appLauncher.customLaunchPrefix = text
|
||||
}
|
||||
}
|
||||
|
||||
NDivider {
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: Style.marginXL
|
||||
|
||||
Reference in New Issue
Block a user