event_handler

package
v1.7.3-0...-0bc8425 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: Apache-2.0 Imports: 48 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDirectories

func GetDirectories(router *event.MessageRouter) []filesystem.DirectoryInfo

func Hibernate

func Hibernate() error

func Lock

func Lock() error

func Logout

func Logout() error

func NotificationEventResponse

func NotificationEventResponse(e notification.Event) event.MessageResponse

NotificationEventResponse is the message sent to clients when a notification is sent, clicked or closes. A sent one has the type NOTIFICATION_SENT, like the sender's reply, but the id system.

func RegisterAudioControlHandler

func RegisterAudioControlHandler(router *event.MessageRouter, dataStore *data.DataStore)

func RegisterBluetoothHandlers

func RegisterBluetoothHandlers(router *event.MessageRouter, dataStore *data.DataStore)

func RegisterCameraHandlers

func RegisterCameraHandlers(router *event.MessageRouter, dataStore *data.DataStore)

func RegisterClipboardHandlers

func RegisterClipboardHandlers(router *event.MessageRouter)

func RegisterCommandAllowlistHandlers

func RegisterCommandAllowlistHandlers(router *event.MessageRouter)

RegisterCommandAllowlistHandlers adds, changes and removes one command at a time, rather than replacing the whole allowlist as UPDATE_SETTINGS does

func RegisterCommandExecuteHandler

func RegisterCommandExecuteHandler(router *event.MessageRouter)

func RegisterDesktopHandlers

func RegisterDesktopHandlers(router *event.MessageRouter, dataStore *data.DataStore)

func RegisterDiscordControlHandler

func RegisterDiscordControlHandler(router *event.MessageRouter)

func RegisterDisplayControlHandler

func RegisterDisplayControlHandler(router *event.MessageRouter, dataStore *data.DataStore)

func RegisterExitApplicationHandler

func RegisterExitApplicationHandler(router *event.MessageRouter)

func RegisterGetCommandPrefabsHandler

func RegisterGetCommandPrefabsHandler(router *event.MessageRouter)

func RegisterGetDataHandler

func RegisterGetDataHandler(router *event.MessageRouter)

func RegisterGetDiagnosticsHandler

func RegisterGetDiagnosticsHandler(router *event.MessageRouter, dataStore *data.DataStore)

func RegisterGetDirectoriesHandler

func RegisterGetDirectoriesHandler(router *event.MessageRouter)

func RegisterGetDirectoryHandler

func RegisterGetDirectoryHandler(router *event.MessageRouter)

func RegisterGetDiscordSetupHandler

func RegisterGetDiscordSetupHandler(router *event.MessageRouter)

RegisterGetDiscordSetupHandler reports how far Discord is set up. The client secret is never sent back.

func RegisterGetDiskMountsHandler

func RegisterGetDiskMountsHandler(router *event.MessageRouter)

func RegisterGetFileHandler

func RegisterGetFileHandler(router *event.MessageRouter)

func RegisterGetFilesHandler

func RegisterGetFilesHandler(router *event.MessageRouter)

func RegisterGetHistoryHandler

func RegisterGetHistoryHandler(router *event.MessageRouter, dataStore *data.DataStore)

func RegisterGetSettingsHandler

func RegisterGetSettingsHandler(router *event.MessageRouter)

func RegisterHandlers

func RegisterHandlers(router *event.MessageRouter, dataStore *data.DataStore)

func RegisterHyprlandHandlers

func RegisterHyprlandHandlers(router *event.MessageRouter, dataStore *data.DataStore)

func RegisterKeyboardKeypressHandler

func RegisterKeyboardKeypressHandler(router *event.MessageRouter)

func RegisterKeyboardTextHandler

func RegisterKeyboardTextHandler(router *event.MessageRouter)

func RegisterMediaControlHandler

func RegisterMediaControlHandler(router *event.MessageRouter, dataStore *data.DataStore)

func RegisterNotificationHandler

func RegisterNotificationHandler(router *event.MessageRouter)

func RegisterOmarchyHandlers

func RegisterOmarchyHandlers(router *event.MessageRouter, dataStore *data.DataStore)

func RegisterOpenHandler

func RegisterOpenHandler(router *event.MessageRouter)

func RegisterPowerHibernateHandler

func RegisterPowerHibernateHandler(router *event.MessageRouter)

func RegisterPowerLockHandler

func RegisterPowerLockHandler(router *event.MessageRouter)

func RegisterPowerLogoutHandler

func RegisterPowerLogoutHandler(router *event.MessageRouter)

func RegisterPowerRestartHandler

func RegisterPowerRestartHandler(router *event.MessageRouter)

func RegisterPowerShutdownHandler

func RegisterPowerShutdownHandler(router *event.MessageRouter)

func RegisterPowerSleepHandler

func RegisterPowerSleepHandler(router *event.MessageRouter)

func RegisterProcessHandlers

func RegisterProcessHandlers(router *event.MessageRouter, dataStore *data.DataStore)

func RegisterRegisterDataListenerHandler

func RegisterRegisterDataListenerHandler(router *event.MessageRouter)

func RegisterSystemHandlers

func RegisterSystemHandlers(router *event.MessageRouter, dataStore *data.DataStore)

func RegisterUnregisterDataListenerHandler

func RegisterUnregisterDataListenerHandler(router *event.MessageRouter)

func RegisterUpdateDiscordSetupHandler

func RegisterUpdateDiscordSetupHandler(router *event.MessageRouter)

RegisterUpdateDiscordSetupHandler saves the Discord application to authorize as, then connects to Discord.

func RegisterUpdateSettingsHandler

func RegisterUpdateSettingsHandler(router *event.MessageRouter, dataStore *data.DataStore)

func RegisterValidateDirectoryHandler

func RegisterValidateDirectoryHandler(router *event.MessageRouter)

func Restart

func Restart() error

func Sleep

func Sleep() error

Types

type AudioControlRequestData

type AudioControlRequestData struct {
	// An output's, input's or app's id from the audio module
	ID      string   `json:"id" mapstructure:"id"`
	Volume  *float64 `json:"volume" mapstructure:"volume"`
	Muted   *bool    `json:"muted" mapstructure:"muted"`
	Default bool     `json:"default" mapstructure:"default"`
	// An output's id, to move an app to it
	Output string `json:"output,omitempty" mapstructure:"output"`
}

type BluetoothDeviceRequestData

type BluetoothDeviceRequestData struct {
	Address string `json:"address" mapstructure:"address"`
}

type BluetoothPowerRequestData

type BluetoothPowerRequestData struct {
	Powered *bool `json:"powered" mapstructure:"powered"`
}

type CameraCaptureRequestData

type CameraCaptureRequestData struct {
	ID     string `json:"id" mapstructure:"id"`
	Width  *int64 `json:"width" mapstructure:"width"` // With height, one of the camera's sizes. Without, its current size
	Height *int64 `json:"height" mapstructure:"height"`
}

type CameraControlRequestData

type CameraControlRequestData struct {
	ID      string `json:"id" mapstructure:"id"`
	Control string `json:"control" mapstructure:"control"`
	Value   *int64 `json:"value" mapstructure:"value"`
}

type ClipboardTextRequestData

type ClipboardTextRequestData struct {
	Text string `json:"text" mapstructure:"text"`
}

type DesktopKeyboardLayoutRequestData

type DesktopKeyboardLayoutRequestData struct {
	Layout string `json:"layout" mapstructure:"layout"`
}

type DesktopWindowRequestData

type DesktopWindowRequestData struct {
	ID string `json:"id" mapstructure:"id"`
}

type DesktopWindowStateRequestData

type DesktopWindowStateRequestData struct {
	ID         string `json:"id" mapstructure:"id"`
	Fullscreen *bool  `json:"fullscreen" mapstructure:"fullscreen"`
	Maximised  *bool  `json:"maximised" mapstructure:"maximised"`
	Minimised  *bool  `json:"minimised" mapstructure:"minimised"`
}

type DesktopWorkspaceRequestData

type DesktopWorkspaceRequestData struct {
	ID string `json:"id" mapstructure:"id"`
}

type DiscordControlRequestData

type DiscordControlRequestData struct {
	Action    string   `json:"action" mapstructure:"action"`
	ChannelID string   `json:"channel_id" mapstructure:"channel_id"`
	UserID    string   `json:"user_id" mapstructure:"user_id"`
	SoundID   string   `json:"sound_id" mapstructure:"sound_id"`
	Value     *float64 `json:"value" mapstructure:"value"`
	DeviceID  string   `json:"device_id" mapstructure:"device_id"`
	Mode      string   `json:"mode" mapstructure:"mode"`
}

type DiscordSetupRequestData

type DiscordSetupRequestData struct {
	ClientID     string `json:"clientId" mapstructure:"clientId"`
	ClientSecret string `json:"clientSecret" mapstructure:"clientSecret"`
}

type DisplayControlRequestData

type DisplayControlRequestData struct {
	ID         string   `json:"id" mapstructure:"id"`
	Brightness *float64 `json:"brightness" mapstructure:"brightness"`
	PowerState string   `json:"power_state" mapstructure:"power_state"`
}

type GetDataRequestData

type GetDataRequestData struct {
	Modules []types.ModuleName `json:"modules" mapstructure:"modules"`
}

type GetDataResponseData

type GetDataResponseData = any

type GetDirectoriesResponseDataItem

type GetDirectoriesResponseDataItem struct {
	Key         string `json:"key" mapstructure:"key"`
	Name        string `json:"name" mapstructure:"name"`
	Path        string `json:"path" mapstructure:"path"`
	Description string `json:"description,omitempty" mapstructure:"description,omitempty"`
}

GetDirectoriesResponseDataItem represents a directory item in the response

func GetDirectory

func GetDirectory(router *event.MessageRouter, baseDirectoryKey string) *GetDirectoriesResponseDataItem

type GetDirectoryRequestData

type GetDirectoryRequestData struct {
	BaseDirectory string `json:"base" mapstructure:"base"`
}

type GetFileRequestData

type GetFileRequestData struct {
	Path string `json:"path" mapstructure:"path"`
}

type GetFileResponseData

type GetFileResponseData struct {
	Name        string    `json:"name" mapstructure:"name"`
	Path        string    `json:"path" mapstructure:"path"`
	Size        int64     `json:"size" mapstructure:"size"`
	IsDirectory bool      `json:"isDirectory" mapstructure:"isDirectory"`
	ModTime     time.Time `json:"modTime" mapstructure:"modTime"`
	Permissions string    `json:"permissions" mapstructure:"permissions"`
	ContentType string    `json:"contentType,omitempty" mapstructure:"contentType,omitempty"`
	Extension   string    `json:"extension,omitempty" mapstructure:"extension,omitempty"`
}

GetFileResponseData represents information about a file

func GetFileInfo

func GetFileInfo(basePath string, fileName string) *GetFileResponseData

GetFileInfo returns detailed information about a file

func GetFiles

func GetFiles(path string) []GetFileResponseData

type GetFilesRequestData

type GetFilesRequestData struct {
	BaseDirectory string `json:"base" mapstructure:"base"`
	Path          string `json:"path,omitempty" mapstructure:"path,omitempty"`
}

type GetFilesResponseData

type GetFilesResponseData = []GetFileResponseData

type GetHistoryRequestData

type GetHistoryRequestData struct {
	// Since limits the history to readings taken after this time, in Unix
	// milliseconds. Zero or missing returns it all.
	Since int64 `json:"since" mapstructure:"since"`
	// Modules limits the history to these modules' readings. Empty or
	// missing returns every module's.
	Modules []types.ModuleName `json:"modules" mapstructure:"modules"`
}

type GetSettingsResponseData

type GetSettingsResponseData = settings.Settings

type HyprlandDispatchRawRequestData

type HyprlandDispatchRawRequestData struct {
	Dispatch string `json:"dispatch" mapstructure:"dispatch"` // In the running config's language
}

type HyprlandDispatchRequestData

type HyprlandDispatchRequestData struct {
	Dispatcher types.HyprlandDispatcher `json:"dispatcher" mapstructure:"dispatcher"`
	Direction  types.HyprlandDirection  `json:"direction" mapstructure:"direction"`
	ID         string                   `json:"id" mapstructure:"id"` // A window to focus first
}

type HyprlandEvalRequestData

type HyprlandEvalRequestData struct {
	Code string `json:"code" mapstructure:"code"`
}

type HyprlandExecRequestData

type HyprlandExecRequestData struct {
	Command string `json:"command" mapstructure:"command"`
}

type HyprlandGlobalShortcutRequestData

type HyprlandGlobalShortcutRequestData struct {
	Name string `json:"name" mapstructure:"name"`
}

type HyprlandMoveCursorRequestData

type HyprlandMoveCursorRequestData struct {
	X *int `json:"x" mapstructure:"x"`
	Y *int `json:"y" mapstructure:"y"`
}

type HyprlandMoveWindowRequestData

type HyprlandMoveWindowRequestData struct {
	ID        string `json:"id" mapstructure:"id"`
	Workspace string `json:"workspace" mapstructure:"workspace"`
}

type HyprlandMoveWorkspaceRequestData

type HyprlandMoveWorkspaceRequestData struct {
	ID      string `json:"id" mapstructure:"id"`
	Display string `json:"display" mapstructure:"display"`
}

type HyprlandOptionNameRequestData

type HyprlandOptionNameRequestData struct {
	Name string `json:"name" mapstructure:"name"`
}

type HyprlandOptionRequestData

type HyprlandOptionRequestData struct {
	Name  string `json:"name" mapstructure:"name"`
	Value any    `json:"value" mapstructure:"value"` // A bool, a number or text, by the option's type
}

type HyprlandRenameWorkspaceRequestData

type HyprlandRenameWorkspaceRequestData struct {
	ID   string `json:"id" mapstructure:"id"`
	Name string `json:"name" mapstructure:"name"`
}

type HyprlandSendEventRequestData

type HyprlandSendEventRequestData struct {
	Name string `json:"name" mapstructure:"name"`
}

type HyprlandSetWindowRequestData

type HyprlandSetWindowRequestData struct {
	ID       string `json:"id" mapstructure:"id"`
	Floating *bool  `json:"floating" mapstructure:"floating"`
	Pinned   *bool  `json:"pinned" mapstructure:"pinned"`
	X        *int   `json:"x" mapstructure:"x"`
	Y        *int   `json:"y" mapstructure:"y"`
	Width    *int   `json:"width" mapstructure:"width"`
	Height   *int   `json:"height" mapstructure:"height"`
}

type HyprlandSubmapRequestData

type HyprlandSubmapRequestData struct {
	Name string `json:"name" mapstructure:"name"`
}

type KeyboardTextRequestData

type KeyboardTextRequestData struct {
	Text  string `json:"text" mapstructure:"text"`
	Delay int    `json:"delay" mapstructure:"delay"`
}

type MediaControlRequestData

type MediaControlRequestData struct {
	Action string `json:"action" mapstructure:"action"`
	// A player's id from the media module's players. Leave it out for the
	// player the module reports.
	Player   string   `json:"player,omitempty" mapstructure:"player"`
	Position *float64 `json:"position,omitempty" mapstructure:"position"` // Seconds, for SEEK
	Volume   *float64 `json:"volume,omitempty" mapstructure:"volume"`     // 0 to 1, for SET_VOLUME
	Shuffle  *bool    `json:"shuffle,omitempty" mapstructure:"shuffle"`   // For SET_SHUFFLE
	Repeat   string   `json:"repeat,omitempty" mapstructure:"repeat"`     // NONE, TRACK or LIST, for SET_REPEAT
}

type NotificationDismissRequestData

type NotificationDismissRequestData struct {
	// The id NOTIFICATION_SENT replied with
	ID uint32 `json:"id" mapstructure:"id"`
}

type NotificationEventData

type NotificationEventData struct {
	ID uint32 `json:"id"`
	// What was sent, when it was sent
	Title   string                            `json:"title,omitempty"`
	Message string                            `json:"message,omitempty"`
	Buttons []notification.NotificationButton `json:"buttons,omitempty"`
	// The button's id, or default for the notification itself
	Action string `json:"action,omitempty"`
	// expired, dismissed or closed
	Reason string `json:"reason,omitempty"`
}

NotificationEventData is sent to every client when a notification System Bridge sent is sent, clicked or closes

type NotificationPressRequestData

type NotificationPressRequestData struct {
	// The id NOTIFICATION_SENT replied with
	ID uint32 `json:"id" mapstructure:"id"`
	// The id of the button to press
	Action string `json:"action" mapstructure:"action"`
}

type OmarchyRequestData

type OmarchyRequestData struct {
	ID     string              `json:"id" mapstructure:"id"`
	Action types.OmarchyAction `json:"action" mapstructure:"action"`
}

type OpenRequestData

type OpenRequestData struct {
	Path string `json:"path" mapstructure:"path"`
	URL  string `json:"url" mapstructure:"url"`
}

type ProcessKillRequestData

type ProcessKillRequestData struct {
	ID    int  `json:"id" mapstructure:"id"`
	Force bool `json:"force" mapstructure:"force"`
}

type RegisterDataListenerRequestData

type RegisterDataListenerRequestData struct {
	Modules []types.ModuleName `json:"modules" mapstructure:"modules"`
}

type SystemKeepAwakeRequestData

type SystemKeepAwakeRequestData struct {
	Enabled *bool `json:"enabled" mapstructure:"enabled"`
	// Seconds until the system may idle again. Leave it out, or 0, to keep
	// it awake until told otherwise.
	Duration *int `json:"duration,omitempty" mapstructure:"duration"`
}

type SystemPowerProfileRequestData

type SystemPowerProfileRequestData struct {
	// One of the system module's power_profiles, such as balanced
	Profile string `json:"profile" mapstructure:"profile"`
}

type UpdateSettingsRequestData

type UpdateSettingsRequestData = settings.Settings

type UpdateSettingsResponseData

type UpdateSettingsResponseData = settings.Settings

type ValidateDirectoryRequestData

type ValidateDirectoryRequestData struct {
	Path string `json:"path" mapstructure:"path"`
}

type ValidateDirectoryResponseData

type ValidateDirectoryResponseData struct {
	Valid bool `json:"valid" mapstructure:"valid"`
}

Jump to

Keyboard shortcuts

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