Lua Mach IPC client for Rift WM.
cd rift.lua
makeThe makefile uses Lua headers from pkg-config when available, checking Lua 5.5 first, otherwise it uses the bundled lua-5.4.7 headers.
make LUA=/opt/homebrew/bin/lua # match headers to a specific Lua executable
make LUA_PC=lua5.5 # prefer a specific Lua pkg-config module for headers
make USE_SYSTEM_LUA=0 # force bundled Lua headers
make LINK_LUA=1 # explicitly link Lua for non-embedded use casesOutputs: 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.