Contributing
Thank you for your interest in contributing to gSlapper! This guide will help you get started.
Thank you for your interest in contributing to gSlapper! This guide will help you get started.
Getting Started
- Fork the repository on GitHub
- Clone your fork:
git clone https://github.com/YOUR_USERNAME/gSlapper.git cd gSlapper - Create a branch for your changes:
git checkout -b feature/your-feature-name
Development Setup
See Building from Source for setup instructions.
Code Style
- C code follows K&R style with 4-space indentation
- GStreamer objects use
g_prefix (GLib naming) - Wayland objects use
wl_prefix - Static functions at file scope
- Global state in
global_statepointer - Thread communication via
wakeup_pipe
Making Changes
Adding New Features
- Plan your changes - Consider architecture and impact
- Update documentation - Add/update relevant docs
- Add tests - Create test scripts if applicable
- Test thoroughly - Test on different compositors and setups
Adding New IPC Commands
- Define command handler in
src/main.c'sprocess_ipc_commands()function - Parse command arguments from
cmd_linestring - Validate inputs and check state
- Implement command logic with thread safety in mind
- Send response via
ipc_send_response(client_fd, response) - Free command with
free(cmd->cmd_line)andfree(cmd)
See existing commands like set-transition or change for examples.
Adding New Transition Effects
- Add the type to
transition_type_tininc/transition.hand its name totype_namesinsrc/transition.c. The CLI and IPC parsers pick it up from there. - Map it to a shape in
transition_resolve(). Reuse an existingtransition_shape_twith fixed parameters if you can (that is howleftandcenterwork). - For a new shape, add a
transition_shape_tvalue and a branch inshape_mask()in the transition fragment shader (create_transition_shader_program()insrc/main.c). The mask returns 0 for the old image and 1 for the new one. - Test with
meson test -C build transitionandpython3 tests/check_transitions.py build/gslapper, adding a pixel check for the new type.
Modifying Rendering Pipeline
- Locate rendering code in
render()function - Ensure EGL context is current before OpenGL calls
- Lock
video_mutexwhen accessingvideo_frame_dataortransition_state - Update vertex data with
update_vertex_data()for scaling changes; the scale math lives incompute_quad_scale()(src/scaling.c) and is shared with the transition pass
Testing
Basic Functionality
# Test video playback
./build/gslapper -v DP-1 /path/to/video.mp4
# Test image display
./build/gslapper -v DP-1 /path/to/image.jpg
# Test with IPC enabled
./build/gslapper -I /tmp/test.sock -o "loop" DP-1 video.mp4Test Scripts
Run the included test scripts:
# Basic integration tests
./tests/test_basic.sh
# Memory safety tests (requires ASAN build or valgrind)
./tests/test_memory.sh
# Systemd service tests
./tests/test_systemd.shIPC Testing
# Start with IPC enabled
./build/gslapper -I /tmp/test.sock -vv -o "loop" DP-1 video.mp4
# From another terminal, test commands
echo "query" | nc -U /tmp/test.sock
echo "pause" | nc -U /tmp/test.sock
echo "resume" | nc -U /tmp/test.sockCommit Guidelines
- Write clear commit messages - Explain what and why
- Keep commits focused - One logical change per commit
- Test before committing - Ensure changes work
- Update documentation - Keep docs in sync with code
Commit Message Format
Short summary (50 chars or less)
More detailed explanation if needed. Wrap at 72 characters.
Explain what the change does and why.
- Bullet points for multiple changes
- Reference issues if applicablePull Request Process
- Ensure your code works - Test on your system
- Update documentation - Keep docs current
- Write a clear PR description - Explain changes and motivation
- Reference issues - Link to related issues if applicable
- Wait for review - Be responsive to feedback
Areas for Contribution
- Bug fixes - Report and fix issues
- Performance improvements - Optimize rendering or memory usage
- New features - Add requested functionality
- Documentation - Improve docs and examples
- Testing - Add test coverage
- Code quality - Refactor and improve code
Reporting Issues
When reporting issues, please include:
- gSlapper version -
gslapper --versionor git commit - System information - OS, compositor, GPU
- Steps to reproduce - Clear reproduction steps
- Expected behavior - What should happen
- Actual behavior - What actually happens
- Logs - Output with
-vvflag if applicable
Release Process
The in-repo PKGBUILD and gslapper.install are the canonical templates for the AUR package; the AUR copies must stay identical to them.
For every release vX.Y.Z, in order:
- Bump the version in all three files:
meson.build,PKGBUILD(pkgver), andflake.nix. - Update
gslapper.install:- Rewrite the "New in X.Y.Z" notes in
post_upgradefor this release. - Keep the brand ASCII banner in both
post_installandpost_upgrade. It was lost frompost_upgradein the 1.4.0 update; do not lose it again.
- Rewrite the "New in X.Y.Z" notes in
- Commit to master, push, then create and push the annotated tag
vX.Y.Z. The tag triggers the release workflow: per-distro builds (Ubuntu, Debian, Fedora), nfpm deb/rpm packaging, native Void XBPS builds for x86_64 glibc/musl, fresh-root install checks, and a GitHub Release with SHA256SUMS and SHA256SUMS-void. Confirm every job succeeds before continuing. - After the tag exists, download
https://github.com/Nomadcxx/gSlapper/archive/vX.Y.Z.tar.gz, put its sha256 intoPKGBUILDsha256sums, and commit that to master. The tag's own tarball necessarily carries the previous hash; master is what the AUR template is copied from, so master must be correct. - If linked libraries changed, update
dependsinPKGBUILDand the dependency lists in the release workflow (check withldd build/gslapper; example:systemd-libswas added in 1.5.1 for libsystemd). - Update the AUR package (
ssh://aur@aur.archlinux.org/gslapper.git):- Copy
PKGBUILDandgslapper.installfrom the repo. - Verify with a real build:
makepkg -fmust download the tag tarball, pass the checksum, and build. - Regenerate metadata:
makepkg --printsrcinfo > .SRCINFO. - Commit and push. Never commit tarballs,
pkg/, orsrc/.
- Copy
- Verify the release is live: the AUR cgit
.SRCINFOshows the newpkgver(the RPC API caches for a few minutes), and the GitHub Release lists the deb, rpm, both XBPS packages, the Void source archive, SHA256SUMS and SHA256SUMS-void assets.
Check Void packaging without releasing
Run gh workflow run release.yml --ref <branch> and inspect the gslapper-void-glibc and gslapper-void-musl artifacts. Dispatch runs create no release. The native recipe lives in packaging/void/; scripts/build-void-package.sh fills its version and checksum from the checked-out commit, then builds it with xbps-src from current void-packages master, which keeps the tree in step with the binary repository binary-bootstrap installs from. scripts/verify-void-package.sh installs the result in a fresh root and checks both executables.
Questions?
Feel free to open an issue for questions or discussions about contributions.
License
By contributing, you agree that your contributions will be licensed under the MIT License.
