SwayFX Documentation

repository·master·Indexed 25 days ago

https://github.com/willpower3309/swayfx

SwayFX is a fork of the Sway window manager that replaces the standard wlr_renderer with a custom fx_renderer to enable GLES2 visual effects, including blur, shadows, rounded corners, and window dimming. It provides detailed configuration options for window and LayerShell effects, as well as installation guides for Nix, Docker, and manual compilation from source using Meson and Ninja.

Tokens
35.8K
Snippets
39
Records
266
Agent score
80%

What's inside SwayFX

  1. Install SwayFX using Nix

    master

    If you have Nix installed, you can build and run SwayFX directly from the repository.

    To build and run:

    nix build
    ./result/bin/sway

    To enter a development shell with all dependencies pre-configured:

    nix develop
    nix build
    ./result/bin/sway
  2. Compile and install SwayFX

    master

    Once the subprojects are configured, use Meson and Ninja to build and install the project. Meson will automatically detect the code in the subprojects/ directory.

    1. Configure the build with meson setup.
    2. Compile using ninja.
    3. Install using sudo ninja install.
    4. Crucial: Run sudo ldconfig to update the linker cache so the system recognizes the new libraries in /usr/local/lib.
    # Configure the build
    meson setup build/
    
    # Compile
    ninja -C build/
    
    # Install
    sudo ninja -C build/ install
    
    # Update linker cache
    sudo ldconfig
  3. Install dependencies for SwayFX on Debian 13 (Trixie/Sid)

    master

    Before building SwayFX, you must install the required development headers and build tools. Debian Trixie requires specific packages for the wlroots 0.19 backend, including libliftoff, libdisplay-info, and liblcms2.

    sudo apt update && sudo apt install -y \
      meson pkg-config cmake git scdoc \
      wayland-protocols libwayland-dev libpcre2-dev libjson-c-dev \
      libpango1.0-dev libcairo2-dev libgdk-pixbuf-2.0-dev \
      libdrm-dev libgbm-dev libinput-dev libseat-dev libxkbcommon-dev \
      libxcb-dri3-dev libxcb-present-dev libxcb-res0-dev \
      libxcb-render-util0-dev libxcb-ewmh-dev libxcb-icccm4-dev \
      libliftoff-dev libdisplay-info-dev liblcms2-dev libpixman-1-dev \
      libgles2-mesa-dev hwdata libudev-dev
  4. Setup SwayFX build environment using Meson Subprojects

    master

    To ensure compatibility with wlroots 0.19.0 and scenefx 0.4.1, use the Meson Subprojects method. This clones specific versions of dependencies into a subprojects directory within the SwayFX source tree, preventing conflicts with system libraries.

    Required Versions:

    • SwayFX: 0.5.3
    • SceneFX: 0.4.1 (Required for wlroots 0.19 support)
    • Wlroots: 0.19.0
    # Create a clean build directory
    mkdir -p ~/build
    cd ~/build
    
    # 1. Clone SwayFX 0.5.3 (The Window Manager)
    git clone https://github.com/WillPower3309/swayfx.git
    cd swayfx
    git checkout 0.5.3
    
    # 2. Setup Subprojects Directory
    mkdir subprojects
    cd subprojects
    
    # 3. Clone SceneFX 0.4.1 (The Rendering FX Library)
    git clone https://github.com/wlrfx/scenefx.git
    cd scenefx
    git checkout 0.4.1
    cd ..
    
    # 4. Clone Wlroots 0.19.0 (The Wayland Compositor Backend)
    git clone https://gitlab.freedesktop.org/wlroots/wlroots.git
    cd wlroots
    git checkout 0.19.0
    
    # Return to source root
    cd ../..
  5. Install SwayFX using Docker Container

    master

    You can build SwayFX inside a container and then copy the built files to your host system at /usr/local/.

    1. Build and run the container:
    docker compose up --build
    1. Become root and copy files to the host:
    sudo bash
    
    while read -r FILE; do
      NEW_FILE=/usr/local${FILE#opt}
      NEW_DIR=$(dirname "${NEW_FILE}")
      [[ -d "${NEW_DIR}" ]] || mkdir -p "${NEW_DIR}"
    
      echo "Creating '${NEW_FILE}'"
      cp "${FILE}" "${NEW_FILE}"
    done < <(command find opt/ -type f)
    docker compose up --build
    
    sudo bash
    
    while read -r FILE; do
      NEW_FILE=/usr/local${FILE#opt}
      NEW_DIR=$(dirname "${NEW_FILE}")
      [[ -d "${NEW_DIR}" ]] || mkdir -p "${NEW_DIR}"
    
      echo "Creating '${NEW_FILE}'"
      cp "${FILE}" "${NEW_FILE}"
    done < <(command find opt/ -type f)
  6. Compile SwayFX from Source (Manual)

    master

    To compile SwayFX manually, ensure you have the required dependencies installed (including meson, wlroots, wayland, scenefx, etc.).

    Build and Install Steps:

    meson build/
    ninja -C build/
    sudo ninja -C build/ install

    Note for systems without logind or seatd: You must set the SUID bit on the sway binary to allow it to run correctly:

    sudo chmod a+s /usr/local/bin/sway

    SwayFX will drop root permissions shortly after startup.

    meson build/
    ninja -C build/
    sudo ninja -C build/ install
  7. Configure LayerShell effects for panels and notifications

    master

    You can apply visual effects like blur, shadows, and corner radius to specific LayerShell surfaces (e.g., waybar, notifications, or GTK layers).

    Identify Layer Namespaces: To find the available namespaces on your system, run:

    swaymsg -r -t get_outputs | jq '.[0].layer_shell_surfaces | .[] | .namespace'

    Note: GTK applications often use the gtk-layer-shell namespace.

    Applying Effects via Swaymsg (IPC): You can only set one effect at a time via swaymsg:

    swaymsg layer_effects "waybar" "blur enable"

    Applying Effects via Config File: You can define a block of effects for a specific namespace in your Sway configuration:

    layer_effects "waybar" {
        blur enable;
        blur_xray enable;
        blur_ignore_transparent enable;
        shadows enable;
        corner_radius 20;
    }

    Available Effects for Layers:

    • blur <enable|disable>
    • blur_xray <enable|disable>
    • blur_ignore_transparent <enable|disable>
    • shadows <enable|disable>
    • corner_radius <int>
    • reset: Resets/disables all previously applied effects to that layer.
  8. Configure Window Blur effects

    master

    SwayFX provides several options to control window blur. You can enable/disable blur and fine-tune its appearance using radius, noise, and color adjustments.

    Available Options:

    • blur enable|disable
    • blur_xray enable|disable: Sets floating windows to blur based on the background rather than the windows beneath them (usually recommended to keep disable).
    • blur_passes <integer 0 - 10>
    • blur_radius <integer 0 - 10>
    • blur_noise <float 0 - 1>
    • blur_brightness <float 0 - 2>
    • blur_contrast <float 0 - 2>
    • blur_saturation <float 0 - 2>
  9. Resize behavior for Tiled vs Floating windows

    master

    The resize command behaves differently depending on whether the window is in a tiled or floating layout.

    Tiled Windows

    • Relative Adjustment (grow/shrink): Uses ppt (percentage) by default. The amount is calculated based on the dimension of the parent container (or the workspace if no parent is found).
    • Absolute Setting (set): Allows setting dimensions in px or ppt. If ppt is used, it is converted to pixels based on the parent container's size.

    Floating Windows

    • Relative Adjustment (grow/shrink): Only supports px (pixels). Attempting to use ppt with floating windows will result in an error: Floating containers cannot use ppt measurements.
    • Absolute Setting (set): Supports px and ppt. When using ppt, the dimension is calculated as a percentage of the total workspace width/height. When resizing, the window expands or contracts from its center (adjusting x and y coordinates to compensate).
  10. Configure key groups

    master

    SwayFX supports key groups (similar to i3 modes) which allow you to define bindings that only work when a specific group is active. Groups are numbered 1 through 4.

    • Group<N>: Specifies the group (where N is 1-4).
    • Mode_switch: An alias for Group2 for compatibility.
  11. Configure Dim Unfocused Windows

    master

    SwayFX allows you to dim inactive windows to improve focus. You can set a global default or apply specific dimming rules to certain windows using criteria.

    Available Options:

    • default_dim_inactive <float 0.0 - 1.0>
    • for_window [CRITERIA_HERE] dim_inactive <float 0.0 - 1.0>
    • dim_inactive_colors.unfocused <hex color> (e.g., #000000FF)
    • dim_inactive_colors.urgent <hex color> (e.g., #900000FF)
  12. Manage swaynag notification types

    master

    Swaynag uses a type-based system to define how different notifications (e.g., error) look and behave.

    • Default Types: Use swaynag_types_add_default(types) to populate the initial set of available types.
    • Type Merging: Configuration is applied by merging types. A specific notification type is constructed by merging <defaults>, <config>, the specific type definition, and finally <args>.
    • Type Retrieval: Use swaynag_type_get(types, name) to retrieve a specific type definition from the types list.