{
inputs,
pkgs,
...
}:
{
config = {
home.file.".config/waybar/power_menu.xml".source =
inputs.self.resources.void.programs.waybar.power_menu;
programs.waybar = {
enable = true;
settings = [
{
position = "left";
exclusive = false;
ipc = true;
layer = "overlay";
modules-center = [
"sway/workspaces"
];
}
{
exclusive = false;
ipc = true;
layer = "overlay";
margin = "0 20 0 20";
modules-left = [
"idle_inhibitor"
"keyboard-state"
"network"
"sway/mode"
];
modules-center = [
"clock"
];
modules-right = [
"pulseaudio"
"cpu"
"memory"
"temperature"
"backlight"
"battery"
"tray"
"custom/power"
];
"sway/workspaces" = {
disable-scroll = true;
};
idle_inhibitor = {
format = "{icon}";
format-icons = {
activated = "";
deactivated = "";
};
};
keyboard-state = {
capslock = true;
format = "{name} {icon} ";
format-icons = {
locked = " ";
unlocked = "";
};
};
network = {
interval = 5;
format-wifi = " {essid} ({signalStrength}%)";
format-ethernet = " {ifname}";
format-disconnected = "No connection";
format-alt = " {ipaddr}/{cidr}";
tooltip = false;
};
"sway/mode" = {
format = "{}";
};
clock = {
tooltip-format = "{:%Y %B}\n{calendar}";
format = "{:%a, %d %b, %H:%M}";
};
pulseaudio = {
reverse-scrolling = 1;
format = "{volume}% {icon} {format_source}";
format-bluetooth = "{volume}% {icon} {format_source}";
format-bluetooth-muted = " {icon} {format_source}";
format-muted = "婢 {format_source}";
format-source = "{volume}% ";
format-source-muted = "";
format-icons = {
headphone = "";
hands-free = "";
headset = "";
phone = "";
portable = "";
car = "";
default = [
"奄"
"奔"
"墳"
];
};
on-click = "${pkgs.pulseaudio}/bin/pactl set-sink-mute @DEFAULT_SINK@ toggle";
on-click-right = "${pkgs.pavucontrol}/bin/pavucontrol";
min-length = 13;
};
"cpu" = {
format = "{usage}% ";
format-alt = "{load} ";
interval = 3;
tooltip = false;
};
"memory" = {
format = "{}% ";
interval = 3;
tooltip = false;
};
temperature = {
critical-threshold = 80;
format = "{temperatureC}°C {icon}";
format-icons = [
""
""
""
""
""
];
tooltip = false;
thermal-zone = 6;
};
backlight = {
device = "intel_backlight";
format = "{percent}% {icon}";
format-icons = [
""
""
""
""
""
""
""
];
min-length = 7;
};
battery = {
states = {
warning = 30;
critical = 15;
};
format = "{capacity}% {icon}";
format-charging = "{capacity}% ";
format-plugged = "{capacity}% ";
format-alt = "{time} {icon}";
format-icons = [
""
""
""
""
""
""
""
""
""
""
];
on-update = pkgs.writeShellScript "check-battery" ''
#!/usr/bin/env sh
PATH=$PATH:${pkgs.coreutils-full}/bin:${pkgs.libnotify}/bin
bat=/sys/class/power_supply/BAT0
CRIT=''${1:-15}
FILE=~/.config/waybar/scripts/notified
stat=$(cat $bat/status)
perc=$(cat $bat/capacity)
if [[ $perc -le $CRIT ]] && [[ $stat == "Discharging" ]]; then
if [[ ! -f "$FILE" ]]; then
notify-send --urgency=critical --icon=dialog-warning "Battery Low" "Current charge: $perc%"
touch $FILE
fi
elif [[ -f "$FILE" ]]; then
rm $FILE
fi
'';
};
tray = {
icon-size = 16;
spacing = 0;
};
"custom/power" = {
format = "⏻";
tooltip = false;
menu = "on-click";
menu-file = "$HOME/.config/waybar/power_menu.xml";
menu-actions = {
shutdown = "systemctl poweroff";
reboot = "systemctl reboot";
suspend = "systemctl suspend";
hibernate = "systemctl hibernate";
};
};
}
];
style = ''
* {
border: none;
border-radius: 0;
font-family: MesloLGS NF;
min-height: 20px;
padding: 5px;
}
window#waybar {
background: transparent;
}
window#waybar.hidden {
opacity: 0.2;
}
#workspaces {
margin-right: 8px;
border-radius: 10px;
transition: none;
background: #383c4a;
}
#workspaces button {
transition: none;
color: #7c818c;
background: transparent;
padding: 0px;
font-size: 18px;
}
#workspaces button.persistent {
color: #7c818c;
font-size: 12px;
}
/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */
#workspaces button:hover {
transition: none;
box-shadow: inherit;
text-shadow: inherit;
border-radius: inherit;
color: #383c4a;
background: #7c818c;
}
#workspaces button.focused {
color: white;
}
#idle_inhibitor {
margin-right: 8px;
padding-left: 16px;
padding-right: 16px;
border-radius: 10px;
transition: none;
color: #ffffff;
background: #383c4a;
}
#idle_inhibitor.activated {
color: #383c4a;
background: #ffffff;
}
#keyboard-state {
margin-right: 8px;
padding-left: 16px;
padding-right: 8px;
border-radius: 10px 10px 10px 10px;
transition: none;
color: #ffffff;
background: #383c4a;
}
#mode {
padding-left: 16px;
padding-right: 16px;
border-radius: 10px;
transition: none;
color: #ffffff;
background: #383c4a;
}
#network {
margin-right: 8px;
padding-left: 16px;
padding-right: 16px;
border-radius: 10px;
transition: none;
color: #ffffff;
background: #383c4a;
}
#clock {
padding-left: 16px;
padding-right: 16px;
border-radius: 10px 10px 10px 10px;
transition: none;
color: #ffffff;
background: #383c4a;
}
#pulseaudio {
margin-right: 8px;
padding-left: 16px;
padding-right: 16px;
border-radius: 10px;
transition: none;
color: #ffffff;
background: #383c4a;
}
#pulseaudio.muted {
background-color: #90b1b1;
color: #2a5c45;
}
#cpu {
margin-right: 8px;
padding-left: 16px;
padding-right: 16px;
border-radius: 10px;
transition: none;
color: #ffffff;
background: #383c4a;
}
#memory {
margin-right: 8px;
padding-left: 16px;
padding-right: 16px;
border-radius: 10px;
transition: none;
color: #ffffff;
background: #383c4a;
}
#temperature {
margin-right: 8px;
padding-left: 16px;
padding-right: 16px;
border-radius: 10px;
transition: none;
color: #ffffff;
background: #383c4a;
}
#temperature.critical {
background-color: #eb4d4b;
}
#backlight {
margin-right: 8px;
padding-left: 16px;
padding-right: 16px;
border-radius: 10px;
transition: none;
color: #ffffff;
background: #383c4a;
}
#battery {
margin-right: 8px;
padding-left: 16px;
padding-right: 16px;
border-radius: 10px;
transition: none;
color: #ffffff;
background: #383c4a;
}
#battery.charging {
color: #ffffff;
background-color: #26A65B;
}
#battery.warning:not(.charging) {
background-color: #ffbe61;
color: black;
}
#battery.critical:not(.charging) {
background-color: #f53c3c;
color: #ffffff;
animation-name: blink;
animation-duration: 0.5s;
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-direction: alternate;
}
#tray {
margin-right: 8px;
padding-left: 16px;
padding-right: 16px;
border-radius: 10px;
transition: none;
color: #ffffff;
background: #383c4a;
}
#custom-power {
padding-left: 16px;
padding-right: 16px;
border-radius: 10px;
transition: none;
color: #ffffff;
background: #383c4a;
}
@keyframes blink {
to {
background-color: #ffffff;
color: #000000;
}
}
'';
systemd = {
enable = true;
target = "sway-session.target";
};
};
};
}