New features and fixes: new shortcuts, UI/UX, better status resolution

Signed-off-by: Hadi <hadi@example.fr>
This commit is contained in:
Hadi
2026-08-20 15:52:24 +02:00
parent 031ff48696
commit bbab824a1d
14 changed files with 690 additions and 363 deletions
+9 -3
View File
@@ -15,21 +15,27 @@ const (
Rejected Status = "reject"
)
type RuleState string
const (
RuleDefault RuleState = "default"
RuleTemporary RuleState = "temporary"
RulePermanent RuleState = "permanent"
)
type Device struct {
ID int
Name string
Status Status
VidPid string
Hash string
Permanent bool
RuleState RuleState
}
func (d Device) Title() string { return d.Name }
func (d Device) Description() string { return fmt.Sprintf("id:%-3d %s", d.ID, d.VidPid) }
func (d Device) FilterValue() string { return d.Name + " " + d.VidPid }
// parseLine parses a line from "usbguard list-devices":
// 1: allow id 04b3:301b serial "" name "USB Hub" hash "..." via-port "usb1"
func parseLine(line string) (Device, error) {
colonIdx := strings.Index(line, ":")
if colonIdx < 0 {