core

package
v0.0.0-...-a7960c0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 29, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InterfacePrefix       = "com.hypr."
	BaseServiceObjectPath = "/com/hypr"

	ServiceInterface = "com.hypr.HelperService"
)

Variables

View Source
var (
	Red   = "#e68183"
	Peach = "#d79921"
	Green = "#87af87"
	Blue  = "#89beba"

	Pink     = "#e39b7b"
	Yellow   = "#d9bb80"
	Teal     = "#458588"
	Lavender = "#98971a"

	Bg = "#3c3836"
)
View Source
var (
	Active          = Lavender
	Empty           = Bg
	FocusedColors   = []string{Red, Peach, Green, Blue}
	UnfocusedColors = []string{Pink, Yellow, Teal, Lavender}
)
View Source
var (
	AddCnt int
)

AddCnt is a temp solution to making apps sortable. TODO they now have an ID

Functions

func FavoritsMarshalJSON

func FavoritsMarshalJSON(list AppList) ([]byte, error)

func GetDbusConnection

func GetDbusConnection(serviceName string) *dbus.Conn

func GetDbusListener

func GetDbusListener[T any](serviceName, servicePath, signalName string) chan T

func GetGlobalScheduler

func GetGlobalScheduler() *gocron.Scheduler

GetGlobalScheduler returns the global scheduler, initializing it if needed.

func NotiEye

func NotiEye()

func NotiPose

func NotiPose()

func NotiWater

func NotiWater()

func NotifySend

func NotifySend(title, msg, iconPath string)

func PrettyPrint

func PrettyPrint(i interface{}) string

PrettyPrint to print struct in a readable way

func SaveFavorites

func SaveFavorites(data []byte) error

func ServeCommand

func ServeCommand[T any](ctx context.Context, service DbusCommand, signal chan T)

Types

type App

type App struct {
	ID      int
	Title   string
	Class   string
	Color   string
	Address string

	Focused   bool
	Swallowed bool
	// contains filtered or unexported fields
}

type AppClass

type AppClass struct {
	ID          int
	Class       string
	Apps        []*App
	Focused     bool
	Favorite    bool
	Desktop     string
	Icon        string
	LastFocused string // last app of this class that was focused
}

type AppList

type AppList []AppClass

func FavoritsUnmarshalJSON

func FavoritsUnmarshalJSON(data []byte) (list AppList, err error)

func (AppList) Len

func (a AppList) Len() int

func (AppList) Less

func (a AppList) Less(i, j int) bool

func (AppList) String

func (a AppList) String() string

func (AppList) Swap

func (a AppList) Swap(i, j int)

type Apps

type Apps struct {
	// contains filtered or unexported fields
}

func NewApps

func NewApps() Apps

func (*Apps) Add

func (a *Apps) Add(window Client)

func (*Apps) Delete

func (a *Apps) Delete(app *App) error

Delete removes an app from the Apps data structure.

func (*Apps) Update

func (a *Apps) Update(c Clients) (alist AppList)

func (*Apps) Upsert

func (a *Apps) Upsert(window Client)

type Client

type Client struct {
	Address   string `json:"address"`
	Mapped    bool   `json:"mapped"`
	Hidden    bool   `json:"hidden"`
	At        []int  `json:"at"`
	Size      []int  `json:"size"`
	Workspace struct {
		ID   int    `json:"id"`
		Name string `json:"name"`
	} `json:"workspace"`
	Floating       bool   `json:"floating"`
	Monitor        int    `json:"monitor"`
	Class          string `json:"class"`
	Title          string `json:"title"`
	Pid            int    `json:"pid"`
	Xwayland       bool   `json:"xwayland"`
	Pinned         bool   `json:"pinned"`
	Fullscreen     bool   `json:"fullscreen"`
	FullscreenMode int    `json:"fullscreenMode"`
	FakeFullscreen bool   `json:"fakeFullscreen"`
	Grouped        []any  `json:"grouped"`
	Swallowing     string `json:"swallowing"`
}

func FocusedClient

func FocusedClient() Client

type Clients

type Clients []Client

func GetClients

func GetClients() (clients Clients)

type DbusCommand

type DbusCommand interface {
	ServicePath() dbus.ObjectPath
	ServiceName() string
	InterfaceName() string
	ServiceRun(conn *dbus.Conn, msg any)
}

type DockAction

type DockAction string

type DockSignal

type DockSignal struct {
	Type DockAction
	Msg  string
}

type HyprSignal

type HyprSignal struct {
	Type string
	Msg  string
}

type HyprSignalManager

type HyprSignalManager struct {
	HyprEvent       chan HyprSignal
	DockSignal      chan string
	SubmapSignal    chan string
	WeatherSignal   chan string
	MonitorSignal   chan string
	WorkspaceSignal chan string
	QuoteSignal     chan string
	TitleSignal     chan string
}

func (*HyprSignalManager) HyprClientListen

func (h *HyprSignalManager) HyprClientListen(ctx context.Context)

func (*HyprSignalManager) HyprListen

func (h *HyprSignalManager) HyprListen(ctx context.Context)

type HyprWorkspaces

type HyprWorkspaces []struct {
	ID              int    `json:"id"`
	Name            string `json:"name"`
	Monitor         string `json:"monitor"`
	Windows         int    `json:"windows"`
	Hasfullscreen   bool   `json:"hasfullscreen"`
	Lastwindow      string `json:"lastwindow"`
	Lastwindowtitle string `json:"lastwindowtitle"`
}

func GetHyprWorkspaces

func GetHyprWorkspaces() (w HyprWorkspaces)

type Monitor

type Monitor struct {
	ID              int     `json:"id"`
	Name            string  `json:"name"`
	Description     string  `json:"description"`
	Make            string  `json:"make"`
	Model           string  `json:"model"`
	Serial          string  `json:"serial"`
	Width           int     `json:"width"`
	Height          int     `json:"height"`
	RefreshRate     float64 `json:"refreshRate"`
	X               int     `json:"x"`
	Y               int     `json:"y"`
	ActiveWorkspace struct {
		ID   int    `json:"id"`
		Name string `json:"name"`
	} `json:"activeWorkspace"`
	SpecialWorkspace struct {
		ID   int    `json:"id"`
		Name string `json:"name"`
	} `json:"specialWorkspace"`
	Reserved   []int   `json:"reserved"`
	Scale      float64 `json:"scale"`
	Transform  int     `json:"transform"`
	Focused    bool    `json:"focused"`
	DpmsStatus bool    `json:"dpmsStatus"`
	Vrr        bool    `json:"vrr"`
}

type Monitors

type Monitors []Monitor

func GetMonitors

func GetMonitors() (m Monitors)

func (*Monitors) Active

func (m *Monitors) Active() Monitor

type Workspaces

type Workspaces []struct {
	Number           string `json:"number"`
	Color            string `json:"color"`
	Icon             string `json:"icon"`
	ActiveWindowIcon string `json:"active_client_icon"`
	// contains filtered or unexported fields
}

func NewWorkspaces

func NewWorkspaces() Workspaces

func (Workspaces) String

func (w Workspaces) String() string

func (Workspaces) Update

func (w Workspaces) Update(m Monitors, clients Clients)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL