diff --git a/hosts/laptop/default.nix b/hosts/laptop/default.nix index 234db94..221d7a3 100644 --- a/hosts/laptop/default.nix +++ b/hosts/laptop/default.nix @@ -51,12 +51,16 @@ documentation.enable = true; theme.enable = true; printing.enable = true; - i3.enable = true; xserver = { enable = true; libinput = true; }; + + i3 = { + enable = true; + battery = true; + }; gaming = { enable = true; diff --git a/modules/stuff/i3.nix b/modules/stuff/i3.nix index 3af26da..fa2b430 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; + inherit (lib) mkIf mkEnableOption mkOption types optionals mergeAttrs optionalAttrs; cfg = config.chuj.stuff.i3; user = config.chuj.system.user; in { @@ -24,6 +24,7 @@ in { }; default = {}; }; + battery = mkEnableOption "battery"; }; config = let @@ -205,7 +206,7 @@ in { output_format = "i3bar"; }; - modules = { + modules = mergeAttrs { # todo MPD module (using read_file most likely, or switch to i3blocks) "cpu_usage" = { @@ -234,12 +235,24 @@ in { }; "tztime local" = { - position = 3; + position = 4; settings = { format = "%Y-%m-%d %H:%M:%S (%A)"; }; }; - }; + } (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; [