1
0
Fork 0
mirror of https://github.com/Zedfrigg/ironbar.git synced 2025-08-16 22:31:03 +02:00

Merge pull request #912 from JakeStanger/build/feature-flags

build: add feature flags for `custom`, `label`, `script` modules
This commit is contained in:
Jake Stanger 2025-03-24 22:17:40 +00:00 committed by GitHub
commit 355cf39446
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 31 additions and 1 deletions

View file

@ -15,14 +15,17 @@ default = [
"clipboard", "clipboard",
"clock", "clock",
"config+all", "config+all",
"custom",
"focused", "focused",
"http", "http",
"ipc", "ipc",
"keyboard+all", "keyboard+all",
"launcher", "launcher",
"label",
"music+all", "music+all",
"network_manager", "network_manager",
"notifications", "notifications",
"script",
"sys_info", "sys_info",
"tray", "tray",
"upower", "upower",
@ -54,6 +57,8 @@ clipboard = ["dep:nix"]
clock = ["chrono"] clock = ["chrono"]
custom = []
focused = [] focused = []
keyboard = ["dep:input", "dep:evdev-rs", "dep:libc", "dep:nix"] keyboard = ["dep:input", "dep:evdev-rs", "dep:libc", "dep:nix"]
@ -61,6 +66,8 @@ keyboard = ["dep:input", "dep:evdev-rs", "dep:libc", "dep:nix"]
"keyboard+sway" = ["keyboard", "sway"] "keyboard+sway" = ["keyboard", "sway"]
"keyboard+hyprland" = ["keyboard", "hyprland"] "keyboard+hyprland" = ["keyboard", "hyprland"]
label = []
launcher = [] launcher = []
music = ["dep:regex"] music = ["dep:regex"]
@ -72,6 +79,8 @@ network_manager = ["futures-lite", "futures-signals", "zbus"]
notifications = ["zbus"] notifications = ["zbus"]
script = []
sys_info = ["dep:sysinfo"] sys_info = ["dep:sysinfo"]
tray = ["system-tray"] tray = ["system-tray"]

View file

@ -85,7 +85,7 @@ cargo build --release --no-default-features \
> ⚠ Make sure you enable at least one `config` feature otherwise you will not be able to start the bar! > ⚠ Make sure you enable at least one `config` feature otherwise you will not be able to start the bar!
| Feature | Description | | Feature | Description |
| ------------------- | --------------------------------------------------------------------------------- | |---------------------|-----------------------------------------------------------------------------------|
| **Core** | | | **Core** | |
| http | Enables HTTP features. Currently this includes the ability to load remote images. | | http | Enables HTTP features. Currently this includes the ability to load remote images. |
| ipc | Enables the IPC server. | | ipc | Enables the IPC server. |
@ -100,11 +100,13 @@ cargo build --release --no-default-features \
| cairo | Enables the `cairo` module | | cairo | Enables the `cairo` module |
| clipboard | Enables the `clipboard` module. | | clipboard | Enables the `clipboard` module. |
| clock | Enables the `clock` module. | | clock | Enables the `clock` module. |
| custom | Enables the `custom` module. |
| focused | Enables the `focused` module. | | focused | Enables the `focused` module. |
| keyboard | Enables the `keyboard` module without keyboard layout support. | | keyboard | Enables the `keyboard` module without keyboard layout support. |
| keyboard+all | Enables the `keyboard` module with keyboard layout support for all compositors. | | keyboard+all | Enables the `keyboard` module with keyboard layout support for all compositors. |
| keyboard+sway | Enables the `keyboard` module with keyboard layout support for Sway. | | keyboard+sway | Enables the `keyboard` module with keyboard layout support for Sway. |
| keyboard+hyprland | Enables the `keyboard` module with keyboard layout support for Hyprland. | | keyboard+hyprland | Enables the `keyboard` module with keyboard layout support for Hyprland. |
| label | Enables the `label` module. |
| launcher | Enables the `launcher` module. | | launcher | Enables the `launcher` module. |
| music+all | Enables the `music` module with support for all player types. | | music+all | Enables the `music` module with support for all player types. |
| music+mpris | Enables the `music` module with MPRIS support. | | music+mpris | Enables the `music` module with MPRIS support. |
@ -112,6 +114,7 @@ cargo build --release --no-default-features \
| network_manager | Enables the `network_manager` module. | | network_manager | Enables the `network_manager` module. |
| notifications | Enables the `notiications` module. | | notifications | Enables the `notiications` module. |
| sys_info | Enables the `sys_info` module. | | sys_info | Enables the `sys_info` module. |
| script | Enables the `script` module. |
| tray | Enables the `tray` module. | | tray | Enables the `tray` module. |
| upower | Enables the `upower` module. | | upower | Enables the `upower` module. |
| volume | Enables the `volume` module. | | volume | Enables the `volume` module. |

View file

@ -9,11 +9,13 @@ use crate::modules::cairo::CairoModule;
use crate::modules::clipboard::ClipboardModule; use crate::modules::clipboard::ClipboardModule;
#[cfg(feature = "clock")] #[cfg(feature = "clock")]
use crate::modules::clock::ClockModule; use crate::modules::clock::ClockModule;
#[cfg(feature = "custom")]
use crate::modules::custom::CustomModule; use crate::modules::custom::CustomModule;
#[cfg(feature = "focused")] #[cfg(feature = "focused")]
use crate::modules::focused::FocusedModule; use crate::modules::focused::FocusedModule;
#[cfg(feature = "keyboard")] #[cfg(feature = "keyboard")]
use crate::modules::keyboard::KeyboardModule; use crate::modules::keyboard::KeyboardModule;
#[cfg(feature = "label")]
use crate::modules::label::LabelModule; use crate::modules::label::LabelModule;
#[cfg(feature = "launcher")] #[cfg(feature = "launcher")]
use crate::modules::launcher::LauncherModule; use crate::modules::launcher::LauncherModule;
@ -23,6 +25,7 @@ use crate::modules::music::MusicModule;
use crate::modules::networkmanager::NetworkManagerModule; use crate::modules::networkmanager::NetworkManagerModule;
#[cfg(feature = "notifications")] #[cfg(feature = "notifications")]
use crate::modules::notifications::NotificationsModule; use crate::modules::notifications::NotificationsModule;
#[cfg(feature = "script")]
use crate::modules::script::ScriptModule; use crate::modules::script::ScriptModule;
#[cfg(feature = "sway")] #[cfg(feature = "sway")]
use crate::modules::sway::mode::SwayModeModule; use crate::modules::sway::mode::SwayModeModule;
@ -60,11 +63,13 @@ pub enum ModuleConfig {
Clipboard(Box<ClipboardModule>), Clipboard(Box<ClipboardModule>),
#[cfg(feature = "clock")] #[cfg(feature = "clock")]
Clock(Box<ClockModule>), Clock(Box<ClockModule>),
#[cfg(feature = "custom")]
Custom(Box<CustomModule>), Custom(Box<CustomModule>),
#[cfg(feature = "focused")] #[cfg(feature = "focused")]
Focused(Box<FocusedModule>), Focused(Box<FocusedModule>),
#[cfg(feature = "keyboard")] #[cfg(feature = "keyboard")]
Keyboard(Box<KeyboardModule>), Keyboard(Box<KeyboardModule>),
#[cfg(feature = "label")]
Label(Box<LabelModule>), Label(Box<LabelModule>),
#[cfg(feature = "launcher")] #[cfg(feature = "launcher")]
Launcher(Box<LauncherModule>), Launcher(Box<LauncherModule>),
@ -74,6 +79,7 @@ pub enum ModuleConfig {
NetworkManager(Box<NetworkManagerModule>), NetworkManager(Box<NetworkManagerModule>),
#[cfg(feature = "notifications")] #[cfg(feature = "notifications")]
Notifications(Box<NotificationsModule>), Notifications(Box<NotificationsModule>),
#[cfg(feature = "script")]
Script(Box<ScriptModule>), Script(Box<ScriptModule>),
#[cfg(feature = "sys_info")] #[cfg(feature = "sys_info")]
SysInfo(Box<SysInfoModule>), SysInfo(Box<SysInfoModule>),
@ -109,11 +115,13 @@ impl ModuleConfig {
Self::Clipboard(module) => create!(module), Self::Clipboard(module) => create!(module),
#[cfg(feature = "clock")] #[cfg(feature = "clock")]
Self::Clock(module) => create!(module), Self::Clock(module) => create!(module),
#[cfg(feature = "custom")]
Self::Custom(module) => create!(module), Self::Custom(module) => create!(module),
#[cfg(feature = "focused")] #[cfg(feature = "focused")]
Self::Focused(module) => create!(module), Self::Focused(module) => create!(module),
#[cfg(feature = "keyboard")] #[cfg(feature = "keyboard")]
Self::Keyboard(module) => create!(module), Self::Keyboard(module) => create!(module),
#[cfg(feature = "label")]
Self::Label(module) => create!(module), Self::Label(module) => create!(module),
#[cfg(feature = "launcher")] #[cfg(feature = "launcher")]
Self::Launcher(module) => create!(module), Self::Launcher(module) => create!(module),
@ -123,6 +131,7 @@ impl ModuleConfig {
Self::NetworkManager(module) => create!(module), Self::NetworkManager(module) => create!(module),
#[cfg(feature = "notifications")] #[cfg(feature = "notifications")]
Self::Notifications(module) => create!(module), Self::Notifications(module) => create!(module),
#[cfg(feature = "script")]
Self::Script(module) => create!(module), Self::Script(module) => create!(module),
#[cfg(feature = "sys_info")] #[cfg(feature = "sys_info")]
Self::SysInfo(module) => create!(module), Self::SysInfo(module) => create!(module),
@ -340,9 +349,12 @@ impl Default for BarConfig {
start_hidden: None, start_hidden: None,
autohide: None, autohide: None,
icon_theme: None, icon_theme: None,
#[cfg(feature = "label")]
start: Some(vec![ModuleConfig::Label( start: Some(vec![ModuleConfig::Label(
LabelModule::new(" Using default config".to_string()).into(), LabelModule::new(" Using default config".to_string()).into(),
)]), )]),
#[cfg(not(feature = "label"))]
start: None,
center, center,
end, end,
anchor_to_edges: default_true(), anchor_to_edges: default_true(),

View file

@ -29,11 +29,15 @@ pub mod clipboard;
/// with second-level precision and a calendar. /// with second-level precision and a calendar.
#[cfg(feature = "clock")] #[cfg(feature = "clock")]
pub mod clock; pub mod clock;
#[cfg(feature = "custom")]
pub mod custom; pub mod custom;
#[cfg(feature = "focused")] #[cfg(feature = "focused")]
pub mod focused; pub mod focused;
#[cfg(feature = "keyboard")] #[cfg(feature = "keyboard")]
pub mod keyboard; pub mod keyboard;
#[cfg(feature = "label")]
pub mod label; pub mod label;
#[cfg(feature = "launcher")] #[cfg(feature = "launcher")]
pub mod launcher; pub mod launcher;
@ -43,6 +47,8 @@ pub mod music;
pub mod networkmanager; pub mod networkmanager;
#[cfg(feature = "notifications")] #[cfg(feature = "notifications")]
pub mod notifications; pub mod notifications;
#[cfg(feature = "script")]
pub mod script; pub mod script;
#[cfg(feature = "sway")] #[cfg(feature = "sway")]
pub mod sway; pub mod sway;