Skip to content

Commit 5c5b45d

Browse files
committed
i3status-rust: use mkTarget
1 parent 683d626 commit 5c5b45d

File tree

1 file changed

+54
-25
lines changed

1 file changed

+54
-25
lines changed

modules/i3status-rust/hm.nix

Lines changed: 54 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,57 @@
1-
{ lib, config, ... }:
2-
let
3-
opacityHex = lib.toHexString (
4-
builtins.ceil (config.stylix.opacity.desktop * 255)
5-
);
6-
in
71
{
8-
# Merge this with your bar's theme's overrides with //config.lib.stylix.i3status-rust.bar
9-
config.lib.stylix.i3status-rust.bar =
10-
lib.mapAttrs (n: v: if lib.hasSuffix "_bg" n then v + opacityHex else v)
11-
(
12-
with config.lib.stylix.colors.withHashtag;
2+
mkTarget,
3+
lib,
4+
...
5+
}:
6+
mkTarget {
7+
name = "i3status-rust";
8+
humanName = "i3status-rust";
9+
10+
extraOptions.exportedBarConfig = lib.mkOption {
11+
type = lib.types.attrs;
12+
default = { };
13+
description = ''
14+
Theming configuration which can be merged with your own:
15+
16+
```nix
17+
programs.i3status-rust.bars.default =
1318
{
14-
idle_bg = base00;
15-
idle_fg = base05;
16-
info_bg = base09;
17-
info_fg = base00;
18-
good_bg = base01;
19-
good_fg = base05;
20-
warning_bg = base0A;
21-
warning_fg = base00;
22-
critical_bg = base08;
23-
critical_fg = base00;
24-
separator_bg = base00;
25-
separator_fg = base05;
26-
}
27-
);
19+
# your configuration
20+
} // config.stylix.targets.i3status-rust.exportedBarConfig;
21+
```
22+
'';
23+
};
24+
25+
imports = lib.singleton (
26+
{ config, ... }:
27+
{
28+
lib.stylix.i3status-rust.bar = lib.warn "stylix: `config.lib.stylix.i3status-rust.bar` has been renamed to `config.stylix.targets.i3status-rust.exportedBarConfig` and will be removed after 26.11." config.stylix.targets.i3status-rust.exportedBarConfig;
29+
}
30+
);
31+
32+
configElements =
33+
{ colors, opacity }:
34+
{
35+
stylix.targets.i3status-rust.exportedBarConfig =
36+
let
37+
opacityHex = lib.toHexString (builtins.ceil (opacity.desktop * 255));
38+
in
39+
lib.mapAttrs (n: v: if lib.hasSuffix "_bg" n then v + opacityHex else v) (
40+
with colors.withHashtag;
41+
{
42+
idle_bg = base00;
43+
idle_fg = base05;
44+
info_bg = base09;
45+
info_fg = base00;
46+
good_bg = base01;
47+
good_fg = base05;
48+
warning_bg = base0A;
49+
warning_fg = base00;
50+
critical_bg = base08;
51+
critical_fg = base00;
52+
separator_bg = base00;
53+
separator_fg = base05;
54+
}
55+
);
56+
};
2857
}

0 commit comments

Comments
 (0)