gartk
UI Toolkit
A shared UI toolkit library for gardesk components. Provides X11 window management, Cairo/Pango rendering, theming, and input handling.
Features
- X11 connection and window creation
- Cairo/Pango text and shape rendering
- Double-buffered surfaces for flicker-free drawing
- Built-in dark, light, and high-contrast themes
- Color parsing (hex, RGB, named colors)
- Monitor detection via RandR
- Keyboard and pointer event handling
- ARGB visual support for transparency
Installation
cargo add gartk-core gartk-x11 gartk-render Or use the universal installer to install all components.
Configuration
// Using gartk in Rust code
use gartk_core::{Color, Theme, Rect};
use gartk_x11::{Connection, Window, WindowConfig};
use gartk_render::{Renderer, TextStyle};
// Connect to X11
let conn = Connection::connect(None)?;
// Create a popup window
let window = Window::create(
conn.clone(),
WindowConfig::popup()
.title("My App")
.class("myapp")
.size(400, 300)
.transparent(true),
)?;
// Get a theme
let theme = Theme::dark();
// Create renderer
let renderer = Renderer::new(&window)?;
// Draw something
renderer.fill_rounded_rect(
Rect::new(10, 10, 100, 50),
8.0,
theme.selection_background,
);
renderer.draw_text(
"Hello, gartk!",
20, 30,
TextStyle::default()
.color(theme.foreground)
.size(14.0),
); Crate Structure
gartk-core
Core types: Color, Rect, Point, Size, Theme, InputEvent. No platform dependencies.
gartk-x11
X11 integration: Connection, Window, Monitor, EventLoop, Cursor management.
gartk-render
Cairo/Pango rendering: Renderer, Surface, TextRenderer, shape primitives.
Themes
gartk includes three built-in themes with full customization support:
Dark (default)
Catppuccin-inspired dark theme with soft contrasts.
Light
Clean light theme for bright environments.
High Contrast
Maximum contrast for accessibility.
Use Theme::builder() to customize individual properties.
Window Types
Create different window types with preconfigured settings:
// Popup (override-redirect, bypasses WM)
WindowConfig::popup()
.title("Menu")
.position(100, 100)
.size(200, 300)
// Dialog (managed by WM, modal-like)
WindowConfig::dialog()
.title("Settings")
.size(400, 500)
// Normal window
WindowConfig::new()
.title("My App")
.class("myapp")
.size(800, 600) Used By
gartk is the foundation for:
- garlaunch - Application launcher
- Future gardesk components