Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Nov 23, 2023. It is now read-only.

udevbe/xtsb

Repository files navigation

Moved to https://github.com/udevbe/greenfield monorepo

X11 TypeScript Bindings.

Wip, although probably already quite usable.

Works in Node and browser.

Originally created for use in Greenfield.

Build

yarn install

Usage

example:

import { connect, EventMask, WindowClass } from 'xtsb'
async function main() {
 // create a new connection to the x server using the default environment variable DISPLAY
 const connection = await connect()
 
 // allocate a new windowId
 const windowId = connection.allocateID()
 // create a new window in a non-blocking way, we can optionally call 'check()' on the returned result so we receive a 'Promsise<void>' that can be 'await'ed.
 connection.createWindow(
 0,
 windowId,
 connection.setup.roots[0].root,
 0,
 0,
 150,
 150,
 0,
 WindowClass.InputOutput,
 0,
 { eventMask: EventMask.StructureNotify }
 )
 
 // query the window child tree and wait for the reply
 const queryTreeReply = await connection.queryTree(windowId)
 console.log(queryTreeReply.parent)
 
 // set the on destroy notify event listener
 connection.onDestroyNotifyEvent = event => {
 console.log(event.window)
 }
 
 // destroy the window and explicitly block & check if the request succeeded
 await connection.destroyWindow(windowId).check()
}
main()

Documentation

http://udev.be/xtsb/

License

MIT

Packages

No packages published

Contributors 2

AltStyle によって変換されたページ (->オリジナル) /