diff --git a/hosts/laptop/default.nix b/hosts/laptop/default.nix index 5dbc7e5..da6ea0f 100644 --- a/hosts/laptop/default.nix +++ b/hosts/laptop/default.nix @@ -37,6 +37,7 @@ }; home-manager.enable = true; + xdg.enable = true; stuff = { sddm.enable = true; @@ -51,7 +52,7 @@ documentation.enable = true; theme.enable = true; printing.enable = true; - xdg.enable = true; + mpd.enable = true; xserver = { enable = true; diff --git a/modules/stuff/i3.nix b/modules/stuff/i3.nix index c4a3653..7185d12 100644 --- a/modules/stuff/i3.nix +++ b/modules/stuff/i3.nix @@ -1,5 +1,5 @@ { lib, pkgs, config, ...}: let - inherit (lib) mkIf mkEnableOption mkOption types optionals mergeAttrs optionalAttrs; + inherit (lib) mkIf mkEnableOption mkOption types optionals mergeAttrs mergeAttrsList optionalAttrs; cfg = config.chuj.stuff.i3; user = config.chuj.system.user; in { @@ -215,62 +215,65 @@ in { output_format = "i3bar"; }; - modules = mergeAttrs { - # todo MPD module (using read_file most likely, or switch to i3blocks) + modules = mergeAttrsList [ + { + "cpu_usage" = { + position = 0; + settings = { + format = "cpu: %usage"; + }; + }; - "read_file mpd" = { - position = -1; - settings = { - format = "%content"; - path = "/tmp/i3-mpd-status-stuff"; - color_good = "#ffffff"; + "memory" = { + position = 1; + settings = { + format = "mem: %used"; + threshold_degraded = "1G"; + format_degraded = "MEMORY < %available"; + }; }; - }; - "cpu_usage" = { - position = 0; - settings = { - format = "cpu: %usage"; + "volume master" = { + position = 2; + settings = { + color_degraded = "#333333"; + format = "vol: %volume"; + format_muted = "vol: ---"; + }; }; - }; - "memory" = { - position = 1; - settings = { - format = "mem: %used"; - threshold_degraded = "1G"; - format_degraded = "MEMORY < %available"; + "tztime local" = { + position = 4; + settings = { + format = "%Y-%m-%d %H:%M:%S (%A)"; + }; }; - }; - - "volume master" = { - position = 2; - settings = { - color_degraded = "#333333"; - format = "vol: %volume"; - format_muted = "vol: ---"; + } + (optionalAttrs cfg.battery { + "battery 0" = { + position = 3; + settings = { + format = "bat%status: %percentage"; + status_chr = "(+)"; + status_bat = ""; + status_unk = "(?)"; + status_full = "(+)"; + low_threshold = 30; + }; }; - }; - - "tztime local" = { - position = 4; - settings = { - format = "%Y-%m-%d %H:%M:%S (%A)"; + }) + (optionalAttrs config.chuj.stuff.mpd.enable { + "read_file mpd" = { + position = -1; + settings = { + format = "%content"; + format_bad = "mpdstatus file not found, restart i3"; + path = "/tmp/i3-mpd-status-stuff"; + color_good = "#ffffff"; + }; }; - }; - } (optionalAttrs cfg.battery { - "battery 0" = { - position = 3; - settings = { - format = "bat%status: %percentage"; - status_chr = "(+)"; - status_bat = ""; - status_unk = "(?)"; - status_full = "(+)"; - low_threshold = 30; - }; - }; - }); + }) + ]; }; home.packages = with pkgs; [