How abduazim424/rex works
What this project is (type + purpose)
Rex is a native Linux desktop utility: a lightweight application launcher written in C++17. It runs as a single local process that:
• Creates and manages a small UI window via X11/XCB
• Captures keyboard input (XCB + keysyms)
• Renders text/UI using Cairo (XCB backend) + Pango
• Produces “suggestions” (likely app/command matches)
• Executes the selected command/application (via an “execution engine”)
File-structure-driven component breakdown (what to map)
From the tree, the core components are strongly implied by the headers and cpp files:
Entry / orchestration
• src/launcher.cpp
Likely the main() entry point. Owns startup, instantiates the app controller, enters the event loop.
• include/rex.hpp, src/rex.cpp
Likely the central “application/controller” object: wires UI, input, suggestions, execution together.
UI + rendering
• include/ui.hpp, src/ui.cpp
XCB window creation, Cairo surface/context setup, Pango layout creation, drawing loop, re-render triggers.
Input/event handling
• include/inputhandler.hpp, src/inputhandler.cpp
Handles XCB event polling/dispatch (KeyPress, KeyRelease, Expose, Focus), converts keycodes to text using xcb-keysyms, updates the current query string, handles navigation/selection keys.
Execution/spawning
• include/executionengine.hpp, src/executionengine.cpp
Domain model / suggestion logic
• include/suggestion.hpp
• include/types.hpp
Shared types / aliases / enums used across components (e.g., key enums, config structs, UI state).
• X Server (X11) (external runtime service)
• XCB + xcb-keysyms (client-side protocol + key translation)
• Cairo (XCB backend) (2D rendering to an X drawable)
• Pango (font/text layout shaping)
• OS process APIs (Linux): fork/exec/posix_spawn, environment PATH, filesystem
Build system boundary:
UI Renderer (ui.cpp/.hpp)
• Uses Cairo + Pango
• Owns XCB window/surface
Input Handler (inputhandler.cpp/.hpp)
• Uses xcb-keysyms
Execution Engine (executionengine.cpp/.hpp)
• Launcher → Rex App Controller: “init + run()”
• Rex App Controller ↔ UI Renderer: “update view state / request redraw”
• Rex App Controller ↔ Input Handler: “dispatch events / receive query updates”
• Rex App Controller → Suggestion logic: “compute/filter suggestions from query”
• Rex App Controller → UI Renderer: “render(query, suggestions, selection)”
• Rex App Controller → Execution Engine: “execute(selectedSuggestion)”
• Input Handler ← X Server (via XCB): “KeyPress/KeyRelease events”
Goal: show *data flow* through the event loop and render cycle.
Rex App Controller triggers
• Recompute/filter suggestions (list of Suggestion)
• UI invalidate/redraw
UI Renderer
• Layout text via Pango
• Present to X window
On “Enter” key:
Architectural patterns to highlight (specific to this repo)
• Single-process, event-driven architecture
• Controller-mediated design (Rex object coordinating UI, input, execution)
• A lightweight “MVC-ish” separation:
• View: UI
• Controller: Rex / InputHandler collaboration
• Model: Suggestion + state types in types.hpp
Also call out library boundaries:
• XCB handles events + window plumbing
• Cairo handles drawing
• Pango handles text shaping/layout
These three together will be the “best and most accurate” representation given the repo’s current structure and early-stage scope.