nixos-config/modules/workspace/i3blocks/default.nix

68 lines
2.2 KiB
Nix
Raw Normal View History

2020-02-17 17:00:59 +04:00
{ pkgs, config, lib, ... }:
with import ../../../support.nix { inherit pkgs config lib; };
with lib;
let scripts = import ./scripts pkgs config;
in {
2020-08-06 12:31:36 +04:00
home-manager.users.balsoft = {
wayland.windowManager.sway.config.bars = [{
id = "default";
command = "true";
colors = let
thm = config.themes.colors;
default = {
background = thm.bg;
border = thm.bg;
};
in {
2020-06-13 00:12:36 +04:00
background = thm.bg;
2020-08-06 12:31:36 +04:00
statusline = thm.fg;
separator = thm.alt;
focusedWorkspace = default // { text = thm.red; };
activeWorkspace = default // { text = thm.green; };
inactiveWorkspace = default // { text = thm.fg; };
urgentWorkspace = default // { text = thm.orange; };
bindingMode = default // { text = thm.yellow; };
2020-06-13 00:12:36 +04:00
};
2020-08-06 12:31:36 +04:00
statusCommand = "${pkgs.i3blocks}/bin/i3blocks";
fonts = [ "IBM Plex Mono 11" "Material Icons 11" "Roboto Mono 11" ];
mode = "hide";
position = "bottom";
2020-06-13 00:12:36 +04:00
workspaceNumbers = false;
2020-08-06 12:31:36 +04:00
}];
xdg.configFile."i3blocks/config".text = let
scr = x: {
name = x;
command = scripts.${x};
};
scrint = x: interval: (scr x) // { inherit interval; };
in ''
interval=60
markup=pango
'' + genIniOrdered (optional (!isNull config.secrets.mail) (scr "email")
2020-07-27 01:16:19 +04:00
++ [ (scrint "weather" 600) (scr "calendar") (scr "emacs") (scr "nixos") ]
2020-04-29 03:18:36 +04:00
++ optional (!isNull config.secrets.wage) (scrint "youtrack-wage" 3600)
2020-07-27 01:16:19 +04:00
++ [ (scrint "music" 3) (scrint "sound" 1) ] ++ [
2020-04-29 03:18:36 +04:00
(scrint "cpu" 5)
(scrint "freq" 10)
(scr "temperature")
(scrint "free" 10)
] ++ optionals config.deviceSpecific.isLaptop [
(scr "battery")
(scrint "brightness" 5)
]
++ optional (config.deviceSpecific.devInfo ? bigScreen) (scrint "network" 1)
2020-07-27 01:16:19 +04:00
++ [ (scrint "bluetooth" 3) (scrint "connections" 3) (scr "df") (scr "date") (scrint "time" 1) ]);
2020-08-06 12:31:36 +04:00
systemd.user.services.swaybar = {
Unit = {
Description = "Start default bar";
};
Install.WantedBy = [ "sway-session.target" ];
Service = {
ExecStart = "${pkgs.sway}/bin/swaybar -b default";
};
};
};
2020-02-17 17:00:59 +04:00
}