mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2026-06-09 21:36:13 +00:00
Launcher: add custom launch prefix
This commit is contained in:
@@ -323,6 +323,14 @@
|
|||||||
"terminal-command": {
|
"terminal-command": {
|
||||||
"label": "Terminalbefehl",
|
"label": "Terminalbefehl",
|
||||||
"description": "Befehl zum Starten eines Terminals. Z.B. 'kitty -e' oder 'gnome-terminal --'."
|
"description": "Befehl zum Starten eines Terminals. Z.B. 'kitty -e' oder 'gnome-terminal --'."
|
||||||
|
},
|
||||||
|
"custom-launch-prefix": {
|
||||||
|
"label": "Benutzerdefiniertes Start-Präfix",
|
||||||
|
"description": "Befehle mit einem benutzerdefinierten Launcher präfixieren (z.B. 'runapp' für systemd-Integration)."
|
||||||
|
},
|
||||||
|
"custom-launch-prefix-enabled": {
|
||||||
|
"label": "Benutzerdefiniertes Start-Präfix aktivieren",
|
||||||
|
"description": "Verwenden Sie ein benutzerdefiniertes Präfix zum Starten von Anwendungen anstelle der Standardmethode."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -323,6 +323,14 @@
|
|||||||
"terminal-command": {
|
"terminal-command": {
|
||||||
"label": "Terminal command",
|
"label": "Terminal command",
|
||||||
"description": "Command to launch a terminal. E.g., 'kitty -e' or 'gnome-terminal --'."
|
"description": "Command to launch a terminal. E.g., 'kitty -e' or 'gnome-terminal --'."
|
||||||
|
},
|
||||||
|
"custom-launch-prefix": {
|
||||||
|
"label": "Custom launch prefix",
|
||||||
|
"description": "Prefix commands with a custom launcher (e.g., 'runapp' for systemd integration)."
|
||||||
|
},
|
||||||
|
"custom-launch-prefix-enabled": {
|
||||||
|
"label": "Enable custom launch prefix",
|
||||||
|
"description": "Use a custom prefix for launching applications instead of the default method."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -323,6 +323,14 @@
|
|||||||
"terminal-command": {
|
"terminal-command": {
|
||||||
"label": "Comando de terminal",
|
"label": "Comando de terminal",
|
||||||
"description": "Comando para iniciar un terminal. Por ejemplo, 'kitty -e' o 'gnome-terminal --'."
|
"description": "Comando para iniciar un terminal. Por ejemplo, 'kitty -e' o 'gnome-terminal --'."
|
||||||
|
},
|
||||||
|
"custom-launch-prefix": {
|
||||||
|
"label": "Prefijo de lanzamiento personalizado",
|
||||||
|
"description": "Prefijar comandos con un lanzador personalizado (ej. 'runapp' para integración con systemd)."
|
||||||
|
},
|
||||||
|
"custom-launch-prefix-enabled": {
|
||||||
|
"label": "Habilitar prefijo de lanzamiento personalizado",
|
||||||
|
"description": "Usar un prefijo personalizado para lanzar aplicaciones en lugar del método predeterminado."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -323,6 +323,14 @@
|
|||||||
"terminal-command": {
|
"terminal-command": {
|
||||||
"label": "Commande du terminal",
|
"label": "Commande du terminal",
|
||||||
"description": "Commande pour lancer un terminal. Ex: 'kitty -e' ou 'gnome-terminal --'."
|
"description": "Commande pour lancer un terminal. Ex: 'kitty -e' ou 'gnome-terminal --'."
|
||||||
|
},
|
||||||
|
"custom-launch-prefix": {
|
||||||
|
"label": "Préfixe de lancement personnalisé",
|
||||||
|
"description": "Préfixer les commandes avec un lanceur personnalisé (ex. 'runapp' pour l'intégration systemd)."
|
||||||
|
},
|
||||||
|
"custom-launch-prefix-enabled": {
|
||||||
|
"label": "Activer le préfixe de lancement personnalisé",
|
||||||
|
"description": "Utiliser un préfixe personnalisé pour lancer les applications au lieu de la méthode par défaut."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -323,6 +323,14 @@
|
|||||||
"terminal-command": {
|
"terminal-command": {
|
||||||
"label": "Comando do terminal",
|
"label": "Comando do terminal",
|
||||||
"description": "Comando para iniciar um terminal. Ex: 'kitty -e' ou 'gnome-terminal --'."
|
"description": "Comando para iniciar um terminal. Ex: 'kitty -e' ou 'gnome-terminal --'."
|
||||||
|
},
|
||||||
|
"custom-launch-prefix": {
|
||||||
|
"label": "Prefixo de inicialização personalizado",
|
||||||
|
"description": "Prefixar comandos com um inicializador personalizado (ex. 'runapp' para integração systemd)."
|
||||||
|
},
|
||||||
|
"custom-launch-prefix-enabled": {
|
||||||
|
"label": "Habilitar prefixo de inicialização personalizado",
|
||||||
|
"description": "Usar um prefixo personalizado para inicializar aplicativos em vez do método padrão."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -321,8 +321,16 @@
|
|||||||
"description": "使用替代启动方法以更好地管理应用程序进程并防止问题。"
|
"description": "使用替代启动方法以更好地管理应用程序进程并防止问题。"
|
||||||
},
|
},
|
||||||
"terminal-command": {
|
"terminal-command": {
|
||||||
"description": "启动终端的命令。例如,“kitty -e”或“gnome-terminal --”。",
|
"description": "启动终端的命令。例如,"kitty -e"或"gnome-terminal --"。",
|
||||||
"label": "终端命令"
|
"label": "终端命令"
|
||||||
|
},
|
||||||
|
"custom-launch-prefix": {
|
||||||
|
"label": "自定义启动前缀",
|
||||||
|
"description": "使用自定义启动器前缀命令(例如,'runapp'用于systemd集成)。"
|
||||||
|
},
|
||||||
|
"custom-launch-prefix-enabled": {
|
||||||
|
"label": "启用自定义启动前缀",
|
||||||
|
"description": "使用自定义前缀启动应用程序,而不是默认方法。"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -111,7 +111,9 @@
|
|||||||
"pinnedExecs": [],
|
"pinnedExecs": [],
|
||||||
"useApp2Unit": false,
|
"useApp2Unit": false,
|
||||||
"sortByMostUsed": true,
|
"sortByMostUsed": true,
|
||||||
"terminalCommand": "xterm -e"
|
"terminalCommand": "xterm -e",
|
||||||
|
"customLaunchPrefixEnabled": false,
|
||||||
|
"customLaunchPrefix": ""
|
||||||
},
|
},
|
||||||
"controlCenter": {
|
"controlCenter": {
|
||||||
"position": "close_to_bar_button",
|
"position": "close_to_bar_button",
|
||||||
|
|||||||
@@ -246,6 +246,8 @@ Singleton {
|
|||||||
property bool useApp2Unit: false
|
property bool useApp2Unit: false
|
||||||
property bool sortByMostUsed: true
|
property bool sortByMostUsed: true
|
||||||
property string terminalCommand: "xterm -e"
|
property string terminalCommand: "xterm -e"
|
||||||
|
property bool customLaunchPrefixEnabled: false
|
||||||
|
property string customLaunchPrefix: ""
|
||||||
}
|
}
|
||||||
|
|
||||||
// control center
|
// control center
|
||||||
|
|||||||
@@ -202,7 +202,26 @@ Item {
|
|||||||
// Record usage and persist asynchronously
|
// Record usage and persist asynchronously
|
||||||
if (Settings.data.appLauncher.sortByMostUsed)
|
if (Settings.data.appLauncher.sortByMostUsed)
|
||||||
recordUsage(app)
|
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}`)
|
Logger.d("ApplicationsPlugin", `Using app2unit for: ${app.id}`)
|
||||||
if (app.runInTerminal)
|
if (app.runInTerminal)
|
||||||
Quickshell.execDetached(["app2unit", "--", app.id + ".desktop"])
|
Quickshell.execDetached(["app2unit", "--", app.id + ".desktop"])
|
||||||
|
|||||||
@@ -96,11 +96,14 @@ ColumnLayout {
|
|||||||
label: I18n.tr("settings.launcher.settings.use-app2unit.label")
|
label: I18n.tr("settings.launcher.settings.use-app2unit.label")
|
||||||
description: I18n.tr("settings.launcher.settings.use-app2unit.description")
|
description: I18n.tr("settings.launcher.settings.use-app2unit.description")
|
||||||
checked: Settings.data.appLauncher.useApp2Unit && ProgramCheckerService.app2unitAvailable
|
checked: Settings.data.appLauncher.useApp2Unit && ProgramCheckerService.app2unitAvailable
|
||||||
enabled: ProgramCheckerService.app2unitAvailable
|
enabled: ProgramCheckerService.app2unitAvailable && !Settings.data.appLauncher.customLaunchPrefixEnabled
|
||||||
opacity: ProgramCheckerService.app2unitAvailable ? 1.0 : 0.6
|
opacity: ProgramCheckerService.app2unitAvailable ? 1.0 : 0.6
|
||||||
onToggled: checked => {
|
onToggled: checked => {
|
||||||
if (ProgramCheckerService.app2unitAvailable) {
|
if (ProgramCheckerService.app2unitAvailable) {
|
||||||
Settings.data.appLauncher.useApp2Unit = checked
|
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 {
|
NDivider {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.topMargin: Style.marginXL
|
Layout.topMargin: Style.marginXL
|
||||||
|
|||||||
Reference in New Issue
Block a user