[PR #932] [MERGED] Fix compilation for many feature combinations #8073

Closed
opened 2026-05-23 02:56:34 +01:00 by JakeStanger · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/JakeStanger/ironbar/pull/932
Author: @Rodrigodd
Created: 4/9/2025
Status: Merged
Merged: 4/16/2025
Merged by: @JakeStanger

Base: masterHead: fix/cfg-features


📝 Commits (10+)

  • 20a7da9 Fix compilation for many feature combinations
  • 8b17142 fix: keep Mpris as the default music player type
  • ea4903b fix: update futures-lite comment
  • 887990c fix: remove redundant "clap" feature dependency from "cli"
  • 598c3ec fix: don't make IPC a dependency of sysinfo module
  • 21e7b57 refactor: move serde_json feature to "shared" section
  • 1b4202e refactor: avoid cfgs inside listen_workspace_events
  • ab3de0e refactor: sort multiline cfg any's
  • 4d3c0c6 Revert "refactor: avoid cfgs inside listen_workspace_events"
  • dfdd0bf refactor: split listen_workspace_events in more functions

📊 Changes

11 files changed (+340 additions, -242 deletions)

View changed files

📝 Cargo.toml (+9 -9)
📝 src/clients/compositor/hyprland.rs (+253 -212)
📝 src/clients/compositor/mod.rs (+18 -12)
📝 src/clients/compositor/sway.rs (+7 -2)
📝 src/clients/mod.rs (+4 -1)
📝 src/clients/music/mod.rs (+4 -0)
📝 src/clients/sysinfo.rs (+5 -1)
📝 src/image/gtk.rs (+18 -2)
📝 src/image/mod.rs (+9 -2)
📝 src/modules/music/config.rs (+11 -1)
📝 src/modules/music/mod.rs (+2 -0)

📄 Description

This is a extended fix for the issue I pointed out in https://github.com/JakeStanger/ironbar/pull/855#issuecomment-2632505664 and tracked by the issue #862 which was not fully fixed by #910. This also fixes many issues with other features.

I use the following shell script to test the changes:

#!/bin/sh

check() {
    echo "Checking $1"
    cargo check --no-default-features --features "$@" 1>/dev/null 2>/dev/null
}

cargo check \
&& check config+json \
&& check config+yaml \
&& check config+toml \
&& check config+ron \
&& check config+all \
&& check config+yaml,keyboard+all \
&& check config+yaml,workspaces+all \
&& check config+yaml,workspaces+all,keyboard+all \
&& check config+yaml,workspaces+sway,keyboard+hyprland \
&& check config+yaml,workspaces+hyprland,keyboard+sway \
&& check config+yaml,workspaces+hyprland,keyboard+sway \
&& check config+yaml,workspaces,hyprland,keyboard,sway \
&& check config+yaml,workspaces \
&& check config+yaml,keyboard \
&& check config+yaml,sway \
&& check config+yaml,niri \
&& check config+yaml,hyprland \
&& check config+yaml,music+mpris \
&& check config+yaml,music+mpd \
&& check config+yaml,cli \
&& check config+yaml,cairo \
&& check config+yaml,clipboard \
&& check config+yaml,clock \
&& check config+yaml,config+all \
&& check config+yaml,custom \
&& check config+yaml,focused \
&& check config+yaml,http \
&& check config+yaml,ipc \
&& check config+yaml,keyboard+all \
&& check config+yaml,launcher \
&& check config+yaml,label \
&& check config+yaml,music+all \
&& check config+yaml,network_manager \
&& check config+yaml,notifications \
&& check config+yaml,script \
&& check config+yaml,sys_info \
&& check config+yaml,tray \
&& check config+yaml,upower \
&& check config+yaml,volume \
&& check config+yaml,workspaces+all \
&& check config+yaml,schema \
&& echo "Check passed" \
|| echo "Check failed"

# Fails to compile, cannot get a default for PlayerType
# && check config+yaml,music \

# universal-config fails to compile
# && check ''
# && check config+corn \

Some notes:

  • I added config+yaml as a feature to all checks, because without it universal-config fails to compile (but that is fixed by https://github.com/JakeStanger/universal-config-rs/pull/8).
  • I was careful with features like keyboard+sway and workspace+hyprland to only enable the implementation of the module for the given compositor when those specific features are enable, and not when only keyboard and sway are both enabled, for example.
  • I replace cfg checks like #[cfg(any(feature = "keyboard+hyprland", feature = "workspaces+hyprland"))] with a feature for each compositor (like #[cfg(feature = "hyprland") in that case). This will scale better when more compositor aware modules are added (like my bindmode+sway and bindmode+hyprland in the near future).

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/JakeStanger/ironbar/pull/932 **Author:** [@Rodrigodd](https://github.com/Rodrigodd) **Created:** 4/9/2025 **Status:** ✅ Merged **Merged:** 4/16/2025 **Merged by:** [@JakeStanger](https://github.com/JakeStanger) **Base:** `master` ← **Head:** `fix/cfg-features` --- ### 📝 Commits (10+) - [`20a7da9`](https://github.com/JakeStanger/ironbar/commit/20a7da9ea6ba16d6ff3b59663f6d3c993ce61fb3) Fix compilation for many feature combinations - [`8b17142`](https://github.com/JakeStanger/ironbar/commit/8b171429184f9a6f0dde255121001de4c655c881) fix: keep Mpris as the default music player type - [`ea4903b`](https://github.com/JakeStanger/ironbar/commit/ea4903b202906dd0f976d67ffac8835edf800bb0) fix: update futures-lite comment - [`887990c`](https://github.com/JakeStanger/ironbar/commit/887990cf2b63691a191c987c6890bbd625583a8f) fix: remove redundant "clap" feature dependency from "cli" - [`598c3ec`](https://github.com/JakeStanger/ironbar/commit/598c3ecc3ff8cd17da7292d2bb2663c982d95384) fix: don't make IPC a dependency of sysinfo module - [`21e7b57`](https://github.com/JakeStanger/ironbar/commit/21e7b57c405e20e72fa4a1e14295e5b01343aff6) refactor: move serde_json feature to "shared" section - [`1b4202e`](https://github.com/JakeStanger/ironbar/commit/1b4202ed80c9483c609ada8c4436e0fec26a9eef) refactor: avoid cfgs inside listen_workspace_events - [`ab3de0e`](https://github.com/JakeStanger/ironbar/commit/ab3de0e1ba0627513d2fac9a309d0367a9dc8f14) refactor: sort multiline cfg any's - [`4d3c0c6`](https://github.com/JakeStanger/ironbar/commit/4d3c0c64042284e07617f573dfda99d1fecae769) Revert "refactor: avoid cfgs inside listen_workspace_events" - [`dfdd0bf`](https://github.com/JakeStanger/ironbar/commit/dfdd0bfeae0dca88395c31a2041409b56c96ed89) refactor: split listen_workspace_events in more functions ### 📊 Changes **11 files changed** (+340 additions, -242 deletions) <details> <summary>View changed files</summary> 📝 `Cargo.toml` (+9 -9) 📝 `src/clients/compositor/hyprland.rs` (+253 -212) 📝 `src/clients/compositor/mod.rs` (+18 -12) 📝 `src/clients/compositor/sway.rs` (+7 -2) 📝 `src/clients/mod.rs` (+4 -1) 📝 `src/clients/music/mod.rs` (+4 -0) 📝 `src/clients/sysinfo.rs` (+5 -1) 📝 `src/image/gtk.rs` (+18 -2) 📝 `src/image/mod.rs` (+9 -2) 📝 `src/modules/music/config.rs` (+11 -1) 📝 `src/modules/music/mod.rs` (+2 -0) </details> ### 📄 Description This is a extended fix for the issue I pointed out in https://github.com/JakeStanger/ironbar/pull/855#issuecomment-2632505664 and tracked by the issue #862 which was not fully fixed by #910. This also fixes many issues with other features. I use the following shell script to test the changes: ```sh #!/bin/sh check() { echo "Checking $1" cargo check --no-default-features --features "$@" 1>/dev/null 2>/dev/null } cargo check \ && check config+json \ && check config+yaml \ && check config+toml \ && check config+ron \ && check config+all \ && check config+yaml,keyboard+all \ && check config+yaml,workspaces+all \ && check config+yaml,workspaces+all,keyboard+all \ && check config+yaml,workspaces+sway,keyboard+hyprland \ && check config+yaml,workspaces+hyprland,keyboard+sway \ && check config+yaml,workspaces+hyprland,keyboard+sway \ && check config+yaml,workspaces,hyprland,keyboard,sway \ && check config+yaml,workspaces \ && check config+yaml,keyboard \ && check config+yaml,sway \ && check config+yaml,niri \ && check config+yaml,hyprland \ && check config+yaml,music+mpris \ && check config+yaml,music+mpd \ && check config+yaml,cli \ && check config+yaml,cairo \ && check config+yaml,clipboard \ && check config+yaml,clock \ && check config+yaml,config+all \ && check config+yaml,custom \ && check config+yaml,focused \ && check config+yaml,http \ && check config+yaml,ipc \ && check config+yaml,keyboard+all \ && check config+yaml,launcher \ && check config+yaml,label \ && check config+yaml,music+all \ && check config+yaml,network_manager \ && check config+yaml,notifications \ && check config+yaml,script \ && check config+yaml,sys_info \ && check config+yaml,tray \ && check config+yaml,upower \ && check config+yaml,volume \ && check config+yaml,workspaces+all \ && check config+yaml,schema \ && echo "Check passed" \ || echo "Check failed" # Fails to compile, cannot get a default for PlayerType # && check config+yaml,music \ # universal-config fails to compile # && check '' # && check config+corn \ ``` Some notes: - I added `config+yaml` as a feature to all checks, because without it `universal-config` fails to compile (but that is fixed by https://github.com/JakeStanger/universal-config-rs/pull/8). - I was careful with features like `keyboard+sway` and `workspace+hyprland` to only enable the implementation of the module for the given compositor when those specific features are enable, and not when only `keyboard` and `sway` are both enabled, for example. - I replace cfg checks like `#[cfg(any(feature = "keyboard+hyprland", feature = "workspaces+hyprland"))]` with a feature for each compositor (like `#[cfg(feature = "hyprland")` in that case). This will scale better when more compositor aware modules are added (like my `bindmode+sway` and `bindmode+hyprland` in the near future). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
JakeStanger 2026-05-23 02:56:34 +01:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
JakeStanger/ironbar#8073
No description provided.