thornWM/scripts/test-x.lua
2025-05-23 15:41:23 +00:00

25 lines
788 B
Lua
Executable file

#!/bin/env luajit
package.cpath = package.cpath .. ";lib/?.so"
local X = require("x")
local root = assert(X.open())
local win = X.createWindow()
X.setErrorHandler(print)
atom, integer = X.getAtoms("ATOM", "INTEGER")
assert(atom == 4 and integer == 19)
assert(X.getAtomNames(atom) == "ATOM")
X.setProperty(win, X.getAtoms("test"), atom, 32, X.PropModeReplace, 69)
assert(X.getProperty(win, X.getAtoms("test"), 0, atom) == 69)
X.setProperty(win, X.getAtoms("test"), X.getAtoms("STRING"), 8, X.PropModeReplace, "hello")
assert(X.getProperty(win, X.getAtoms("test"), 0, X.getAtoms("STRING")) == "hello")
X.delProperty(win, X.getAtoms("test"))
assert(not X.delProperty(win, X.getAtoms("test"), 0, X.getAtoms("STRING")))
assert(X.getMonitors() and X.getWindowAttributes(win))
X.close()