mirror of
https://github.com/Zedfrigg/ironbar.git
synced 2025-08-17 23:01:04 +02:00
build: fix compilation for many feature combinations (#932)
* Fix compilation for many feature combinations * fix: keep Mpris as the default music player type * fix: update futures-lite comment * fix: remove redundant "clap" feature dependency from "cli" * fix: don't make IPC a dependency of sysinfo module * refactor: move serde_json feature to "shared" section * refactor: avoid cfgs inside listen_workspace_events by splitting list_keyboards_events out of it, which manages its own connection to the Hyprland IPC socket. * refactor: sort multiline cfg any's * Revert "refactor: avoid cfgs inside listen_workspace_events" This reverts commit 1b4202ed80c9483c609ada8c4436e0fec26a9eef. * refactor: split listen_workspace_events in more functions * style: fix broken identation Not sure why rustfmt didn't catch this.
This commit is contained in:
parent
5744929931
commit
cff6b1fc83
11 changed files with 363 additions and 265 deletions
|
@ -74,13 +74,23 @@ impl Default for Icons {
|
|||
#[serde(rename_all = "snake_case")]
|
||||
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
|
||||
pub enum PlayerType {
|
||||
#[cfg(feature = "music+mpd")]
|
||||
Mpd,
|
||||
#[cfg(feature = "music+mpris")]
|
||||
Mpris,
|
||||
}
|
||||
|
||||
impl Default for PlayerType {
|
||||
fn default() -> Self {
|
||||
Self::Mpris
|
||||
cfg_if::cfg_if! {
|
||||
if #[cfg(feature = "music+mpris")] {
|
||||
Self::Mpris
|
||||
} else if #[cfg(feature = "music+mpd")] {
|
||||
Self::Mpd
|
||||
} else {
|
||||
compile_error!("No player type feature enabled")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -76,7 +76,9 @@ fn get_client(
|
|||
music_dir: PathBuf,
|
||||
) -> Arc<dyn MusicClient> {
|
||||
let client_type = match player_type {
|
||||
#[cfg(feature = "music+mpd")]
|
||||
PlayerType::Mpd => music::ClientType::Mpd { host, music_dir },
|
||||
#[cfg(feature = "music+mpris")]
|
||||
PlayerType::Mpris => music::ClientType::Mpris,
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue