30 lines
474 B
Go
30 lines
474 B
Go
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
|
|
}
|
|
}
|