{ pkgs, lib, config, ... }:

rec {
  programs.i3blocks = {
    enable = true;
    bars = {
      top = {
        # The title block
        title = {
          interval = "persist";
          command = "ls";
        };
      };
      bottom = {
        time = {
          command = "date +%r";
          interval = 1;
        };
        # Make sure this block comes after the time block
        date = lib.hm.dag.entryAfter [ "time" ] {
          command = "date +%d";
          interval = 5;
        };
        # And this block after the example block
        example = lib.hm.dag.entryAfter [ "date" ] {
          command = "echo hi $(date +%s)";
          interval = 3;
        };
      };
    };
  };

  wayland.windowManager.sway.config.bars = [
    {
      statusCommand = "${pkgs.lib.getExe config.programs.i3blocks.package}"; # -c ${config.xdg.}";
      position = "top";
      fonts = config.wayland.windowManager.sway.config.fonts;
    }
    {
      statusCommand = "${pkgs.lib.getExe config.programs.i3blocks.package} -c bottom";
      position = "bottom";
      fonts = config.wayland.windowManager.sway.config.fonts;
    }
  ];
}
