nixos-config/user/waybar/default.nix

167 lines
4.9 KiB
Nix
Raw Normal View History

2023-06-02 10:40:51 -03:00
{ config, osConfig, pkgs, lib, font, ... }:
let
inherit (pkgs.uservars) 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" ];
2022-08-04 23:46:59 -03:00
modules-center = [ "clock" ];
2023-06-02 10:40:51 -03:00
modules-right = lib.flatten [
"sway/language"
"mpd"
2023-02-06 14:28:39 -03:00
"custom/playerctl"
2023-06-06 10:04:14 -03:00
# "tray"
"custom/caffeine"
"pulseaudio"
2023-06-02 11:14:27 -03:00
(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 = [ "" "" "" "" "" "" ];
};
2022-08-04 23:46:59 -03:00
network = {
interval = 5;
tooltip = false;
on-click = "terminal -e iwd";
2022-08-04 23:46:59 -03:00
format-wifi = "{icon}";
format-icons = [ "" "" "" "" "" ];
2023-06-02 22:42:56 -03:00
format-ethernet = "󰈀";
format-linked = "󰈀";
2022-08-04 23:46:59 -03:00
format-disconnected = "";
};
"sway/workspaces" = {
enable-bar-scroll = true;
format = "{icon}";
format-icons = {
"1" = "";
"2" = "";
2023-06-02 22:42:56 -03:00
"3" = "󰅩";
2022-08-04 23:46:59 -03:00
"4" = "";
"5" = "";
"6" = "";
2023-06-02 22:42:56 -03:00
"7" = "󰇮";
2022-08-04 23:46:59 -03:00
"8" = "";
"9" = "";
"10" = "";
urgent = "";
focused = "";
default = "";
};
};
"sway/window" = { max-length = 40; };
2022-08-12 23:35:42 -03:00
"tray" = {
"spacing" = 7;
"icon-size" = 19;
};
2022-08-04 23:46:59 -03:00
clock = {
interval = 60;
format = "<b>{:%H:%M %a %d/%m}</b>";
tooltip = false;
};
2023-01-22 18:12:04 -03:00
mpd =
let
mpc = "${pkgs.mpc-cli}/bin/mpc";
in
{
format = "{stateIcon} {title} - {artist}";
format-paused = "{stateIcon}";
format-stopped = "";
state-icons = {
2023-02-06 14:28:39 -03:00
stopped = "";
2023-01-22 18:12:04 -03:00
paused = "";
playing = "";
};
tooltip = false;
on-click = "${mpc} toggle";
on-scroll-up = "${mpc} vol +10";
on-scroll-down = "${mpc} vol -10";
};
2023-02-08 17:12:54 -03:00
"custom/playerctl" = {
2023-05-15 12:49:01 -03:00
format = "{} ";
2023-02-08 17:12:54 -03:00
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}"; };
2022-08-04 23:46:59 -03:00
"custom/caffeine" = {
format = "{}";
2023-06-02 22:42:56 -03:00
exec = "systemctl --user status swayidle > /dev/null && echo 󰒲 || echo 󰒳";
on-click = "${pkgs._sway_idle_toggle}/bin/_sway_idle_toggle";
2022-08-04 23:46:59 -03:00
interval = 1;
tooltip = false;
};
2023-06-02 11:14:27 -03:00
"custom/vpn" = lib.mkIf (osConfig.services.vpn.enable or false) {
2023-04-23 23:37:00 -03:00
format = "{}";
exec = ''
2023-04-24 12:39:28 -03:00
mullvad status | grep "^Connected" > /dev/null \
2023-04-23 23:37:00 -03:00
&& echo "" \
|| echo ""
'';
on-click = "mullvad connect";
on-click-right = "mullvad disconnect";
2023-04-23 23:37:00 -03:00
interval = 1;
tooltip = false;
};
2022-08-04 23:46:59 -03:00
pulseaudio = {
interval = 5;
tooltip = false;
scroll-step = 10;
format = "{icon}";
format-bluetooth = "";
2023-06-02 22:42:56 -03:00
format-bluetooth-muted = "󰝟";
format-muted = "󰝟";
2022-08-04 23:46:59 -03:00
format-icons = {
2022-11-07 11:24:40 -03:00
"alsa_output.pci-0000_09_00.4.analog-stereo" =
2023-06-02 22:42:56 -03:00
[ " 󰕿" " 󰖀" " 󰕾" ];
headphone = [ " 󰕿" " 󰖀" " 󰕾" ];
2022-08-04 23:46:59 -03:00
handsfree = "";
headset = "";
phone = "";
portable = "";
car = "";
2023-06-02 22:42:56 -03:00
default = [ "󰕿" "󰖀" "󰕾" ];
2022-08-04 23:46:59 -03:00
};
on-click = "pavucontrol";
2023-02-14 17:50:28 -03:00
on-click-right = "${pkgs.pulse_sink}/bin/pulse_sink";
2022-08-04 23:46:59 -03:00
};
}];
2023-05-04 23:57:36 -03:00
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";
});
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
};
}