nix/home/file/waybar/config/default.nix

207 lines
5.3 KiB
Nix
Raw Normal View History

{
2024-11-04 04:37:29 +03:00
config,
pkgs,
...
}: let
refreshInterval = 2;
in {
file = (pkgs.formats.json { }).generate "WaybarConfig" {
height = 34;
layer = "top";
margin-left = config.module.style.window.gap;
margin-right = config.module.style.window.gap;
margin-top = config.module.style.window.gap;
mode = "dock";
position = "top";
spacing = 4;
start_hidden = false;
output = [
2024-11-18 02:24:48 +03:00
config.module.display.primary
2024-11-04 04:37:29 +03:00
];
modules-left = [
"clock"
"sway/scratchpad"
"mpris"
];
modules-center = [
"sway/workspaces"
];
modules-right = [
"group/hardware"
2024-12-13 08:26:20 +03:00
"group/batteryinfo"
"pulseaudio"
2024-11-04 04:37:29 +03:00
"custom/display"
"custom/network"
2024-11-04 04:37:29 +03:00
];
"sway/workspaces" = {
all-outputs = true;
};
"sway/scratchpad" = {
format = "{icon} {count}";
on-click = "swaymsg 'scratchpad show'";
on-click-middle = "swayscript scratchpad_kill";
show-empty = false;
tooltip = true;
tooltip-format = "{app}: {title}";
format-icons = [
""
""
];
};
clock = {
2024-11-19 06:38:10 +03:00
format-alt = "{:%H:%M %a %d %b}";
2024-11-04 04:37:29 +03:00
on-click-right = "xdg-open https://cloud.voronind.com/apps/calendar/";
tooltip-format = "<big><tt>{calendar}</tt></big>";
};
battery = {
format = "{capacity}% {icon}";
format-alt = "{time} {icon}";
format-charging = "{capacity}% ";
format-plugged = "{capacity}% ";
interval = refreshInterval;
on-click-right = "powerlimit toggle";
states = {
good = 60;
warning = 40;
2024-11-08 10:48:51 +03:00
critical = 20;
2024-11-04 04:37:29 +03:00
};
format-icons = [
"󰂎"
"󱊡"
"󱊢"
"󱊣"
"󱊣"
];
};
"custom/powerlimit" = {
2024-11-10 20:44:26 +03:00
exec = "powerlimit widget";
hide-empty-text = false;
on-click-right = "powerlimit toggle";
signal = 6;
tooltip = false;
2024-11-04 04:37:29 +03:00
};
"group/batteryinfo" = {
orientation = "horizontal";
modules = [
2024-11-19 06:38:10 +03:00
"custom/tagbt1"
2024-11-04 04:37:29 +03:00
"battery"
"custom/powerlimit"
2024-11-19 06:38:10 +03:00
"custom/tagbt2"
2024-11-04 04:37:29 +03:00
];
};
pulseaudio = {
format = "{volume}%{icon}{format_source}";
format-muted = "󰸈{format_source}";
format-source = "";
format-source-muted = " 󰍭";
2024-12-13 11:59:15 +03:00
on-click = "pavucontrol";
on-click-middle = "pactl set-sink-mute @DEFAULT_SINK@ toggle";
2024-11-04 04:37:29 +03:00
on-click-right = "pactl set-source-mute @DEFAULT_SOURCE@ toggle";
scroll-step = 5;
};
mpris = let
maxLength = 32;
in {
album-len = maxLength;
artist-len = maxLength;
format = "{player_icon} {title} - {artist}";
format-paused = "{status_icon} {title} - {artist}";
on-click-middle = "playerctl stop";
title-len = maxLength;
tooltip-format = "{player}: {dynamic}";
player-icons = {
"default" = "";
"firefox" = "󰈹";
"mpv" = "";
};
status-icons = {
"paused" = "";
};
};
2024-11-19 00:27:40 +03:00
"cpu#usage" = {
format = "{usage}%";
interval = refreshInterval;
on-click = "foot -e bash -c btop";
on-click-right = "powersave toggle";
2024-11-09 04:50:32 +03:00
states.critical = 100;
tooltip = false;
2024-11-04 04:37:29 +03:00
};
2024-11-19 00:27:40 +03:00
"cpu#load" = {
format = "({load})";
interval = refreshInterval;
on-click = "foot -e bash -c btop";
on-click-right = "powersave toggle";
tooltip = false;
};
2024-11-04 04:37:29 +03:00
memory = {
format = "{percentage}%";
interval = refreshInterval;
on-click = "foot -e bash -c btop";
on-click-right = "powersave toggle";
states.critical = 80;
2024-11-04 04:37:29 +03:00
};
temperature = {
critical-threshold = 80;
format = "{temperatureC}°C";
2024-11-16 04:43:59 +03:00
hwmon-path-abs = "${config.module.hwmon.path}";
input-filename = "${config.module.hwmon.file}";
2024-11-04 04:37:29 +03:00
interval = refreshInterval;
on-click = "foot -e bash -c btop";
on-click-right = "powersave toggle";
tooltip = false;
};
"custom/powersave" = {
exec = "powersave widget";
on-click = "foot -e bash -c btop";
on-click-right = "powersave toggle";
signal = 5;
tooltip = false;
};
"group/hardware" = {
orientation = "horizontal";
modules = [
2024-11-19 00:27:40 +03:00
"custom/taghw1"
"cpu#usage"
"cpu#load"
2024-11-04 04:37:29 +03:00
"temperature"
"memory"
"custom/powersave"
2024-11-19 00:27:40 +03:00
"custom/taghw2"
2024-11-04 04:37:29 +03:00
];
};
"custom/display" = {
exec = "swayscript displaywidget";
on-click = "sleep 0.1 && swayscript dnd"; # HACK: https://github.com/Alexays/Waybar/issues/2166 & https://github.com/Alexays/Waybar/issues/1968
on-click-middle = "sleep 0.1 && swayscript displayreset";
on-click-right = "sleep 0.1 && swayscript monitor";
return-type = "json";
signal = 4;
};
"custom/network" = {
exec = "swayscript networkwidget";
# interval = refreshInterval;
on-click = "blueman-manager";
on-click-middle = "swayscript network";
on-click-right = "nm-connection-editor";
return-type = "json";
signal = 7;
};
2024-11-19 00:27:40 +03:00
"custom/taghw1" = {
2024-12-17 19:38:24 +03:00
exec = "echo ";
tooltip = false;
2024-11-19 00:27:40 +03:00
};
"custom/taghw2" = {
2024-12-17 19:38:24 +03:00
exec = "echo ";
tooltip = false;
2024-11-19 00:27:40 +03:00
};
2024-11-19 06:38:10 +03:00
"custom/tagbt1" = {
2024-12-17 19:38:24 +03:00
exec = "test -e /sys/class/power_supply/BAT*/capacity && echo ";
tooltip = false;
};
2024-11-19 06:38:10 +03:00
"custom/tagbt2" = {
2024-12-17 19:38:24 +03:00
exec = "test -e /sys/class/power_supply/BAT*/capacity && echo ";
tooltip = false;
};
2024-11-04 04:37:29 +03:00
};
2024-05-02 04:47:21 +03:00
}