# README
This package simplifies working with the sway IPC from Go. It was highly influenced by the i3 package.
While the i3 and sway IPCs share much in common, they are not identical. This package provides the complete sway api.
Differences from the i3 package
- Retries are not handled. Use tools like systemd to automatically restart apps that use this library.
- A much simpler interface for subscriptions and handling events.
- No global state.
- Use of Context throughout.
Assumptions
- The
$SWAYSOCK
variable must be set properly in the environment - sway is running on a machine with the same byteorder as the client
# Functions
New returns a Client configured to connect to $SWAYSOCK.
NoOpEventHandler is used to help provide empty methods that aren't intended to be handled by Subscribe
type handler struct { sway.EventHandler }
func (h handler) Window(ctx context.Context, e sway.WindowEvent) { ..
Subscribe the IPC connection to the events listed in the payload.
WithSocketPath explicitly sets the sway socket path so it isn't read from $SWAYSOCK.
# Constants
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
EventTypeBarConfigUpdate is sent whenever a bar config changes.
EventTypeBarStateUpdate is sent when the visibility of a bar should change due to a modifier.
Deprecated: EventTypeBarStatusUpdate is deprecated you should use EventTypeBarStateUpdate instead.
EventTypeBinding is sent when a configured binding is executed.
EventTypeInput is sent when something related to input devices changes.
EventTypeMode is sent whenever the binding mode changes.
EventTypeShutdown is sent when the ipc shuts down because sway is exiting.
EventTypeTick is sent when an ipc client sends a SEND_TICK message.
EventTypeWindow is sent whenever an event involving a view occurs such as being reparented, focused, or closed.
EventTypeWorkspace is sent whenever an event involving a workspace occurs such as initialization of a new workspace or a different workspace gains focus.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
The view was closed.
The view has become floating or is no longer floating.
The view was focused.
The view's fullscreen mode has changed.
A mark has been added or removed from the view.
The view has been reparented in the tree.
The view was created.
The view's title has changed.
The view's urgency hint has changed status.
The workspace is empty and is being destroyed since it is not visible.
The workspace was focused.
The workspace was created.
The workspace was moved to a different output.
The configuration file has been reloaded.
The workspace was renamed.
A view on the workspace has had their urgency hint set or all hints for views on the workspace have been cleared.
# Structs
Represents the configuration for the bar with the bar ID sent as the payload.
The colors object contains strings which are all #RRGGBBAA representation of the color.
No description provided by the author
BarStateUpdateEvent is sent when the visibility of a bar changes due to a modifier being pressed.
No description provided by the author
BindingEvent is sent whenever a binding is executed.
No description provided by the author
No description provided by the author
No description provided by the author
InputEvent is sent when something related to the input devices changes.
The libinput object describes the device configuration for libinput devices.
ModeEvent is sent whenever the binding mode changes.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
ShutdownEvent is sent whenever the IPC is shutting down.
TickEvent is sent when first subscribing to tick events or by a SEND_TICK message.
No description provided by the author
Contains version information about the sway process.
WindowEvent is sent whenever a change involving a view occurs.
No description provided by the author
No description provided by the author
WorkspaceEvent is sent whenever a change involving a workspace occurs.
# Interfaces
A Client provides simple communication with the sway IPC.
An EventHandler is passed to Subscribe and its methods are called in response to sway events.
# Type aliases
BarConfigUpdateEvent is sent whenever a config for a bar changes.
Deprecated: BarStatusUpdateEvent is deprecated, use BarStateUpdateEvent instead.
Border types.
EventType is used to choose which events to Subscribe to.
Fullscreen modes.
Node layouts.
Node types.
Option can be passed to New to specify runtime configuration settings.
No description provided by the author
window event types.
workspace event types.