Fenrir can now create aliases for application overrides and put them in your clipboard.
This commit is contained in:
1 parent
7df1fa3ecb
commit
7d82105d1d
15 files changed
+594
-114
No files matched your search
@@ -0,0 +1,35 @@
|
||||
// Copyright (c) 2026 Storm Dragon
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
package app
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"git.stormux.org/storm/fenrir/internal/control"
|
||||
)
|
||||
|
||||
func shell_quote(text string) string {
|
||||
return "'" + strings.ReplaceAll(text, "'", "'\"'\"'") + "'"
|
||||
}
|
||||
|
||||
// The last simple command receives the arguments following the alias. Keep the
|
||||
// optional reader request in an OR list so errexit cannot prevent the launch.
|
||||
func application_alias(id, socketPath string) string {
|
||||
program := ""
|
||||
switch id {
|
||||
case "networkmanager":
|
||||
program = "nmtui"
|
||||
case "ninjam":
|
||||
program = "cninjam"
|
||||
case "rogue", "codex":
|
||||
program = id
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
if socketPath == "" {
|
||||
socketPath = control.MainSocket
|
||||
}
|
||||
body := "(echo " + shell_quote("command application "+id) + " | socat -T 2 - " + shell_quote("UNIX-CLIENT:"+socketPath) + ") || :; command " + program
|
||||
return "alias " + program + "=" + shell_quote(body)
|
||||
}
|
||||
Reference in new issue
Block a user