A minimal dependency graphics client using Wayland.
- Expose keyboard events
- Render colored rectangles
- ASCII 5x7 character rendering
- Swift concurrency support
- Toolbar and Windowed Applications.
swift run
swift run --traits Toolbar
You can import Wayland as a package dependency to build your own Wayland
clients.
Optional include "Toolbar"
trait
if you would like to build your client as a Toolbar. By default apps are built
as Windowed.
.package(url: "https://github.com/zaneenders/swift-wayland.git", branch: "main", traits: ["Toolbar"])Install Dependencies
Install Wayland headers
sudo dnf install -y wayland-devel wayland-protocols-devel mesa-libEGL-devel mesa-libGLES-develCurrently we are using wayland-client.h. To regenerate the protocol imports
you can run the following commands.
Basic Windowing support
wayland-scanner client-header < protocols/xdg-shell.xml > Sources/CXDGShell/include/xdg-shell-client-protocol.h
wayland-scanner private-code < protocols/xdg-shell.xml > Sources/CXDGShell/xdg-shell-protocol.cToolbar support headers
wayland-scanner client-header < protocols/wlr-layer-shell-unstable-v1.xml > Sources/CXDGShell/include/layer-shell-client-protocol.h
wayland-scanner private-code < protocols/wlr-layer-shell-unstable-v1.xml > Sources/CXDGShell/layer-shell-protocol.cGenerate detailed coverage report:
swift test --enable-code-coverage
llvm-cov report .build/debug/swift-waylandPackageTests.xctest --instr-profile=.build/debug/codecov/default.profdata --ignore-filename-regex='(.build|Tests)[/\\].*'Currently I am using wayland-client.h to get this up and running but ideally
this will be down without this dependency. The goal of removing this dependency
is for
static cross complication
.
For Asahi linux adding the following lines to the .config/hypr/hyprland.conf
does fix the error with running on the GPU but is sluggish. I assume this is
because the driver isn’t as optimize because this is a very unbeaten path.
env = MESA_LOADER_DRIVER_OVERRIDE,asahi
env = WLR_RENDERER,vulkan
Currently we are linking against a few wayland libraries to handle sending messages to the wayland compositor. This can be switched out for our own server. I have had some success getting swift-nio working but my implementation broke and decided to spend the time getting a working project and figured I could come back to the feature.
- Support adding boarders.