initial commit

This commit is contained in:
2025-07-25 13:41:23 +02:00
commit 840de62902
27 changed files with 1772 additions and 0 deletions

View File

@ -0,0 +1,36 @@
package niri
import (
"encoding/json"
"errors"
)
type LayoutSwitchTarget struct {
prev Option[bool]
next Option[bool]
index Option[int]
}
func LayoutSwitchTargetPrev() LayoutSwitchTarget {
return LayoutSwitchTarget{prev: OptionOf(true)}
}
func LayoutSwitchTargetNext() LayoutSwitchTarget {
return LayoutSwitchTarget{next: OptionOf(true)}
}
func LayoutSwitchTargetIndex(index int) LayoutSwitchTarget {
return LayoutSwitchTarget{index: OptionOf(index)}
}
func (m LayoutSwitchTarget) MarshalJSON() ([]byte, error) {
if m.prev != nil {
return json.Marshal("Prev")
} else if m.next != nil {
return json.Marshal("Next")
} else if m.index != nil {
return json.Marshal(map[string]int{"Index": *m.index})
}
return nil, errors.New("LayoutSwitchTarget.MarshalJson()")
}