49 releases

new 0.1.55 Dec 14, 2024
0.1.54 Dec 8, 2024
0.1.51 Nov 21, 2024
0.1.35 Oct 31, 2024

#142 in Operating systems

Download history 198/week @ 2024-09-27 733/week @ 2024-10-04 1199/week @ 2024-10-11 1055/week @ 2024-10-18 562/week @ 2024-10-25 974/week @ 2024-11-01 571/week @ 2024-11-08 248/week @ 2024-11-15 98/week @ 2024-11-22 292/week @ 2024-11-29 153/week @ 2024-12-06

839 downloads per month

MIT/Apache

500KB
6K SLoC



GitHub License dependencies crates.io

yaxi is a x11 library written from scratch

Key Features

  • Clean Interface - yaxi provides a clean interface, making it perfect for both beginners and experienced developers
  • Safety - yaxi has safe interface for x11 unlike many other x11 libraries
  • Not A Wrapper - yaxi is a pure rust implementation and is NOT a wrapper
  • No Release Dependencies - yaxi release builds dont depend on any crates

Goals

  • Authorization
  • Requests and Replies
  • events (most)
  • Keycodes and Keysyms
  • Extensions (Xinerama, Xft, ...) (Only Xinerama Implemented So Far)
  • Clipboard Support
  • Comprehensive Documentation
  • GLX
  • Window Manager in yaxi (work in progress)

Example

This example opens a window and waits for a keyboard press before it quits:

use yaxi::window::{WindowArguments, ValuesBuilder, WindowKind};
use yaxi::proto::{Event, WindowClass, EventMask};
use yaxi::display;


fn main() -> Result<(), Box<dyn std::error::Error>> {
    let mut display = display::open(None)?;

    let mut root = display.default_root_window()?;

    let mut window = root.create_window(WindowArguments {
        depth: root.depth(),
        x: 5,
        y: 5,
        width: 80,
        height: 50,
        border_width: 15,
        class: WindowClass::InputOutput,
        visual: root.visual(),
        values: ValuesBuilder::new(vec![]),
    })?;

    window.select_input(&[EventMask::KeyPress, EventMask::KeyRelease])?;

    window.map(WindowKind::Window)?;

    let event = display.next_event()?;

    match event {
        Event::KeyEvent { kind, coordinates, window, root, subwindow, state, keycode, send_event } => {
            let window_copy = display.window_from_id(window)?;

            println!("window from id: {}, keycode: {}", window_copy.id(), keycode);
        },
        _ => {},
    }

    window.destroy(WindowKind::Window)?;

    Ok(())
}


License

Yaxi is licensed under the MIT License.

Dependencies