How krzysztofmarciniak/minimal-window-manager works
Project Type and Purpose
• This is a minimal window manager for Linux/X11. Its main aim is to handle a maximum of two windows per desktop without extra frills like borders, gaps, floating windows, or a status bar.
• The README clarifies that keyboard events (e.g., mod keys coupled with specific actions) trigger commands such as launching a terminal (st), launching dmenu, or switching desktops.
File Structure
• The entire logic is implemented primarily in main.c.
• Supporting files such as Makefile (for building), audio.sh (possibly for audio feedback or additional command control), and other standard files (.gitignore, LICENSE, README.md) support project management and distribution.
• Main Components:
▪ X Server: The external display server that the window manager communicates with to receive keyboard and window events.
▪ MWM Process (main.c): This is the core component that performs the following:
• Event Loop: Captures and dispatches X events (like key presses or window focus changes).
• Key-binding Handler: Maps key combinations (e.g., Mod+Enter, Mod+p, etc.) to actions such as launching st (the terminal) or dmenu.
• Window Layout Manager: Implements the management and positioning of windows according to the minimal rules (maximum two windows per desktop, no borders or gaps).
• Desktop Manager: Manages switching between desktops (0-9) based on user input.
▪ External Commands/Utilities:
• Terminal (st) and dmenu, which are invoked from within the window manager when needed.
• Audio (audio.sh) if this script plays a role in auditory notifications or sound processing (you might note it as an auxiliary component).
• Relationships & Interactions:
▪ The MWM process connects directly to the X server, receiving input events and sending commands that adjust the window layout.
▪ The key-binding subsystem receives events from the X event loop and invokes external utilities (terminal, dmenu) or changes in window focus/desktop management.
• Architectural Patterns & Design Principles:
▪ Very minimal and tightly integrated design: All logic is contained in a few hundred lines of C code.
▪ The “minimal” philosophy drives the design – only the essentials are included without extra layers between user inputs and responses.
• Relevant Technologies:
▪ C as the implementation language.
▪ X11 (Xlib) for interfacing with the X server.
▪ make for building the project.