dotfiles/user-modules/desktop/bar/waybar.nix

163 lines
4.1 KiB
Nix
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
lib,
config,
pkgs,
...
}:
with lib;
let
cfg = config.modules.waybar;
theme = config.theming;
colors = theme.colors;
in
{
options.modules.waybar = {
enable = mkEnableOption "waybar";
};
config = mkIf cfg.enable {
home.packages = with pkgs; [
pulsemixer
playerctl
wpa_supplicant_gui # TODO: Move
];
modules.desktop.reloadScript = ''
# if ${pkgs.procps}/bin/pgrep waybar; then
# ${pkgs.procps}/bin/pkill waybar
# fi
${pkgs.waybar}/bin/waybar &
'';
programs.waybar = {
enable = true;
settings = {
mainBar = {
layer = "top";
spacing = 16;
modules-left = [ "river/tags" ];
modules-center = [
#"river/window"
"mpris"
];
modules-right = [
"bluetooth"
"network"
"pulseaudio"
"battery"
"clock"
];
"river/window" = {
max-length = 50;
};
"river/tags" = {
tag-labels = [
""
""
""
""
""
""
""
""
""
];
disable-click = false;
};
network = {
tooltip = false;
on-click = "wpa_gui";
format-wifi = " {essid}"; # Spacing achieved using "Thin Space"
format-ethernet = "TODO";
format-disconnected = "";
};
pulseaudio = {
tooltip = false;
format = "{icon}{volume}%"; # Spacing achieved using "Thin Space"
#format-muted = "";
format-muted = "{icon}--%"; # Spacing achieved using "Thin Space"
format-icons = {
#headphone = "";
#default = [ "" "" ];
headphone = "";
headphone-muted = "";
default = [
""
""
""
];
};
};
battery = {
format = "{icon}{capacity}%"; # Spacing achieved using "Thin Space"
format-charging = "{capacity}%"; # Spacing achieved using "Thin Space"
#format-icons = [ "󰂎" "󰁺" "󰁻" "󰁼" "󰁽" "󰁾" "󰁿" "󰂀" "󰂁" "󰂂" "󰁹" ];
format-icons = [
""
""
""
""
""
""
""
""
""
""
""
];
interval = 1;
};
clock = {
#format = "󰅐 {:%H:%M}";
#format = "   {:%H:%M}"; # Spacing achieved using "Thin Space"
format = "{:%H:%M}";
};
mpris = {
format = "{dynamic}";
tooltip-format = "";
interval = 1;
};
bluetooth = {
tooltip = false;
format = "{status}"; # Spacing achieved using "Thin Space"
format-connected = "{device_alias}"; # Spacing achieved using "Thin Space"
};
};
};
# TODO: Replace base03 color with named color
style = ''
window#waybar {
color: #${colors.fg};
background-color: #${colors.bg};
border-style: none none solid none;
border-width: ${toString theme.layout.borderSize}px;
border-color: #${colors.border-unfocused};
font-size: 12px;
font-family: "${theme.fonts.monospace.name}";
}
.modules-right {
margin: 0 8px 0 0;
}
#tags button {
color: #${theme.schemeColors.base03};
padding: 0 5px 1px 5px;
border-radius: 0;
font-size: 16px;
font-family: "wenquanyi bitmap song";
}
#tags button.occupied {
color: #${colors.fg};
}
#tags button.focused {
color: #${colors.accent};
}
'';
};
};
}