Skip to content

Commit

Permalink
Merge pull request #24 from acheronfail/next
Browse files Browse the repository at this point in the history
0.11.0
  • Loading branch information
acheronfail authored Dec 28, 2023
2 parents 71bd8df + fae181a commit 5f7a6c6
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ jobs:
steps:
# downloads artifacts (this downloads the folder called `artifacts` defined in the `build-release` step)
- name: Download artifacts
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
path: .

Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "i3stat"
version = "0.10.4"
version = "0.11.0"
edition = "2021"
authors = ["acheronfail <[email protected]>"]
description = "A lightweight and batteries-included status_command for i3 and sway"
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ cargo install i3stat
paru -S i3stat-bin
# build the latest release with cargo
paru -S i3stat
# build the latest commit on `next`
paru -S i3stat-git
```

## Usage
Expand Down
5 changes: 2 additions & 3 deletions src/bar_items/light.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,8 @@ impl LightFile {
pub async fn format(&self) -> Result<I3Item> {
let pct = self.get().await?;
let icon = match pct {
0..=14 => "󰃚",
15..=29 => "󰃛",
30..=44 => "󰃜",
0..=29 => "󰃜",
30..=44 => "󰃛",
45..=59 => "󰃝",
60..=74 => "󰃞",
75..=89 => "󰃟",
Expand Down
7 changes: 6 additions & 1 deletion src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,16 @@ pub struct AppConfig {
/// List of the items for the bar
pub items: Vec<Item>,

/// Optional list of item indices to disable.
/// Useful when defining additional config files which disable items defined in previous config
/// files.
#[serde(default)]
pub disable: Vec<usize>,

/// Path to the socket to use for ipc. Useful when having multiple bars to separate their sockets.
/// The CLI option takes precedence over this.
#[serde(rename = "socket")]
socket: Option<PathBuf>,
/// Runtime only cache for the resolved socket path.

/// Runtime only cache for index to name item mappings
#[serde(skip)]
Expand Down
10 changes: 8 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ fn setup_i3_bar(config: &RcCell<AppConfig>) -> Result<(RcCell<Bar>, RcCell<Dispa

// Iterate config and create bar items
for (idx, item) in config.items.iter().enumerate() {
if config.disable.contains(&idx) {
log::info!("not creating item {idx} since it was disabled by config");
continue;
}

let bar_item = item.to_bar_item();

// all cheaply cloneable (smart pointers, senders, etc)
Expand Down Expand Up @@ -172,9 +177,10 @@ fn setup_i3_bar(config: &RcCell<AppConfig>) -> Result<(RcCell<Bar>, RcCell<Dispa
log::error!("item[{}] exited with error: {}", idx, e);
// replace with an error item
let theme = config.theme.clone();
bar[idx] = I3Item::new("ERROR")
bar[idx] = I3Item::new(format!("ERROR({})", config.items[idx].name()))
.color(theme.bg)
.background_color(theme.red);
.background_color(theme.red)
.instance(idx.to_string());
break;
}
}
Expand Down

0 comments on commit 5f7a6c6

Please sign in to comment.