How syntrait/splinux works
Project Type and Purpose
Splinux is a utility tool designed for Linux systems that allows users to split their screen and manage multiple instances of applications or games. It leverages technologies like gamescope, Xwayland, and bubblewrap to create isolated environments for each application instance, enabling features such as dual-screen setups and independent input handling.
Analysis of File Structure
• Top-Level Files:
• .gitignore, Cargo.lock, Cargo.toml: Indicate a Rust-based project with dependency management.
• LICENSE, README.md: Standard documentation and licensing.
• src/ Directory:
• main.rs: Entry point of the application.
• client.rs, gui.rs, types.rs: Suggest modular components handling client interactions, graphical user interface, and type definitions respectively.
Architectural Patterns:
• Modular Architecture: Separation of concerns through distinct modules (client, gui, types).
• CLI and GUI Integration: Implies both command-line and graphical interfaces.
Configuration and Build:
• Cargo: Utilized for building and managing Rust dependencies.
• Potential Configuration Files: Although not explicitly listed, Rust projects may use config directories or environment variables for configuration.
Insights from README
• Key Functionalities:
• Screen splitting and input management using gamescope.
• Compatibility with both native and Proton (Steam) games.
• Use of Xwayland for X11 compatibility on Wayland systems.
• bubblewrap for sandboxing and managing save data locations.
• Dependencies and Tools:
• gamescope: For managing virtual screens with 3D acceleration.
• Xwayland: Compatibility layer for running X11 applications on Wayland.
• bubblewrap (bwrap): Containerization tool for sandboxing applications.
• Goldberg Emulator: For patching Steam's DRM components.
• Architectural Components Mentioned:
• Interaction with the filesystem (/tmp/.X11-unix/, /dev/input/).
• Handling of input devices and display identifiers.
• Integration with Steam and Proton for game compatibility.
a. Main Components:
• Backend:
• Screen Manager: Utilizes gamescope to create and manage virtual screens.
• Input Manager: Interfaces with input devices using evtest, manages device IDs, and assigns inputs to specific displays.
• Sandboxing Module: Uses bubblewrap to isolate application instances and manage save data locations.
• Steam Integration: Handles launching and patching of Steam/Proton games, including DRM bypass with Goldberg.
• Configuration Files: Manages settings, display IDs, device mappings.
• Logging and Troubleshooting Module: Captures logs and provides troubleshooting steps.
b. Relationships and Interactions:
• GUI ↔ Backend Modules:
• User inputs in the GUI are sent to the respective backend modules (e.g., entering display IDs updates the Screen Manager).
• Backend Modules Interaction:
• Screen Manager communicates with Input Manager to assign inputs to specific screens.
• Sandboxing Module interacts with both Screen Manager and Steam Integration to ensure isolated environments for each game instance.
• External Tools Integration:
• Backend modules invoke gamescope, bubblewrap, and Goldberg Emulator through system calls or APIs to perform their functions.
c. Architectural Patterns and Design Principles:
• Modularity: Clear separation between GUI, input management, screen management, and sandboxing.
• Isolation: Use of containerization (bubblewrap) to ensure that each application instance operates independently.
• Scalability: Ability to handle multiple applications/games simultaneously without interference.
• Security: Sandboxing ensures limited access to system resources for each application instance.
d. Technologies, Frameworks, and Libraries:
• Rust: Primary programming language for Splinux.
• gamescope: Tool for managing virtual screens with performance optimizations.
• Xwayland: Ensures compatibility with X11 applications on Wayland.
• bubblewrap: Provides sandboxing capabilities.
• Goldberg Emulator: Facilitates DRM bypass for Steam games.
• evtest: Utilized for input device enumeration and management.
User Interface Layer
• GUI Module
• User Inputs (Display IDs, Device IDs)
• Control Buttons (+ Button)
Application Logic Layer
• Screen Manager
• Integrates with gamescope
• Input Manager
• Interfaces with evtest
• Sandboxing Module
• Utilizes bubblewrap
• Steam Integration
• Handles game launching
• Integrates Goldberg Emulator
External Tools and Services
• gamescope
• Xwayland
• bubblewrap
• Goldberg Emulator
Data Management
• Configuration Files
• Save Data Locations
• From GUI to Application Logic modules
• Between Application Logic modules to external tools
• Data flow between modules and configuration/data storage