From da84546561c669bc737dd0a81d108cd3b9cf036b Mon Sep 17 00:00:00 2001 From: Daniel Patterson Date: Wed, 29 Jun 2022 03:12:25 +0100 Subject: [PATCH] Fix i3status-rust not working everywhere --- .../configs/desktop/i3status-rust/default.nix | 90 +++++++++++-------- 1 file changed, 53 insertions(+), 37 deletions(-) diff --git a/users/daniel/configs/desktop/i3status-rust/default.nix b/users/daniel/configs/desktop/i3status-rust/default.nix index 61fa53c..10f0113 100644 --- a/users/daniel/configs/desktop/i3status-rust/default.nix +++ b/users/daniel/configs/desktop/i3status-rust/default.nix @@ -1,50 +1,66 @@ { config, pkgs, + lib, + hostname, ... -}: { +}: let + filterBacklight = list: + builtins.filter (item: + !(builtins.elem item.block ( + if hostname == "dingbox" + then ["backlight" "battery"] + else [] + ))) + list; +in { programs.i3status-rust = { enable = true; bars = { main = { theme = "dracula"; icons = "awesome"; - blocks = [ - { - block = "time"; - } - { - block = "battery"; - allow_missing = true; - hide_missing = true; - } - { - block = "backlight"; - device = "intel_backlight"; - step_width = 10; - invert_icons = true; - } - { - block = "networkmanager"; - primary_only = true; - ap_format = "{ssid}"; - device_format = "{icon}{ap}"; - } - { - block = "keyboard_layout"; - } - { - block = "notify"; - } - { - block = "music"; - player = "spotifyd"; - buttons = ["prev" "play" "next"]; - } - { - block = "sound"; - } - ]; + blocks = + [ + { + block = "time"; + } + ] + ++ lib.optionals (hostname == "pingbox") [ + { + block = "battery"; + allow_missing = true; + hide_missing = true; + } + { + block = "backlight"; + device = "intel_backlight"; + step_width = 10; + invert_icons = true; + } + ] + ++ [ + { + block = "networkmanager"; + primary_only = true; + ap_format = "{ssid}"; + device_format = "{icon}{ap}"; + } + { + block = "keyboard_layout"; + } + { + block = "notify"; + } + { + block = "music"; + player = "spotifyd"; + buttons = ["prev" "play" "next"]; + } + { + block = "sound"; + } + ]; }; }; };