From 9b2b7fe493c196dff0e9ba77fb94d700a4d9eaa2 Mon Sep 17 00:00:00 2001 From: Sem Van Broekhoven <144097969+dotsem@users.noreply.github.com> Date: Sat, 24 Jan 2026 21:19:06 +0100 Subject: [PATCH 1/2] update roadmap --- ROADMAP.md | 1 + 1 file changed, 1 insertion(+) diff --git a/ROADMAP.md b/ROADMAP.md index 96ba74b..4efd7b6 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -18,6 +18,7 @@ The first release will include a taskbar and a basic app launcher. It is not pla - [ ] create crate for shared window manager communication -> 1 crate communicating with the current window manager. This crate will then share generalized data to each crate that asks for information. This means that most of the window manager information is only fetched once and updated effeciently - [ ] create **selector for media source for media player** - [ ] add app basic **app launcher** (directly create a standard menu for this to share other menu items) +- [ ] add systray - [ ] add generalized config file with following configs - show seconds - DD/MM/YYYY or MM/DD/YYYY From 2b1308aa7a38cbf075c9868876ec04c5000ef2ea Mon Sep 17 00:00:00 2001 From: Sem Van Broekhoven <144097969+dotsem@users.noreply.github.com> Date: Sat, 24 Jan 2026 22:50:57 +0100 Subject: [PATCH 2/2] add basic CI pipeline --- .github/workflows/ci.yml | 40 ++++++++++++++++++++++++++++ crates/capy-wm/src/window_backend.rs | 37 +++++++++++++++++++++++++ 2 files changed, 77 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..58aa1e5 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,40 @@ +name: CI + +on: + push: + branches: [ main, master ] + pull_request: + branches: [ main, master ] + +env: + CARGO_TERM_COLOR: always + +jobs: + build: + name: Build and Test + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Install system dependencies + run: | + sudo apt-get update + sudo apt-get install -y libslint-dev libasound2-dev libpulse-dev libdbus-1-dev libbluetooth-dev libnm-dev libudev-dev + + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@stable + with: + components: clippy, rustfmt + + - name: Check formatting + run: cargo fmt --all -- --check + + - name: Linting + run: cargo clippy --all-targets --all-features -- -D warnings + + - name: Run tests + run: cargo test --all-targets --all-features + + - name: Build + run: cargo build --release --verbose diff --git a/crates/capy-wm/src/window_backend.rs b/crates/capy-wm/src/window_backend.rs index 3b2104a..8f3ae79 100644 --- a/crates/capy-wm/src/window_backend.rs +++ b/crates/capy-wm/src/window_backend.rs @@ -75,3 +75,40 @@ pub fn create_backend() -> Option> { pub fn get_backend() -> Box { create_backend().expect("No supported window manager detected") } + +#[cfg(test)] +mod tests { + use super::*; + use std::env; + use std::sync::Mutex; + + // Use a mutex to ensure tests that modify env vars don't race + static ENV_LOCK: Mutex<()> = Mutex::new(()); + + #[test] + fn test_detect_wm_hyprland_xdg() { + let _guard = ENV_LOCK.lock().unwrap(); + + unsafe { + env::set_var("XDG_CURRENT_DESKTOP", "Hyprland"); + } + assert_eq!(detect_wm(), WmType::Hyprland); + unsafe { + env::remove_var("XDG_CURRENT_DESKTOP"); + } + } + + #[test] + fn test_detect_wm_unknown() { + let _guard = ENV_LOCK.lock().unwrap(); + + // Clear potential env vars + unsafe { + env::remove_var("XDG_CURRENT_DESKTOP"); + env::remove_var("HYPRLAND_INSTANCE_SIGNATURE"); + env::remove_var("SWAYSOCK"); + } + + assert_eq!(detect_wm(), WmType::Unknown); + } +}