167 lines
4.9 KiB
Nix
167 lines
4.9 KiB
Nix
{ config, osConfig, pkgs, lib, font, ... }:
|
|
let
|
|
inherit (pkgs.uservars) key theme accent font;
|
|
inherit (theme) color;
|
|
in
|
|
{
|
|
config = {
|
|
programs.waybar = {
|
|
enable = true;
|
|
systemd.enable = true;
|
|
systemd.target = "sway-session.target";
|
|
settings = [{
|
|
layer = "top";
|
|
modules-left = [ "sway/workspaces" "sway/mode" "sway/window" ];
|
|
modules-center = [ "clock" ];
|
|
modules-right = lib.flatten [
|
|
"sway/language"
|
|
"mpd"
|
|
"custom/playerctl"
|
|
# "tray"
|
|
"custom/caffeine"
|
|
"pulseaudio"
|
|
(lib.optional (osConfig.services.vpn.enable or false) "custom/vpn")
|
|
"network"
|
|
"battery"
|
|
];
|
|
battery = {
|
|
tooltip = true;
|
|
states = {
|
|
full = 100;
|
|
good = 95;
|
|
warning = 25;
|
|
};
|
|
format = "{icon} ";
|
|
format-charging = "";
|
|
format-plugged = "";
|
|
format-full = "";
|
|
format-warning = "{icon} {time}";
|
|
format-icons = [ "" "" "" "" "" "" ];
|
|
};
|
|
network = {
|
|
interval = 5;
|
|
tooltip = false;
|
|
on-click = "terminal -e iwd";
|
|
format-wifi = "{icon}";
|
|
format-icons = [ "" "" "" "" "" ];
|
|
format-ethernet = "";
|
|
format-linked = "";
|
|
format-disconnected = "";
|
|
};
|
|
"sway/workspaces" = {
|
|
enable-bar-scroll = true;
|
|
format = "{icon}";
|
|
format-icons = {
|
|
"1" = "";
|
|
"2" = "";
|
|
"3" = "";
|
|
"4" = "";
|
|
"5" = "";
|
|
"6" = "";
|
|
"7" = "";
|
|
"8" = "";
|
|
"9" = "";
|
|
"10" = "";
|
|
urgent = "";
|
|
focused = "";
|
|
default = "";
|
|
};
|
|
};
|
|
"sway/window" = { max-length = 40; };
|
|
"tray" = {
|
|
"spacing" = 7;
|
|
"icon-size" = 19;
|
|
};
|
|
clock = {
|
|
interval = 60;
|
|
format = "<b>{:%H:%M %a %d/%m}</b>";
|
|
tooltip = false;
|
|
};
|
|
mpd =
|
|
let
|
|
mpc = "${pkgs.mpc-cli}/bin/mpc";
|
|
in
|
|
{
|
|
format = "{stateIcon} {title} - {artist}";
|
|
format-paused = "{stateIcon}";
|
|
format-stopped = "";
|
|
state-icons = {
|
|
stopped = "";
|
|
paused = "";
|
|
playing = "";
|
|
};
|
|
tooltip = false;
|
|
on-click = "${mpc} toggle";
|
|
on-scroll-up = "${mpc} vol +10";
|
|
on-scroll-down = "${mpc} vol -10";
|
|
};
|
|
"custom/playerctl" = {
|
|
format = "{} ";
|
|
exec = "${pkgs.playerctl-status}/bin/playerctl-status";
|
|
on-click = "${pkgs.playerctl}/bin/playerctl --ignore-player=mpd play-pause";
|
|
interval = 1;
|
|
tooltip = false;
|
|
};
|
|
"sway/language" = { format = "{short} {variant}"; };
|
|
"custom/caffeine" = {
|
|
format = "{}";
|
|
exec = "systemctl --user status swayidle > /dev/null && echo || echo ";
|
|
on-click = "${pkgs._sway_idle_toggle}/bin/_sway_idle_toggle";
|
|
interval = 1;
|
|
tooltip = false;
|
|
};
|
|
"custom/vpn" = lib.mkIf (osConfig.services.vpn.enable or false) {
|
|
format = "{}";
|
|
exec = ''
|
|
mullvad status | grep "^Connected" > /dev/null \
|
|
&& echo "" \
|
|
|| echo ""
|
|
'';
|
|
on-click = "mullvad connect";
|
|
on-click-right = "mullvad disconnect";
|
|
interval = 1;
|
|
tooltip = false;
|
|
};
|
|
pulseaudio = {
|
|
interval = 5;
|
|
tooltip = false;
|
|
scroll-step = 10;
|
|
format = "{icon}";
|
|
format-bluetooth = "";
|
|
format-bluetooth-muted = "";
|
|
format-muted = "";
|
|
format-icons = {
|
|
"alsa_output.pci-0000_09_00.4.analog-stereo" =
|
|
[ " " " " " " ];
|
|
headphone = [ " " " " " " ];
|
|
handsfree = "";
|
|
headset = "";
|
|
phone = "";
|
|
portable = "";
|
|
car = "";
|
|
default = [ "" "" "" ];
|
|
};
|
|
on-click = "pavucontrol";
|
|
on-click-right = "${pkgs.pulse_sink}/bin/pulse_sink";
|
|
};
|
|
}];
|
|
style = builtins.readFile (pkgs.substituteAll {
|
|
src = ./style.css;
|
|
|
|
accent_color = accent.color;
|
|
|
|
color_bg = color.bg;
|
|
color_bg_dark = color.bg_dark;
|
|
color_bg_light = color.bg_light;
|
|
color_txt = color.txt;
|
|
|
|
font_interface = font.interface;
|
|
|
|
font_size_big = "${toString font.size.big}px";
|
|
font_size_medium = "${toString font.size.medium}px";
|
|
});
|
|
};
|
|
home.packages = with pkgs; [ waybar ];
|
|
};
|
|
}
|