Initial support for application specific overrides.
This commit is contained in:
1 parent
901fd58ba8
commit
b45f800489
37 files changed
+3909
-475
No files matched your search
@@ -0,0 +1,35 @@
|
||||
// Copyright (c) 2026 Storm Dragon
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
package networkmanager
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"git.stormux.org/storm/fenrir/internal/applicationoverrides"
|
||||
"git.stormux.org/storm/fenrir/internal/command"
|
||||
"git.stormux.org/storm/fenrir/internal/config"
|
||||
"git.stormux.org/storm/fenrir/internal/presentation"
|
||||
"git.stormux.org/storm/fenrir/internal/screen"
|
||||
)
|
||||
|
||||
type Adapter struct{}
|
||||
|
||||
func (*Adapter) Name() string { return "NetworkManager" }
|
||||
func (*Adapter) Configure(settings *config.Settings) { settings.Reading.Mode = "highlight" }
|
||||
func (*Adapter) Reset() {}
|
||||
func (*Adapter) Close() {}
|
||||
func (*Adapter) Command(command.ID) (presentation.CommandResult, bool) {
|
||||
return presentation.CommandResult{}, false
|
||||
}
|
||||
|
||||
func (*Adapter) Observe(snapshot screen.Snapshot) applicationoverrides.Frame {
|
||||
// nmtui's newt dialogs retain a border and their standard title/action text.
|
||||
text := string(snapshot.Cells)
|
||||
border := strings.ContainsAny(text, "┌┐└┘╔╗╚╝") || strings.Contains(text, "+---")
|
||||
title := false
|
||||
for _, label := range []string{"NetworkManager", "Edit Connection", "Activate a connection", "Set Hostname", "Select a connection", "Edit a connection"} {
|
||||
title = title || strings.Contains(text, label)
|
||||
}
|
||||
return applicationoverrides.Frame{Recognized: border && title}
|
||||
}
|
||||
Reference in new issue
Block a user