57 lines
1.3 KiB
Nix
57 lines
1.3 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
let
|
|
cfg = config.samfelag.modules.desktop.polybar;
|
|
polybar_pkg = pkgs.polybar.override {
|
|
i3Support = true;
|
|
pulseSupport = true;
|
|
};
|
|
script = ''
|
|
polybar top &
|
|
polybar bottom &
|
|
'';
|
|
# Paths
|
|
paths = {
|
|
config = ../../config/.config/polybar/config.ini;
|
|
bars = ../../config/.config/polybar/bars;
|
|
scripts = ../../config/.config/polybar/scripts;
|
|
};
|
|
in {
|
|
|
|
options.samfelag.modules.desktop.polybar = {
|
|
enable = lib.mkEnableOption "polybar";
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
|
|
# - Configuration ----------------------------
|
|
|
|
environment.systemPackages = [
|
|
polybar_pkg
|
|
];
|
|
|
|
hm.xdg.configFile."polybar/config.ini".source = paths.config;
|
|
hm.xdg.configFile."polybar/bars".source = paths.bars;
|
|
hm.xdg.configFile."polybar/scripts".source = paths.scripts;
|
|
|
|
hm.systemd.user.services.polybar = {
|
|
Unit = {
|
|
Description = "Polybar status bar";
|
|
PartOf = [ "tray.target" ];
|
|
X-Restart-Triggers = [ "${paths.config}" ];
|
|
};
|
|
|
|
Service = {
|
|
Type = "forking";
|
|
PassEnvironment = "PATH";
|
|
ExecStart =
|
|
let scriptPkg = pkgs.writeShellScriptBin "polybar-start" script;
|
|
in "${scriptPkg}/bin/polybar-start";
|
|
Restart = "on-failure";
|
|
};
|
|
|
|
Install = { WantedBy = [ "tray.target" ]; };
|
|
};
|
|
};
|
|
}
|