Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HotkeyProvider ¶
HotkeyProvider must be implemented by any OS specific hotkey system to be used by the hotkeys.Service
func SetupHotkeys ¶
func SetupHotkeys() (HotkeyProvider, chan KeyInfo)
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service holds a channel that retrieves KeyInfo, controls the provided HotkeyProvider with StartHook/Unhook, and calls exported functions on the provided Splitter (usually session.Service if not testing)
func NewService ¶
func NewService(keyInfoChannel chan KeyInfo, sessionService Splitter, provider HotkeyProvider) *Service
NewService creates a new hotkeys.Service that holds a chan KeyInfo, a reference to a Splitter (usually session.Service) a HotkeyProvider that sends raw keypresses from the OS to the keyInfoChannel
The common pattern used in OpenSplit is to create a HotkeyProvider with a constructor func that also returns a chan KeyInfo it sends keypress information to, and use that as the first parameter to this constructor func.
func (*Service) StartDispatcher ¶
func (s *Service) StartDispatcher()
StartDispatcher creates an internal channel that shuts down the dispatch loop when closed, starts the HotkeyProvider OS Hook, and starts the dispatch loop that listens on hotkeyChannel for KeyInfo events
func (*Service) StopDispatcher ¶
func (s *Service) StopDispatcher()
StopDispatcher unhooks the HotkeyProvider from the OS, and closes the internal stop channel to stop the dispatch loop