### Run KAS GUI Project Examples Source: https://github.com/kas-gui/kas/wiki/Getting-started Instructions to clone the KAS GUI repository and execute various examples, including the `gallery` and `mandlebrot` applications, using the `cargo run` command. ```sh git clone https://github.com/kas-gui/kas.git cd kas cargo run --example gallery cd examples/mandlebrot; cargo run ``` -------------------------------- ### Install KAS GUI Linux Development Dependencies Source: https://github.com/kas-gui/kas/wiki/Getting-started Commands for installing required Linux libraries such as `libxcb`, `libharfbuzz`, and `glslc` on Ubuntu and Fedora, which are necessary for KAS GUI development, especially for GLSL shaders or HarfBuzz usage. ```sh # For Ubuntu: sudo apt-get install build-essential git libxcb-shape0-dev libxcb-xfixes0-dev libharfbuzz-dev # For Fedora: sudo dnf install libxcb-devel harfbuzz-devel glslc ``` -------------------------------- ### Build KAS GUI Local API Documentation Source: https://github.com/kas-gui/kas/wiki/Getting-started Command to generate local API documentation for the KAS GUI project. This uses `rustdoc` with specific `RUSTDOCFLAGS` and requires the nightly Rust toolchain to enable `doc_cfg` features. ```sh RUSTDOCFLAGS="--cfg doc_cfg" cargo +nightly doc --features=nightly --all --no-deps --open ``` -------------------------------- ### Configure Cargo for Faster Rust Builds with LLD Linker Source: https://github.com/kas-gui/kas/wiki/Getting-started TOML configuration snippet to be placed in `$HOME/.cargo/config`. This configuration instructs Cargo to use the LLD linker, significantly speeding up Rust compilation times. ```toml [build] rustflags = ["-C", "link-arg=-fuse-ld=lld"] ``` -------------------------------- ### Prefer Discrete GPU for KAS (Bash) Source: https://github.com/kas-gui/kas/wiki/Troubleshooting This snippet shows how to set the `KAS_POWER_PREFERENCE` environment variable to `HighPerformance`. This instructs KAS to prefer a discrete GPU over integrated graphics, which can improve rendering performance for demanding applications. ```bash export KAS_POWER_PREFERENCE=HighPerformance ``` -------------------------------- ### KAS Invalid Widget ID Panic (Log) Source: https://github.com/kas-gui/kas/wiki/Troubleshooting This code block displays an example of a panic message encountered in KAS when an `Id` is invalid, typically due to a widget field lacking the `#[widget]` attribute in Rust. The message includes the file and line number where the panic occurred and a hint for obtaining a backtrace. ```log thread 'main' panicked at 'Id::eq: invalid id', crates/kas-core/src/core/widget_id.rs:544:62 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace ``` -------------------------------- ### Force KAS Graphics Backend (Bash) Source: https://github.com/kas-gui/kas/wiki/Troubleshooting This snippet demonstrates how to set the `KAS_BACKENDS` environment variable to explicitly force KAS to use a specific graphics backend, such as OpenGL (GL). This can be useful for compatibility or performance tuning. ```bash export KAS_BACKENDS=GL ``` -------------------------------- ### Configure KAS GUI with Environment Variables Source: https://github.com/kas-gui/kas/wiki/Configuration This snippet demonstrates how to set environment variables (`KAS_CONFIG`, `KAS_THEME_CONFIG`, `KAS_CONFIG_MODE`) to control KAS GUI configuration file paths and access modes. It also shows how to optionally force default file creation and run a KAS example. ```sh export KAS_CONFIG=kas.yaml export KAS_THEME_CONFIG=theme.yaml export KAS_CONFIG_MODE=readwrite # Optionally, force creation of default files: KAS_CONFIG_MODE=WriteDefault cargo run --example gallery # Now, just run: cargo run --example gallery ``` -------------------------------- ### Set Winit X11 Display Scale Factor Source: https://github.com/kas-gui/kas/wiki/Configuration This snippet provides an example of how to explicitly set the display scale factor for Winit applications on X11 using the `WINIT_X11_SCALE_FACTOR` environment variable. This is useful when automatic scale factor detection might not work correctly. ```sh export WINIT_X11_SCALE_FACTOR=1.5 ``` -------------------------------- ### Optimize Rust Binary Size for Release Builds Source: https://github.com/kas-gui/kas/blob/master/README.md This TOML configuration snippet is added to the `Cargo.toml` file under the `[profile.release]` section. It enables stripping of debug symbols and sets the optimization level to 'z' (optimize for size), significantly reducing the final binary size of a Rust application. ```TOML [profile.release] strip = true opt-level = "z" ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.