nixos-config/user/waybar.nix

265 lines
7.4 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"
"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";
};
"custom/playerctl" =
let
playerctl = "${pkgs.playerctl}/bin/playerctl --ignore-player=mpd";
statusScript = pkgs.writeShellScript "waybar-playerctl-status" ''
test "$(env LC_ALL=C ${playerctl} status title)" = "Playing" \
&& ${playerctl} metadata title \
|| echo ""
'';
in
{
format = "{}";
exec = "${statusScript}";
on-click = "${playerctl} 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;
};
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";
on-click-right = "pulse-sink";
};
}];
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,
#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;
}
#network,
#pulseaudio,
#custom-caffeine
{
margin-top:-1px;
font-size:16px;
}
#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
};
}