nixos-config/user/waybar/default.nix

248 lines
7.1 KiB
Nix
Raw Normal View History

{
config,
osConfig,
pkgs,
lib,
font,
...
}:
let
2024-06-05 01:18:48 -03:00
inherit (config.my)
key
theme
accent
font
;
inherit (theme) color;
in
{
2022-08-04 23:46:59 -03:00
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 = "";
2022-08-04 23:46:59 -03:00
};
"sway/workspaces" = {
enable-bar-scroll = true;
format = "{icon}";
format-icons = {
"1" = "";
"2" = "";
"3" = "󰅩";
"4" = "";
"5" = "";
"6" = "";
"7" = "󰇮";
"8" = "";
"9" = "";
"10" = "";
urgent = "";
# focused = "";
default = "";
2023-08-13 15:09:49 -03:00
};
};
"sway/window" = {
max-length = 40;
};
"tray" = {
"spacing" = 7;
"icon-size" = 19;
};
clock = {
interval = 60;
2024-07-15 12:03:13 -03:00
format = "<b>{:L%H:%M %a %d/%m}</b>";
tooltip-format = "<tt><small>{calendar}</small></tt>";
calendar = {
mode = "year";
mode-mon-col = 3;
weeks-pos = "right";
on-scroll = 1;
on-click-right = "mode";
format = {
months = "<span color='${color.normal.magenta}'><b>{}</b></span>";
days = "<span color='${color.txt}'><b>{}</b></span>";
weeks = "<span color='${color.normal.cyan}'><b>W{}</b></span>";
weekdays = "<span color='${color.normal.yellow}'><b>{}</b></span>";
today = "<span color='${accent.color}'><b><u>{}</u></b></span>";
};
};
actions = {
on-click-right = "mode";
on-click-forward = "tz_up";
on-click-backward = "tz_down";
on-scroll-up = "shift_up";
on-scroll-down = "shift_down";
};
2023-08-13 15:09:49 -03:00
};
mpd =
let
mpc = "${pkgs.mpc-cli}/bin/mpc";
in
{
format = "{stateIcon} {title} - {artist}";
format-paused = "{stateIcon}";
2024-06-03 20:46:23 -03:00
format-stopped = "{stateIcon}";
state-icons = {
stopped = "";
paused = "";
playing = "";
};
tooltip = false;
on-click = "${mpc} toggle";
on-scroll-up = "${mpc} vol +10";
on-scroll-down = "${mpc} vol -10";
2023-01-22 18:12:04 -03:00
};
"custom/playerctl" = {
format = "{} ";
exec = "${pkgs.playerctl-status}/bin/playerctl-status";
on-click = "${pkgs.playerctl}/bin/playerctl --ignore-player=mpd play-pause";
interval = 1;
2023-01-22 18:12:04 -03:00
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 = ''
${pkgs.mullvad}/bin/mullvad status | ${pkgs.gnugrep}/bin/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 = {
"rtp-sink" = [
"󰕿"
"󰖀"
"󰕾"
];
"alsa_output.usb-C-Media_Electronics_Inc._USB_Audio_Device-00.analog-stereo" = [
" 󰕿"
" 󰖀"
" 󰕾"
];
"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";
on-scroll-up = "${pkgs.volumesh}/bin/volumesh -i 10";
on-scroll-down = "${pkgs.volumesh}/bin/volumesh -d 10";
2022-08-04 23:46:59 -03:00
};
}
];
style = builtins.readFile (
pkgs.substituteAll {
src = ./style.css;
2023-05-04 23:57:36 -03:00
accent_color = accent.color;
2023-05-04 23:57:36 -03:00
color_bg = color.bg;
color_bg_dark = color.bg_dark;
color_bg_light = color.bg_light;
color_txt = color.txt;
2023-05-04 23:57:36 -03:00
font_interface = font.interface;
2023-05-04 23:57:36 -03:00
font_size_big = "${toString font.size.big}px";
font_size_medium = "${toString font.size.medium}px";
}
);
2022-08-04 23:46:59 -03:00
};
2022-08-30 22:01:06 -03:00
home.packages = with pkgs; [ waybar ];
2022-08-04 23:46:59 -03:00
};
}