hlctl/hlcl/cmd/enum.go

104 lines
2.1 KiB
Go
Raw Normal View History

2023-01-07 16:56:15 +00:00
package cmd
import (
"fmt"
"strings"
"unicode"
)
type Command string
func (c Command) String() string {
return string(c)
}
func (c Command) Pretty() string {
parts := strings.Split(string(c), "_")
for i, part := range parts {
// Set the first character to be upper case
if len(part) == 0 {
continue
} else if len(part) == 1 {
parts[i] = strings.ToUpper(part)
}
var first rune
for _, r := range part {
first = r
break
}
parts[i] = fmt.Sprintf("%c%s", unicode.ToUpper(first), part[1:])
}
return strings.Join(parts, "")
}
const (
Reload Command = "reload"
Close Command = "close"
Spawn Command = "spawn"
ListMonitors Command = "list_monitors"
Lock Command = "lock"
Unlock Command = "unlock"
// Attr family
GetAttr Command = "get_attr"
SetAttr Command = "set_attr"
Attr Command = "attr"
NewAttr Command = "new_attr"
AttrType Command = "attr_type"
RemoveAttr Command = "remove_attr"
Set Command = "set"
EmitHook Command = "emit_hook"
Rule Command = "rule"
Unrule Command = "unrule"
Substitute Command = "substitute"
// Controls
Keybind Command = "keybind"
Keyunbind Command = "keyunbind"
Mousebind Command = "mousebind"
Mouseunbind Command = "mouseunbind"
UseIndex Command = "use_index"
MoveIndex Command = "move_index"
JumpTo Command = "jumpto"
// Views/Frames
AddTag Command = "add"
MergeTag Command = "merge_tag"
Cycle Command = "cycle"
Focus Command = "focus"
Shift Command = "shift"
Split Command = "split"
Remove Command = "remove"
Fullscreen Command = "fullscreen"
CycleLayout Command = "cycle_layout"
Resize Command = "resize"
)
type MouseButton string
func (m MouseButton) String() string {
return string(m)
}
const (
Mouse1 MouseButton = "Mouse1"
Mouse2 MouseButton = "Mouse2"
Mouse3 MouseButton = "Mouse3"
)
type AttributeType string
func (a AttributeType) String() string {
return string(a)
}
const (
String AttributeType = "string"
Bool AttributeType = "bool"
Color AttributeType = "color"
Int AttributeType = "int"
Uint AttributeType = "uint"
)