{"id":13773856,"url":"https://github.com/sidorares/react-x11","last_synced_at":"2025-04-08T03:15:28.820Z","repository":{"id":57347855,"uuid":"45955773","full_name":"sidorares/react-x11","owner":"sidorares","description":"React renderer with X11 as a target","archived":false,"fork":false,"pushed_at":"2022-06-17T04:24:03.000Z","size":75,"stargazers_count":241,"open_issues_count":7,"forks_count":22,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-03-31T16:18:22.577Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sidorares.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-11-11T02:49:01.000Z","updated_at":"2025-02-06T12:22:00.000Z","dependencies_parsed_at":"2022-08-28T01:40:24.312Z","dependency_job_id":null,"html_url":"https://github.com/sidorares/react-x11","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sidorares%2Freact-x11","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sidorares%2Freact-x11/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sidorares%2Freact-x11/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sidorares%2Freact-x11/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sidorares","download_url":"https://codeload.github.com/sidorares/react-x11/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247767236,"owners_count":20992548,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T17:01:20.944Z","updated_at":"2025-04-08T03:15:28.786Z","avatar_url":"https://github.com/sidorares.png","language":"JavaScript","funding_links":[],"categories":["Miscellaneous","JavaScript"],"sub_categories":[],"readme":"# react-x11\n\nReact custom rendering where side effects are communication with [X11 server](https://www.x.org/wiki/Documentation/). The goal is to create a simple library where you would apply your React or React Native like experience to build small GUI programs to run in X Window environment (usually linux desktop, but I personally more often code under osx + [XQuattz](https://www.xquartz.org/))\n\nThis library is mostly written in javascript all way down, no special bridging code in different language required. For communication with X server [node-x11](https://github.com/sidorares/node-x11) library is used, which is pure JS implementation of X11 protocol (think of it as xlib rewritten in javascript/node.js)\n\n![react-devtools-x11](https://cloud.githubusercontent.com/assets/173025/24536323/6af97598-1625-11e7-88d4-74f429b7f470.gif)\n\nCurrently only `window` component is available, in the future we'll add windowless controls support, simple controls library and [yoga-layout](https://www.npmjs.com/package/yoga-layout) powered layout management\n\n\n## Trying it out\n\nClone this repo and from its folder run\n\n```sh\nnpm install\n```\n\nAfter install is complete you can run examples by running one of those commands:\n\n```sh\nnpm run examples:simple\nnpm run examples:simple-nojsx\nnpm run examples:xeyes\n```\n\n## Example\n\n```js\nconst React = require('react');\nconst ReactX11 = require('react-x11')\nclass App extends React.Component {\n\n  handleRef (win) {\n    // win is https://github.com/sidorares/ntk/blob/master/lib/window.js instance\n    win.on('expose', ev =\u003e {\n      ctx.fillStyle = 'black';\n      ctx.fillText('Hello', ev.x, ev.y);\n    })\n  }\n\n  render() {\n\n    const paintRadialGradient = e =\u003e {\n      const ctx = e.window.getContext('2d');\n      const gradient = ctx.createRadialGradient(0, 0, 0, e.x, e.y, 500);\n      gradient.addColorStop(0, \"green\");\n      gradient.addColorStop(0.5, \"green\");\n      gradient.addColorStop(1, \"rgb(255, 255, 255)\");\n      ctx.fillStyle = gradient;\n      ctx.fillRect(0, 0, ctx.width, ctx.height);\n    }\n\n    return (\n      \u003cwindow ref={this.handleRef} onMouseDown={ev =\u003e console.log('hello')}\u003e\n        \u003cwindow onMouseMove={paintRadialGradient} /\u003e\n      \u003c/window\u003e\n    )\n  }\n}\n\nReactX11.render(React.createElement(App));\n```\n\n# See also\n\nhttps://github.com/chentsulin/awesome-react-renderer\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsidorares%2Freact-x11","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsidorares%2Freact-x11","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsidorares%2Freact-x11/lists"}