This projects aim to be the best client for communicating with X11 server effectively, using native Rust code! The project is still in an early development stage and not production ready, but in the end of the year is planned to be released a 1.0 stable version.
Rust is a safe system programming language designed to be fast but preserving features of modern programming languages with no runtime cost. Also pleople love it and it's gaining a lot of attention.
You need a Rust compiler (>=1.12) and a X11 server to work with.
Put the following in your Cargo.toml
:
[dependencies.xrb]
git = "https://github.com/jeandudey/xrb-rs"
And this to your crate root:
extern crate xrb;
extern crate tokio_core;
extern crate futures;
This example shows how to create a window.
extern crate xrb;
extern crate tokio_core;
extern crate futures;
use tokio_core::reactor::Core;
use xrb::xproto::CreateWindow;
use xrb::xproto::MapWindow;
use xrb::Xauth;
use futures::Future;
fn main() {
let path = Xauth::get_path().unwrap();
let auth_info = Xauth::read_file(&path).unwrap();
let mut lp = Core::new().unwrap();
let req = xrb::Client::connect(1, &auth_info, lp.handle());
let client = lp.run(req).unwrap();
let parent = client.get_server_info().roots[0].root;
let req = client.generate_id().and_then(|(client, id)| {
client.perform(CreateWindow {
wid: id,
parent: parent,
class: 1,
depth: 24,
visual: 0,
x: 100,
y: 100,
width: 200,
height: 200,
border_width: 0,
})
.and_then(move |(client, _)| client.perform(MapWindow { wid: id }))
});
let (client, _) = lp.run(req).unwrap();
println!("going loop");
loop {}
}
All contributions are appreciated! Here are some basic instructions:
- Fork and clone the project.
- Create a topic branch (example: feat/resolve-protcol-error)
- Commit your changes using the projects commit guidelines.
- Squash your commits (if necessary).
- Make sure your code compiles.
- Open a pull request.
- Wait for a review.
Note: if your change affect some code that it's exposed on README.md please update it.
- Jean Pierre Dudey - Initial work - jeandudey
If you like xrb - give it a star and share it.
xrb-rs
is licensed under the terms of the MIT license. You can find a full copy of it here.
My email: jeandudey@hotmail.com
This project was't made possible without: