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

3
.github/CODEOWNERS vendored
View file

@ -152,7 +152,8 @@ Makefile @thiagokokada
/modules/programs/i3status.nix @JustinLovinger /modules/programs/i3status.nix @JustinLovinger
/modules/programs/i3status-rust.nix @workflow /modules/programs/i3status-rust.nix @workflow @thiagokokada
/tests/modules/programs/i3status-rust @thiagokokada
/modules/programs/ion.nix @jo1gi /modules/programs/ion.nix @jo1gi

View file

@ -931,6 +931,23 @@ in
A new module is available: 'services.avizo'. A new module is available: 'services.avizo'.
''; '';
} }
{
time = "2023-03-16:12:00+00:00";
condition = config.programs.i3status-rust.enable;
message = ''
Module 'i3status-rust' was updated to support the new configuration
format from 0.30.x releases, that introduces many breaking changes.
The documentation was updated with examples from 0.30.x to help
the transition.
See https://github.com/greshake/i3status-rust/blob/v0.30.0/NEWS.md
for instructions on how to migrate.
Users that don't want to migrate yet can set
'programs.i3status-rust.package' to an older version.
'';
}
]; ];
}; };
} }

View file

@ -9,7 +9,7 @@ let
settingsFormat = pkgs.formats.toml { }; settingsFormat = pkgs.formats.toml { };
in { in {
meta.maintainers = [ maintainers.farlion ]; meta.maintainers = with lib.maintainers; [ farlion thiagokokada ];
options.programs.i3status-rust = { options.programs.i3status-rust = {
enable = mkEnableOption "a replacement for i3-status written in Rust"; enable = mkEnableOption "a replacement for i3-status written in Rust";
@ -21,36 +21,32 @@ in {
blocks = mkOption { blocks = mkOption {
type = settingsFormat.type; type = settingsFormat.type;
default = [ default = [
{ block = "cpu"; }
{ {
block = "disk_space"; block = "disk_space";
path = "/"; path = "/";
alias = "/";
info_type = "available"; info_type = "available";
unit = "GB"; interval = 20;
interval = 60;
warning = 20.0; warning = 20.0;
alert = 10.0; alert = 10.0;
format = " $icon root: $available.eng(w:2) ";
} }
{ {
block = "memory"; block = "memory";
display_type = "memory"; format = " $icon $mem_total_used_percents.eng(w:2) ";
format_mem = "{mem_used_percents}"; format_alt = " $icon_swap $swap_used_percents.eng(w:2) ";
format_swap = "{swap_used_percents}";
} }
{ {
block = "cpu"; block = "sound";
interval = 1; click = [{
button = "left";
cmd = "pavucontrol";
}];
} }
{
block = "load";
interval = 1;
format = "{1m}";
}
{ block = "sound"; }
{ {
block = "time"; block = "time";
interval = 60; interval = 5;
format = "%a %d/%m %R"; format = " $timestamp.datetime(f:'%a %d/%m %R') ";
} }
]; ];
description = '' description = ''
@ -64,17 +60,20 @@ in {
{ {
block = "disk_space"; block = "disk_space";
path = "/"; path = "/";
alias = "/";
info_type = "available"; info_type = "available";
unit = "GB";
interval = 60; interval = 60;
warning = 20.0; warning = 20.0;
alert = 10.0; alert = 10.0;
} }
{ {
block = "sound"; block = "sound";
format = "{output_name} {volume}%"; format = " $icon $output_name {$volume.eng(w:2) |}";
on_click = "pavucontrol --tab=3"; click = [
{
button = "left";
cmd = "pavucontrol --tab=3";
}
];
mappings = { mappings = {
"alsa_output.pci-0000_00_1f.3.analog-stereo" = ""; "alsa_output.pci-0000_00_1f.3.analog-stereo" = "";
"bluez_sink.70_26_05_DA_27_A4.a2dp_sink" = ""; "bluez_sink.70_26_05_DA_27_A4.a2dp_sink" = "";
@ -94,7 +93,7 @@ in {
example = literalExpression '' example = literalExpression ''
{ {
theme = { theme = {
name = "solarized-dark"; theme = "solarized-dark";
overrides = { overrides = {
idle_bg = "#123456"; idle_bg = "#123456";
idle_fg = "#abcdef"; idle_fg = "#abcdef";
@ -109,10 +108,10 @@ in {
default = "none"; default = "none";
description = '' description = ''
The icons set to use. See The icons set to use. See
<link xlink:href="https://github.com/greshake/i3status-rust/blob/master/themes.md"/> <link xlink:href="https://github.com/greshake/i3status-rust/blob/master/doc/themes.md"/>
for a list of available icon sets. for a list of available icon sets.
''; '';
example = "awesome5"; example = "awesome6";
}; };
theme = mkOption { theme = mkOption {
@ -120,7 +119,7 @@ in {
default = "plain"; default = "plain";
description = '' description = ''
The theme to use. See The theme to use. See
<link xlink:href="https://github.com/greshake/i3status-rust/blob/master/themes.md"/> <link xlink:href="https://github.com/greshake/i3status-rust/blob/master/doc/themes.md"/>
for a list of available themes. for a list of available themes.
''; '';
example = "gruvbox-dark"; example = "gruvbox-dark";
@ -134,18 +133,15 @@ in {
{ {
block = "disk_space"; block = "disk_space";
path = "/"; path = "/";
alias = "/";
info_type = "available"; info_type = "available";
unit = "GB";
interval = 60; interval = 60;
warning = 20.0; warning = 20.0;
alert = 10.0; alert = 10.0;
} }
{ {
block = "memory"; block = "memory";
display_type = "memory"; format = " $icon mem_used_percents ";
format_mem = "{mem_used_percents}"; format_alt = " $icon $swap_used_percents ";
format_swap = "{swap_used_percents}";
} }
{ {
block = "cpu"; block = "cpu";
@ -154,13 +150,13 @@ in {
{ {
block = "load"; block = "load";
interval = 1; interval = 1;
format = "{1m}"; format = " $icon $1m ";
} }
{ block = "sound"; } { block = "sound"; }
{ {
block = "time"; block = "time";
interval = 60; interval = 60;
format = "%a %d/%m %R"; format = " $timestamp.datetime(f:'%a %d/%m %R') ";
} }
]; ];
}; };
@ -187,18 +183,15 @@ in {
{ {
block = "disk_space"; block = "disk_space";
path = "/"; path = "/";
alias = "/";
info_type = "available"; info_type = "available";
unit = "GB";
interval = 60; interval = 60;
warning = 20.0; warning = 20.0;
alert = 10.0; alert = 10.0;
} }
{ {
block = "memory"; block = "memory";
display_type = "memory"; format_mem = " $icon $mem_used_percents ";
format_mem = "{mem_used_percents}"; format_swap = " $icon $swap_used_percents ";
format_swap = "{swap_used_percents}";
} }
{ {
block = "cpu"; block = "cpu";
@ -207,18 +200,18 @@ in {
{ {
block = "load"; block = "load";
interval = 1; interval = 1;
format = "{1m}"; format = " $icon $1m ";
} }
{ block = "sound"; } { block = "sound"; }
{ {
block = "time"; block = "time";
interval = 60; interval = 60;
format = "%a %d/%m %R"; format = " $timestamp.datetime(f:'%a %d/%m %R') ";
} }
]; ];
settings = { settings = {
theme = { theme = {
name = "solarized-dark"; theme = "solarized-dark";
overrides = { overrides = {
idle_bg = "#123456"; idle_bg = "#123456";
idle_fg = "#abcdef"; idle_fg = "#abcdef";
@ -248,7 +241,7 @@ in {
home.packages = [ cfg.package ]; home.packages = [ cfg.package ];
xdg.configFile = mapAttrs' (cfgFileSuffix: cfg: xdg.configFile = mapAttrs' (cfgFileSuffix: cfgBar:
nameValuePair ("i3status-rust/config-${cfgFileSuffix}.toml") ({ nameValuePair ("i3status-rust/config-${cfgFileSuffix}.toml") ({
onChange = mkIf config.xsession.windowManager.i3.enable '' onChange = mkIf config.xsession.windowManager.i3.enable ''
i3Socket="''${XDG_RUNTIME_DIR:-/run/user/$UID}/i3/ipc-socket.*" i3Socket="''${XDG_RUNTIME_DIR:-/run/user/$UID}/i3/ipc-socket.*"
@ -258,10 +251,16 @@ in {
''; '';
source = settingsFormat.generate ("config-${cfgFileSuffix}.toml") ({ source = settingsFormat.generate ("config-${cfgFileSuffix}.toml") ({
theme = cfg.theme; theme = if lib.versionAtLeast cfg.package.version "0.30.0" then {
icons = cfg.icons; theme = cfgBar.theme;
block = cfg.blocks; } else
} // cfg.settings); cfgBar.theme;
icons = if lib.versionAtLeast cfg.package.version "0.30.0" then {
icons = cfgBar.icons;
} else
cfgBar.icons;
block = cfgBar.blocks;
} // cfgBar.settings);
})) cfg.bars; })) cfg.bars;
}; };
} }

View file

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

View file

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

View file

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

View file

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