hlctl/hlcl/type.go

30 lines
474 B
Go
Raw Normal View History

2023-01-07 16:56:15 +00:00
package hlcl
import "strings"
type Screen struct {
ID string
Resolution string
WithTag string
Focused bool
}
func (Screen) FromString(v string) Screen {
parts := strings.Split(v, " ")
if len(parts) < 5 {
return Screen{
ID: v[:1],
}
}
for i, part := range parts {
parts[i] = strings.TrimSpace(
strings.TrimRight(
strings.Trim(part, "\""), ":"))
}
return Screen{
ID: parts[0],
Resolution: parts[1],
// Maybe later
}
}