node-sway
TypeScript icon, indicating that this package has built-in type declarations

2.1.4 • Public • Published

node-sway

Exposes a simple interface for interacting with swaywm's unix IPC socket.

Example:

//const SwayIPC = require("node-sway").default;
import SwayIPC from 'node-sway'

const ipc = new SwayIPC()
ipc.on('data', ({data,type}) => console.log(type, data))
ipc.send(SwayIPC.types.GET_VERSION)
ipc.subscribe([SwayIPC.events.WINDOW])

Available Message Types (see man sway-ipc for details)

  RUN_COMMAND: 0, //Runs the payload as sway commands
  GET_WORKSPACES: 1, //Get the list of current workspaces
  SUBSCRIBE: 2, //Subscribe the IPC connection to the events listed in the payload
  GET_OUTPUTS: 3, //Get the list of current outputs
  GET_TREE: 4, //Get the node layout tree
  GET_MARKS: 5, //Get the names of all the marks currently set
  GET_BAR_CONFIG: 6, //Get the specified bar config or a list of bar config names
  GET_VERSION: 7, //Get the version of sway that owns the IPC socket
  GET_BINDING_MODES: 8, //Get the list of binding mode names
  GET_CONFIG: 9, //Returns the config that was last loaded
  SEND_TICK: 10, //Sends a tick event with the specified payload
  SYNC: 11, //Replies failure object for i3 compatibility
  GET_BINDING_STATE: 12, //Request the current binding state, e.g. the currently active binding mode name.
  GET_INPUTS: 100, //Get the list of input devices
  GET_SEATS: 101, //Get the list of seats

Readme

Keywords

none

Package Sidebar

Install

npm i node-sway

Weekly Downloads

0

Version

2.1.4

License

MIT

Unpacked Size

21.4 kB

Total Files

18

Last publish

Collaborators

  • dlasky