Skip to content

Commit 5f7a6c6

Browse files
authored
Merge pull request #24 from acheronfail/next
0.11.0
2 parents 71bd8df + fae181a commit 5f7a6c6

File tree

7 files changed

+21
-9
lines changed

7 files changed

+21
-9
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ jobs:
169169
steps:
170170
# downloads artifacts (this downloads the folder called `artifacts` defined in the `build-release` step)
171171
- name: Download artifacts
172-
uses: actions/download-artifact@v2
172+
uses: actions/download-artifact@v3
173173
with:
174174
path: .
175175

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "i3stat"
3-
version = "0.10.4"
3+
version = "0.11.0"
44
edition = "2021"
55
authors = ["acheronfail <acheronfail@gmail.com>"]
66
description = "A lightweight and batteries-included status_command for i3 and sway"

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ cargo install i3stat
8888
paru -S i3stat-bin
8989
# build the latest release with cargo
9090
paru -S i3stat
91+
# build the latest commit on `next`
92+
paru -S i3stat-git
9193
```
9294

9395
## Usage

src/bar_items/light.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,8 @@ impl LightFile {
105105
pub async fn format(&self) -> Result<I3Item> {
106106
let pct = self.get().await?;
107107
let icon = match pct {
108-
0..=14 => "󰃚",
109-
15..=29 => "󰃛",
110-
30..=44 => "󰃜",
108+
0..=29 => "󰃜",
109+
30..=44 => "󰃛",
111110
45..=59 => "󰃝",
112111
60..=74 => "󰃞",
113112
75..=89 => "󰃟",

src/config/mod.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,16 @@ pub struct AppConfig {
2929
/// List of the items for the bar
3030
pub items: Vec<Item>,
3131

32+
/// Optional list of item indices to disable.
33+
/// Useful when defining additional config files which disable items defined in previous config
34+
/// files.
35+
#[serde(default)]
36+
pub disable: Vec<usize>,
37+
3238
/// Path to the socket to use for ipc. Useful when having multiple bars to separate their sockets.
3339
/// The CLI option takes precedence over this.
3440
#[serde(rename = "socket")]
3541
socket: Option<PathBuf>,
36-
/// Runtime only cache for the resolved socket path.
3742

3843
/// Runtime only cache for index to name item mappings
3944
#[serde(skip)]

src/main.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,11 @@ fn setup_i3_bar(config: &RcCell<AppConfig>) -> Result<(RcCell<Bar>, RcCell<Dispa
102102

103103
// Iterate config and create bar items
104104
for (idx, item) in config.items.iter().enumerate() {
105+
if config.disable.contains(&idx) {
106+
log::info!("not creating item {idx} since it was disabled by config");
107+
continue;
108+
}
109+
105110
let bar_item = item.to_bar_item();
106111

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

0 commit comments

Comments
 (0)