89 lines
2.7 KiB
Nix
89 lines
2.7 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
let
|
|
cfg = config.samfelag.modules.desktop.polybar;
|
|
i3Cfg = config.samfelag.modules.desktop.i3;
|
|
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;
|
|
|
|
# - Themeing ---------------------------------
|
|
hm.xdg.configFile."polybar/colour-scheme.ini".text = ''
|
|
[colour-scheme]
|
|
base00 = #${config.colorScheme.colors.base00}
|
|
base01 = #${config.colorScheme.colors.base01}
|
|
base02 = #${config.colorScheme.colors.base02}
|
|
base03 = #${config.colorScheme.colors.base03}
|
|
base04 = #${config.colorScheme.colors.base04}
|
|
base05 = #${config.colorScheme.colors.base05}
|
|
base06 = #${config.colorScheme.colors.base06}
|
|
base07 = #${config.colorScheme.colors.base07}
|
|
base08 = #${config.colorScheme.colors.base08}
|
|
base09 = #${config.colorScheme.colors.base09}
|
|
base0A = #${config.colorScheme.colors.base0A}
|
|
base0B = #${config.colorScheme.colors.base0B}
|
|
base0C = #${config.colorScheme.colors.base0C}
|
|
base0D = #${config.colorScheme.colors.base0D}
|
|
base0E = #${config.colorScheme.colors.base0E}
|
|
base0F = #${config.colorScheme.colors.base0F}
|
|
'';
|
|
|
|
# - Dependencies -----------------------------
|
|
|
|
# The polybar modules use rofi
|
|
samfelag.modules.desktop.rofi.enable = true;
|
|
samfelag.modules.desktop.i3.extraKeybindings = lib.mkIf i3Cfg.enable {
|
|
"${i3Cfg.mod}+Shift+w" = "exec $HOME/.config/rofi/menus/wifi/wifi.sh";
|
|
};
|
|
|
|
# - Services ---------------------------------
|
|
|
|
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" ]; };
|
|
};
|
|
};
|
|
}
|