nixos-config/user/waybar.nix

274 lines
7.5 KiB
Nix
Raw Normal View History

2022-08-06 18:32:34 -03:00
{ config, 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" ];
modules-right = [
"sway/language"
"mpd"
2023-02-06 14:28:39 -03:00
"custom/playerctl"
2022-12-09 20:37:56 -03:00
"tray"
"custom/caffeine"
"pulseaudio"
2023-04-23 23:37:00 -03:00
"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 = [ "" "" "" "" "" ];
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; };
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" = {
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}"; };
2022-08-04 23:46:59 -03:00
"custom/caffeine" = {
format = "{}";
2022-12-05 12:49:30 -03:00
exec = "systemctl --user status swayidle > /dev/null && echo || echo ";
2022-08-04 23:46:59 -03:00
on-click = "_sway_idle_toggle";
interval = 1;
tooltip = false;
};
2023-04-23 23:37:00 -03:00
"custom/vpn" = {
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";
interval = 1;
tooltip = false;
};
2022-08-04 23:46:59 -03:00
pulseaudio = {
interval = 5;
tooltip = false;
scroll-step = 10;
format = "{icon}";
format-bluetooth = "";
format-bluetooth-muted = "";
format-muted = "";
format-icons = {
2022-11-07 11:24:40 -03:00
"alsa_output.pci-0000_09_00.4.analog-stereo" =
[ " " " 奔" " " ];
2022-08-04 23:46:59 -03:00
headphone = [ " " " 奔" " " ];
handsfree = "";
headset = "";
phone = "";
portable = "";
car = "";
default = [ "" "奔" "" ];
};
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
};
}];
style = ''
/* {%@@ set bg_rgb = hex2rgb(color.bg) @@%} */
* {
font: ${
toString font.size.medium
}px "${font.interface}", Font Awesome, Fira Code Nerd Font;
border-radius:0;
margin:0;
padding: 0;
transition-duration:0;
}
window#waybar {
/* background-color: rgba(30,30,30,.9); */
transition-duration: .5s;
/* TODO: background opacity */
background-color: ${color.bg};
/*{%@@ if bar_pos == "top" @@%}
border-bottom:
{%@@ else @@%}
border-top:
{%@@ endif @@%}*/
border-bottom:
2px solid ${color.bg_dark};
}
window#waybar.solo {
background-color: ${color.bg};
}
#workspaces button {
color: ${color.bg_light};
min-width:50px;
background-color: transparent;
border: 3px solid transparent;
}
#workspaces button.focused {
color: ${color.txt};
/*{%@@ if bar_pos == "top" @@%}
border-top:
{%@@ else @@%}
border-bottom:
{%@@ endif @@%}*/
border-top:
3px solid ${accent.color};
/* border-bottom: 3px solid transparent; */
}
/*Window Title*/
#window {
color: ${color.txt};
margin:0 4px;
}
#mode {
color: ${accent.color};
}
#mpd,
#custom-mpd,
#tray,
#clock,
#network,
#battery,
#backlight,
#bluetooth,
#pulseaudio,
2023-04-23 23:37:00 -03:00
#custom-vpn,
2022-08-04 23:46:59 -03:00
#custom-mail,
#custom-spigot,
#custom-updates,
#custom-weather,
#custom-unpushed,
#custom-transmissionD,
#custom-transmissionS,
#custom-delugeD,
#custom-delugeS,
#custom-caffeine
{
margin: 0 7px;
color: ${color.txt};
opacity:.7;
}
#battery{
margin-right:15px;
}
#clock,
#custom-weather
{
font-size: ${toString font.size.big}px;
}
2023-04-23 23:37:00 -03:00
#custom-vpn {
margin: 0;
margin-right: 1px;
}
2022-08-04 23:46:59 -03:00
#network,
2023-04-23 23:37:00 -03:00
#custom-vpn,
2022-08-04 23:46:59 -03:00
#pulseaudio,
#custom-caffeine
{
margin-top:-1px;
2023-04-23 23:37:00 -03:00
font-size:17px;
2022-08-04 23:46:59 -03:00
}
#mpd,
#window,
#workspaces
{
font-weight:normal;
}
#custom-unpushed,
#custom-recording {
min-width:15px;
color: #ee4040;
}
#tray {
padding: 0;
margin: 0;
}
#language {
font-size: ${toString font.size.medium}px;
color: ${color.bg_light};
}
#custom-sleep {
color: ${accent.color};
font-size: ${toString font.size.big}px;
font-weight: bold;
}
'';
};
2022-08-30 22:01:06 -03:00
home.packages = with pkgs; [ waybar ];
2022-08-04 23:46:59 -03:00
};
}