File tree Expand file tree Collapse file tree 1 file changed +68
-25
lines changed Expand file tree Collapse file tree 1 file changed +68
-25
lines changed Original file line number Diff line number Diff line change 1
- { lib , config , ... } :
1
+ { mkTarget , lib , ... } :
2
2
let
3
- opacityHex = lib . toHexString (
4
- builtins . ceil ( config . stylix . opacity . desktop * 255 )
5
- ) ;
3
+ bar =
4
+ { cfg , colors } :
5
+ lib . mapAttrs ( n : v : if lib . hasSuffix "_bg" n then v + cfg . bgOpacity else v ) (
6
+ with colors . withHashtag ;
7
+ {
8
+ idle_bg = base00 ;
9
+ idle_fg = base05 ;
10
+ info_bg = base09 ;
11
+ info_fg = base00 ;
12
+ good_bg = base01 ;
13
+ good_fg = base05 ;
14
+ warning_bg = base0A ;
15
+ warning_fg = base00 ;
16
+ critical_bg = base08 ;
17
+ critical_fg = base00 ;
18
+ separator_bg = base00 ;
19
+ separator_fg = base05 ;
20
+ }
21
+ ) ;
6
22
in
7
- {
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 ;
13
- {
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
- ) ;
23
+ mkTarget {
24
+ name = "i3status-rust" ;
25
+ humanName = "i3status-rust" ;
26
+
27
+ extraOptions = {
28
+ barNames = lib . mkOption {
29
+ type = with lib . types ; listOf str ;
30
+ default = [ ] ;
31
+ description = "i3status-rust bars to apply theming to." ;
32
+ example = [ "default" ] ;
33
+ } ;
34
+ bgOpacity = lib . mkOption {
35
+ type = lib . types . float ;
36
+ default = 1.0 ;
37
+ internal = true ;
38
+ apply = v : lib . toHexString ( builtins . ceil ( v * 255 ) ) ;
39
+ } ;
40
+ } ;
41
+
42
+ imports = lib . singleton (
43
+ { config , ... } :
44
+ {
45
+ lib . stylix . i3status-rust . bar =
46
+ lib . warn
47
+ "stylix: `config.lib.stylix.i3status-rust.bar` has been replace with `config.stylix.targets.i3status-rust.barNames` and will be removed after 26.11."
48
+ ( bar {
49
+ cfg = config . stylix . targets . i3status-rust ;
50
+ inherit ( config . lib . stylix ) colors ;
51
+ } ) ;
52
+ }
53
+ ) ;
54
+
55
+ configElements = [
56
+ (
57
+ { opacity } :
58
+ {
59
+ stylix . targets . i3status-rust . bgOpacity = opacity . desktop ;
60
+ }
61
+ )
62
+ (
63
+ { cfg , colors } :
64
+ {
65
+ programs . i3status-rust . bars = lib . genAttrs cfg . barNames (
66
+ _ : bar { inherit cfg colors ; }
67
+ ) ;
68
+ }
69
+ )
70
+ ] ;
28
71
}
You can’t perform that action at this time.
0 commit comments