diff options
| author | MaxVerevkin <maxxverrr@gmail.com> | 2023-06-28 10:54:33 +0300 |
|---|---|---|
| committer | MaxVerevkin <maxxverrr@gmail.com> | 2023-06-28 10:54:33 +0300 |
| commit | 432b6d66d4635fa70105c2ae6b6e470d0263c6cd (patch) | |
| tree | 1e3f7086003ed751f49244477f091e7d1b348146 /src | |
| parent | 436d14e65a10965dce1c737b123305f44139e13b (diff) | |
| download | i3bar-mango-432b6d66d4635fa70105c2ae6b6e470d0263c6cd.tar.gz | |
Add an option to show any number of tags (not only the first 9)
Diffstat (limited to 'src')
| -rw-r--r-- | src/config.rs | 25 | ||||
| -rw-r--r-- | src/wm_info_provider/river.rs | 3 |
2 files changed, 24 insertions, 4 deletions
diff --git a/src/config.rs b/src/config.rs index 98d7eb1..8465eee 100644 --- a/src/config.rs +++ b/src/config.rs @@ -11,6 +11,8 @@ use std::{env, fmt}; #[derive(Deserialize, Debug)] #[serde(deny_unknown_fields, default)] pub struct Config { + // command + pub command: Option<String>, // colors pub background: Color, pub color: Color, @@ -35,18 +37,20 @@ pub struct Config { pub tags_padding: f64, pub blocks_r: f64, pub blocks_overlap: f64, - // command - pub command: Option<String>, // misc pub position: Position, pub hide_inactive_tags: bool, pub invert_touchpad_scrolling: bool, pub show_layout_name: bool, + // wm-specific + pub wm: WmConfig, } impl Default for Config { fn default() -> Self { Self { + command: None, + // A kind of gruvbox theme background: Color::from_rgba_hex(0x282828ff), color: Color::from_rgba_hex(0xffffffff), @@ -59,6 +63,7 @@ impl Default for Config { tag_urgent_bg: Color::from_rgba_hex(0xcc241dff), tag_inactive_fg: Color::from_rgba_hex(0xd79921ff), tag_inactive_bg: Color::from_rgba_hex(0x282828ff), + font: Font::new("monospace 10"), height: 24, margin_top: 0, @@ -70,11 +75,15 @@ impl Default for Config { tags_padding: 25.0, blocks_r: 0.0, blocks_overlap: 0.0, - command: None, + position: Position::Top, hide_inactive_tags: true, invert_touchpad_scrolling: true, show_layout_name: true, + + wm: WmConfig { + river: RiverConfig { max_tag: 9 }, + }, } } } @@ -125,6 +134,16 @@ impl From<Position> for zwlr_layer_surface_v1::Anchor { } } +#[derive(Debug, Deserialize)] +pub struct WmConfig { + pub river: RiverConfig, +} + +#[derive(Debug, Deserialize)] +pub struct RiverConfig { + pub max_tag: u8, +} + #[derive(Debug)] pub struct Font(pub FontDescription); diff --git a/src/wm_info_provider/river.rs b/src/wm_info_provider/river.rs index 82fa5d8..e708930 100644 --- a/src/wm_info_provider/river.rs +++ b/src/wm_info_provider/river.rs @@ -91,6 +91,7 @@ fn output_status_cb( event: zriver_output_status_v1::Event, ) { let WmInfoProvider::River(river) = &mut state.shared_state.wm_info_provider else { unreachable!() }; + let max_tag = state.shared_state.config.wm.river.max_tag.min(32); let status = river .output_statuses @@ -114,7 +115,7 @@ fn output_status_cb( let info = WmInfo { layout_name: status.layout_name.clone(), - tags: (1..10) + tags: (1..=max_tag) .map(|tag| Tag { name: tag.to_string(), is_focused: status.focused_tags & (1 << (tag - 1)) != 0, |
