nix/module/desktop/waybar/config/default.nix

134 lines
3.5 KiB
Nix
Raw Normal View History

2024-06-23 00:14:13 +03:00
{ setting, style, pkgs, ... }: let
refreshInterval = 2;
2024-05-08 21:12:48 +03:00
in {
2024-06-23 00:14:13 +03:00
file = (pkgs.formats.json {}).generate "WaybarConfig" {
2024-06-23 04:07:51 +03:00
height = 2 * (style.window.gap + style.window.border);
2024-06-23 00:14:13 +03:00
layer = "top";
margin-left = style.window.gap;
margin-right = style.window.gap;
margin-top = style.window.gap;
mode = "dock";
position = "top";
spacing = 4;
start_hidden = false;
modules-left = [
"sway/workspaces"
"sway/scratchpad"
];
modules-center = [
"clock"
"mpris"
];
modules-right = [
"sway/language"
"pulseaudio"
"battery"
"custom/powerlimit"
"cpu"
# "temperature"
"memory"
"custom/powersave"
"custom/display"
"tray"
];
"sway/language" = {
tooltip = false;
on-click = "swaymsg 'input * xkb_switch_layout next'";
};
"sway/scratchpad" = {
format = "{icon} {count}";
show-empty = false;
format-icons = [ "" "" ];
tooltip = true;
tooltip-format = "{app}: {title}";
on-click = "swaymsg 'scratchpad show'";
on-click-right = "swayscript scratchpad_kill";
};
tray = {
# icon-size = 21;
spacing = 1;
};
clock = {
# timezone = "America/New_York";
tooltip-format = "<big><tt>{calendar}</tt></big>";
format-alt = "{:%d %a %H:%M}";
};
battery = {
states = {
good = 60;
warning = 40;
critical = 2;
};
format = "{capacity}% {icon}";
format-charging = "{capacity}% ";
format-plugged = "{capacity}% ";
format-alt = "{time} {icon}";
format-icons = ["󰂎" "󱊡" "󱊢" "󱊣" "󱊣"];
on-click-right = "powerlimit toggle";
interval = refreshInterval;
};
"custom/powerlimit" = {
exec = "powerlimit waybar";
interval = refreshInterval;
on-click-right = "powerlimit toggle";
};
pulseaudio = {
scroll-step = setting.volume.step;
format = "{volume}% {icon}";
format-muted = "󰸈";
format-icons = {
default = [ "" "" "" ];
};
on-click-right = "pactl set-sink-mute @DEFAULT_SINK@ toggle";
on-click-middle = "swayscript sound_output_cycle";
on-click = "pavucontrol";
};
mpris = {
format = "{player_icon} {title} - {artist}";
format-paused = "{status_icon} {title} - {artist}";
player-icons = {
"default" = "";
"firefox" = "󰈹";
"mpv" = "";
};
status-icons = {
"paused" = "";
};
on-click-middle = "playerctl stop";
# ignored-players = [ "firefox" ];
};
cpu = {
format = "{usage}% ({load})";
interval = refreshInterval;
on-click = "foot -e bash -c btop";
on-click-right = "powersave toggle";
tooltip = false;
};
memory = {
format = "{percentage}%";
interval = refreshInterval;
on-click = "foot -e bash -c btop";
on-click-right = "powersave toggle";
};
temperature = {
format = "{temperatureC}°C";
interval = refreshInterval;
on-click = "foot -e bash -c btop";
on-click-right = "powersave toggle";
};
"custom/powersave" = {
exec = "powersave waybar";
interval = refreshInterval;
on-click = "foot -e bash -c btop";
on-click-right = "powersave toggle";
};
"custom/display" = {
exec = "swayscript monbar";
interval = refreshInterval;
on-click = "sleep 0.1 && swayscript montoggle"; # FIXME: remove sleep when resolved: https://github.com/Alexays/Waybar/issues/216
on-click-right = "sleep 0.1 && swayscript vrrtoggle";
return-type = "json";
};
};
2024-05-02 04:47:21 +03:00
}