Documentation
¶
Overview ¶
Package utils provides utility functions.
Index ¶
- Constants
- func BoolPtr(b bool) *bool
- func EscapeHyprDescription(desc string) string
- func FormatEnumTypes[T HasValue](enums []T) string
- func GetFunctionName(i interface{}) string
- func GetPowerLine() (*string, error)
- func GetRunCmd() cmdRunner
- func GetXDGRuntimeDir() (string, error)
- func IntPtr(i int) *int
- func IsLaptop() bool
- func JustPtr[T any](v T) *T
- func PrettyPrintError(err error)
- func Reverse(s string) string
- func SetRunCmd(r cmdRunner)
- func SignalBodyToString(v interface{}) string
- func StringPtr(s string) *string
- func UnmarshalResponse[T any](response []byte, v *T) error
- func WriteAtomic(filename string, data []byte) error
- type DebounceFn
- type Debouncer
- type HasValue
- type LogID
- type LogrusCustomFields
Constants ¶
View Source
const XDGRuntimeDir = "XDG_RUNTIME_DIR"
Variables ¶
This section is empty.
Functions ¶
func EscapeHyprDescription ¶ added in v1.3.3
EscapeHyprDescription escapes # characters in monitor descriptions by doubling them. In Hyprland's configuration syntax, # needs to be escaped as ## when used in desc: fields.
func FormatEnumTypes ¶ added in v0.1.0
func GetFunctionName ¶
func GetFunctionName(i interface{}) string
func GetPowerLine ¶ added in v1.3.0
func GetRunCmd ¶ added in v1.3.0
func GetRunCmd() cmdRunner
GetRunCmd returns the current command runner (for testing)
func GetXDGRuntimeDir ¶
func PrettyPrintError ¶ added in v1.4.0
func PrettyPrintError(err error)
func SetRunCmd ¶ added in v1.3.0
func SetRunCmd(r cmdRunner)
SetRunCmd sets the command runner (for testing)
func SignalBodyToString ¶ added in v1.3.0
func SignalBodyToString(v interface{}) string
SignalBodyToString recursively converts any DBus body item into a string
func UnmarshalResponse ¶
func WriteAtomic ¶ added in v0.1.0
Types ¶
type DebounceFn ¶ added in v0.1.0
type Debouncer ¶ added in v0.1.0
type Debouncer struct {
// contains filtered or unexported fields
}
func NewDebouncer ¶ added in v0.1.0
func NewDebouncer() *Debouncer
func (*Debouncer) Cancel ¶ added in v0.1.0
func (d *Debouncer) Cancel()
Cancel drops any pending job without running it.
type LogrusCustomFields ¶ added in v0.1.0
type LogrusCustomFields struct {
// contains filtered or unexported fields
}
func NewLogrusCustomFields ¶ added in v0.1.0
func NewLogrusCustomFields(fields map[string]interface{}) *LogrusCustomFields
func NewLogrusEmptyFields ¶ added in v0.1.0
func NewLogrusEmptyFields() *LogrusCustomFields
Click to show internal directories.
Click to hide internal directories.