i3status-rust: update it to handle 0.30.x releases (#3773)

* i3status-rust: update it to handle 0.30.x releases

0.30.0 is a major release that brings many breaking changes to the
configuration file. See:
https://github.com/greshake/i3status-rust/blob/master/NEWS.md#i3status-rust-0300

The only one that actually affects the module though is the change in
how the theme/icons are defined. Other changes are mostly on how to
specify formatting/blocks, and since we just generate the TOML as-is, it
needs changes in the user side.

So most changes in this commit are documentation updates, having
up-to-date examples from things that changed, e.g.: the new `click`
attribute that now can be applied to any block.

* i3status-rust: only use new format if i3status-rust >= 0.30.0

* news: document the i3status-rust changes

* i3status-rust: add thiagokokada as maintainer
This commit is contained in:
Thiago Kenji Okada 2023-03-16 11:48:55 +00:00 committed by GitHub
parent 5e94669f8e
commit b832390db3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 248 additions and 158 deletions

View file

@ -3,4 +3,5 @@
i3status-rust-with-custom = ./with-custom.nix;
i3status-rust-with-extra-settings = ./with-extra-settings.nix;
i3status-rust-with-multiple-bars = ./with-multiple-bars.nix;
i3status-rust-with-version-02xx = ./with-version-02xx.nix;
}

View file

@ -1,7 +1,5 @@
{ config, lib, pkgs, ... }:
with lib;
{
config = {
programs.i3status-rust = {
@ -12,9 +10,7 @@ with lib;
{
block = "disk_space";
path = "/";
alias = "/";
info_type = "available";
unit = "GB";
interval = 60;
warning = 20.0;
alert = 10.0;
@ -28,34 +24,27 @@ with lib;
{
block = "cpu";
interval = 1;
format = "{barchart}";
format = " $icon $barchart ";
}
{
block = "load";
interval = 1;
format = "{1m} {5m}";
format = " $icon $1m $5m ";
}
{
block = "temperature";
collapsed = true;
interval = 10;
format = "{min}° min, {max}° max, {average}° avg";
format = "$icon $min min, $max max, $average avg";
chip = "*-isa-*";
}
{
block = "networkmanager";
ap_format = "{ssid} @ {strength}%";
on_click = "kcmshell5 kcm_networkmanagement";
}
{
block = "net";
device = "enp9s0u2u1u2c2";
speed_up = true;
interval = 5;
}
{
block = "speedtest";
bytes = true;
format = " ^icon_ping $ping ";
}
{
block = "xrandr";
@ -65,7 +54,10 @@ with lib;
{
block = "sound";
format = "{output_name} {volume}%";
on_click = "pavucontrol --tab=3";
click = [{
button = "left";
cmd = "pavucontrol --tab=3";
}];
mappings = {
"alsa_output.pci-0000_00_1f.3.analog-stereo" = "";
"bluez_sink.70_26_05_DA_27_A4.a2dp_sink" = "";
@ -75,12 +67,25 @@ with lib;
block = "music";
player = "spotify";
buttons = [ "play" "prev" "next" ];
on_collapsed_click = "i3-msg '[class=Spotify] focus'";
click = [
{
button = "play";
action = "music_play";
}
{
button = "prev";
action = "music_prev";
}
{
button = "next";
action = "music_next";
}
];
}
{
block = "time";
interval = 60;
format = "%a %d.%m %R";
format = " $timestamp.datetime(f:'%a %d/%m %R') ";
}
{ block = "battery"; }
];
@ -92,23 +97,19 @@ with lib;
};
};
test.stubs.i3status-rust = { };
test.stubs.i3status-rust = { version = "0.30.0"; };
nmt.script = ''
assertFileExists home-files/.config/i3status-rust/config-custom.toml
assertFileContent home-files/.config/i3status-rust/config-custom.toml \
${
pkgs.writeText "i3status-rust-expected-config" ''
icons = "awesome5"
theme = "gruvbox-dark"
[[block]]
alert = 10.0
alias = "/"
block = "disk_space"
info_type = "available"
interval = 60
path = "/"
unit = "GB"
warning = 20.0
[[block]]
@ -119,35 +120,28 @@ with lib;
[[block]]
block = "cpu"
format = "{barchart}"
format = " $icon $barchart "
interval = 1
[[block]]
block = "load"
format = "{1m} {5m}"
format = " $icon $1m $5m "
interval = 1
[[block]]
block = "temperature"
chip = "*-isa-*"
collapsed = true
format = "{min}° min, {max}° max, {average}° avg"
format = "$icon $min min, $max max, $average avg"
interval = 10
[[block]]
ap_format = "{ssid} @ {strength}%"
block = "networkmanager"
on_click = "kcmshell5 kcm_networkmanagement"
[[block]]
block = "net"
device = "enp9s0u2u1u2c2"
interval = 5
speed_up = true
[[block]]
block = "speedtest"
bytes = true
format = " ^icon_ping $ping "
[[block]]
block = "xrandr"
@ -156,7 +150,10 @@ with lib;
[[block]]
block = "sound"
format = "{output_name} {volume}%"
on_click = "pavucontrol --tab=3"
[[block.click]]
button = "left"
cmd = "pavucontrol --tab=3"
[block.mappings]
"alsa_output.pci-0000_00_1f.3.analog-stereo" = ""
@ -165,16 +162,33 @@ with lib;
[[block]]
block = "music"
buttons = ["play", "prev", "next"]
on_collapsed_click = "i3-msg '[class=Spotify] focus'"
player = "spotify"
[[block.click]]
action = "music_play"
button = "play"
[[block.click]]
action = "music_prev"
button = "prev"
[[block.click]]
action = "music_next"
button = "next"
[[block]]
block = "time"
format = "%a %d.%m %R"
format = " $timestamp.datetime(f:'%a %d/%m %R') "
interval = 60
[[block]]
block = "battery"
[icons]
icons = "awesome5"
[theme]
theme = "gruvbox-dark"
''
}
'';

View file

@ -1,35 +1,28 @@
{ config, lib, pkgs, ... }:
with lib;
{
config = {
programs.i3status-rust = { enable = true; };
test.stubs.i3status-rust = { };
test.stubs.i3status-rust = { version = "0.30.0"; };
nmt.script = ''
assertFileExists home-files/.config/i3status-rust/config-default.toml
assertFileContent home-files/.config/i3status-rust/config-default.toml \
${
pkgs.writeText "i3status-rust-expected-config" ''
icons = "none"
theme = "plain"
[[block]]
alert = 10.0
alias = "/"
block = "disk_space"
info_type = "available"
interval = 60
path = "/"
unit = "GB"
warning = 20.0
[[block]]
block = "memory"
display_type = "memory"
format_mem = "{mem_used_percents}"
format_swap = "{swap_used_percents}"
format = " $icon mem_used_percents "
format_alt = " $icon $swap_used_percents "
[[block]]
block = "cpu"
@ -37,7 +30,7 @@ with lib;
[[block]]
block = "load"
format = "{1m}"
format = " $icon $1m "
interval = 1
[[block]]
@ -45,8 +38,14 @@ with lib;
[[block]]
block = "time"
format = "%a %d/%m %R"
format = " $timestamp.datetime(f:'%a %d/%m %R') "
interval = 60
[icons]
icons = "none"
[theme]
theme = "plain"
''
}
'';

View file

@ -1,7 +1,5 @@
{ config, lib, pkgs, ... }:
with lib;
{
config = {
programs.i3status-rust = {
@ -12,9 +10,7 @@ with lib;
{
block = "disk_space";
path = "/";
alias = "/";
info_type = "available";
unit = "GB";
interval = 60;
warning = 20.0;
alert = 10.0;
@ -28,34 +24,27 @@ with lib;
{
block = "cpu";
interval = 1;
format = "{barchart}";
format = " $icon $barchart ";
}
{
block = "load";
interval = 1;
format = "{1m} {5m}";
format = " $icon $1m $5m ";
}
{
block = "temperature";
collapsed = true;
interval = 10;
format = "{min}° min, {max}° max, {average}° avg";
format = "$icon $min min, $max max, $average avg";
chip = "*-isa-*";
}
{
block = "networkmanager";
ap_format = "{ssid} @ {strength}%";
on_click = "kcmshell5 kcm_networkmanagement";
}
{
block = "net";
device = "enp9s0u2u1u2c2";
speed_up = true;
interval = 5;
}
{
block = "speedtest";
bytes = true;
format = " ^icon_ping $ping ";
}
{
block = "xrandr";
@ -65,7 +54,10 @@ with lib;
{
block = "sound";
format = "{output_name} {volume}%";
on_click = "pavucontrol --tab=3";
click = [{
button = "left";
cmd = "pavucontrol --tab=3";
}];
mappings = {
"alsa_output.pci-0000_00_1f.3.analog-stereo" = "";
"bluez_sink.70_26_05_DA_27_A4.a2dp_sink" = "";
@ -75,12 +67,25 @@ with lib;
block = "music";
player = "spotify";
buttons = [ "play" "prev" "next" ];
on_collapsed_click = "i3-msg '[class=Spotify] focus'";
click = [
{
button = "play";
action = "music_play";
}
{
button = "prev";
action = "music_prev";
}
{
button = "next";
action = "music_next";
}
];
}
{
block = "time";
interval = 60;
format = "%a %d.%m %R";
format = " $timestamp.datetime(f:'%a %d/%m %R') ";
}
{ block = "battery"; }
];
@ -89,7 +94,7 @@ with lib;
settings = {
theme = {
name = "solarized-dark";
theme = "solarized-dark";
overrides = {
idle_bg = "#123456";
idle_fg = "#abcdef";
@ -102,22 +107,19 @@ with lib;
};
};
test.stubs.i3status-rust = { };
test.stubs.i3status-rust = { version = "0.30.0"; };
nmt.script = ''
assertFileExists home-files/.config/i3status-rust/config-extra-settings.toml
assertFileContent home-files/.config/i3status-rust/config-extra-settings.toml \
${
pkgs.writeText "i3status-rust-expected-config" ''
icons = "awesome5"
[[block]]
alert = 10.0
alias = "/"
block = "disk_space"
info_type = "available"
interval = 60
path = "/"
unit = "GB"
warning = 20.0
[[block]]
@ -128,35 +130,28 @@ with lib;
[[block]]
block = "cpu"
format = "{barchart}"
format = " $icon $barchart "
interval = 1
[[block]]
block = "load"
format = "{1m} {5m}"
format = " $icon $1m $5m "
interval = 1
[[block]]
block = "temperature"
chip = "*-isa-*"
collapsed = true
format = "{min}° min, {max}° max, {average}° avg"
format = "$icon $min min, $max max, $average avg"
interval = 10
[[block]]
ap_format = "{ssid} @ {strength}%"
block = "networkmanager"
on_click = "kcmshell5 kcm_networkmanagement"
[[block]]
block = "net"
device = "enp9s0u2u1u2c2"
interval = 5
speed_up = true
[[block]]
block = "speedtest"
bytes = true
format = " ^icon_ping $ping "
[[block]]
block = "xrandr"
@ -165,7 +160,10 @@ with lib;
[[block]]
block = "sound"
format = "{output_name} {volume}%"
on_click = "pavucontrol --tab=3"
[[block.click]]
button = "left"
cmd = "pavucontrol --tab=3"
[block.mappings]
"alsa_output.pci-0000_00_1f.3.analog-stereo" = ""
@ -174,19 +172,33 @@ with lib;
[[block]]
block = "music"
buttons = ["play", "prev", "next"]
on_collapsed_click = "i3-msg '[class=Spotify] focus'"
player = "spotify"
[[block.click]]
action = "music_play"
button = "play"
[[block.click]]
action = "music_prev"
button = "prev"
[[block.click]]
action = "music_next"
button = "next"
[[block]]
block = "time"
format = "%a %d.%m %R"
format = " $timestamp.datetime(f:'%a %d/%m %R') "
interval = 60
[[block]]
block = "battery"
[icons]
icons = "awesome5"
[theme]
name = "solarized-dark"
theme = "solarized-dark"
[theme.overrides]
idle_bg = "#123456"

View file

@ -1,7 +1,5 @@
{ config, lib, pkgs, ... }:
with lib;
{
config = {
programs.i3status-rust = {
@ -13,19 +11,15 @@ with lib;
blocks = [
{
block = "disk_space";
path = "/";
alias = "/";
info_type = "available";
unit = "GB";
interval = 60;
warning = 20.0;
alert = 10.0;
}
{
block = "memory";
display_type = "memory";
format_mem = "{Mug}GB ({Mup}%)";
format_swap = "{SUp}%";
format_mem = " $icon $Mug ($Mup) ";
format_swap = " $icon $SUp ";
}
];
};
@ -35,12 +29,12 @@ with lib;
{
block = "cpu";
interval = 1;
format = "{barchart}";
format = " $icon $barchart ";
}
{
block = "load";
interval = 1;
format = "{1m} {5m}";
format = " $icon $1m $5m ";
}
];
icons = "awesome5";
@ -52,30 +46,30 @@ with lib;
};
test.stubs.i3status-rust = { };
test.stubs.i3status-rust = { version = "0.30.0"; };
nmt.script = ''
assertFileExists home-files/.config/i3status-rust/config-top.toml
assertFileContent home-files/.config/i3status-rust/config-top.toml \
${
pkgs.writeText "i3status-rust-expected-config" ''
icons = "none"
theme = "plain"
[[block]]
alert = 10.0
alias = "/"
block = "disk_space"
info_type = "available"
interval = 60
path = "/"
unit = "GB"
warning = 20.0
[[block]]
block = "memory"
display_type = "memory"
format_mem = "{Mug}GB ({Mup}%)"
format_swap = "{SUp}%"
format_mem = " $icon $Mug ($Mup) "
format_swap = " $icon $SUp "
[icons]
icons = "none"
[theme]
theme = "plain"
''
}
@ -84,17 +78,21 @@ with lib;
home-files/.config/i3status-rust/config-bottom.toml \
${
pkgs.writeText "i3status-rust-expected-config" ''
icons = "awesome5"
theme = "gruvbox-dark"
[[block]]
block = "cpu"
format = "{barchart}"
format = " $icon $barchart "
interval = 1
[[block]]
block = "load"
format = "{1m} {5m}"
format = " $icon $1m $5m "
interval = 1
[icons]
icons = "awesome5"
[theme]
theme = "gruvbox-dark"
''
}
'';

View file

@ -0,0 +1,49 @@
{ config, lib, pkgs, ... }:
{
config = {
programs.i3status-rust = { enable = true; };
test.stubs.i3status-rust = { version = "0.29.9"; };
nmt.script = ''
assertFileExists home-files/.config/i3status-rust/config-default.toml
assertFileContent home-files/.config/i3status-rust/config-default.toml \
${
pkgs.writeText "i3status-rust-expected-config" ''
icons = "none"
theme = "plain"
[[block]]
alert = 10.0
block = "disk_space"
info_type = "available"
interval = 60
path = "/"
warning = 20.0
[[block]]
block = "memory"
format = " $icon mem_used_percents "
format_alt = " $icon $swap_used_percents "
[[block]]
block = "cpu"
interval = 1
[[block]]
block = "load"
format = " $icon $1m "
interval = 1
[[block]]
block = "sound"
[[block]]
block = "time"
format = " $timestamp.datetime(f:'%a %d/%m %R') "
interval = 60
''
}
'';
};
}