Lua Mach IPC client for Rift WM.
cd rift.lua
makeOutputs: rift.lua/bin/rift.so
package.cpath = "./bin/?.so;" .. package.cpath
local rift = require("rift")local client, err = rift.connect()
if not client then error(err) endclient:reconnect() reconnects and returns the same client object.
local resp, err = client:send_request([[{"get_workspaces":{"space_id":null}}]])
if not resp then error(err) end- Input is raw JSON string.
- Output is decoded Lua table.
Supported events:
workspace_changedwindows_changedwindow_title_changedstacks_changed*(all)
client:subscribe({ "*" }, function(env)
-- env.INFO: raw JSON string
-- env.EVENT: event name (e.g. "windows_changed")
-- env.DATA: decoded table
print(env.EVENT)
end)subscribe(events, callback) returns immediately and auto-dispatches callbacks.
- If you subscribe to
*, you will receive all Rift broadcast event types listed above. - Keep your Lua process alive to keep receiving events.