Converted waybar to a home module

This commit is contained in:
alejandro-angulo 2024-08-02 20:25:59 -07:00
parent 013c907a95
commit 8b6e8fb936
Signed by: alejandro-angulo
GPG key ID: 75579581C74554B6
5 changed files with 173 additions and 177 deletions

View file

@ -1,175 +0,0 @@
{
pkgs,
config,
lib,
...
}:
with lib; let
cfg = config.aa.desktop.addons.waybar;
in {
options.aa.desktop.addons.waybar = with types; {
enable = mkEnableOption "waybar";
thermal-zone = mkOption {
type = int;
default = 0;
description = "The thermal zone, as in `/sys/class/thermal/`.";
};
};
config = mkIf cfg.enable {
aa.system.fonts.enable = true;
aa.home = {
extraOptions = {
programs.waybar = {
enable = true;
systemd.enable = true;
style = builtins.readFile ./waybar_style.css;
settings = [
{
layer = "top";
position = "bottom";
height = 20;
modules-left = ["sway/workspaces"];
modules-center = ["clock"];
modules-right = [
"idle_inhibitor"
"temperature"
"cpu"
"pulseaudio"
"battery"
"memory"
"backlight"
"network"
"custom/notification"
"tray"
];
"sway/workspaces" = {
disable-scroll = false;
all-outputs = true;
format = "{icon}";
format-icons = {
"1" = "q";
"2" = "w";
"3" = "e";
"4" = "r";
"5" = "t";
"6" = "y";
"7" = "u";
"8" = "i";
"9" = "o";
};
};
idle_inhibitor = {
format = "{icon}";
format-icons = {
activated = " ";
deactivated = " ";
};
};
temperature = {
critical-threshold = 80;
format = "{icon}{temperatureC}°C";
format-icons = [" " " " " "];
thermal-zone = cfg.thermal-zone;
};
cpu = {
format = " {usage}%";
tooltip = false;
};
pulseaudio = {
format = "{icon} {volume}% {format_source}";
format-bluetooth = "{icon} {volume}% {format_source}";
format-bluetooth-muted = " {volume}% {format_source}";
format-muted = " {format_source}";
format-source = " ";
format-source-muted = " ";
format-icons = {
headphone = " ";
hands-free = " ";
headset = " ";
phone = " ";
portable = " ";
car = " ";
default = [" " " " " "];
};
tooltip-format = "{desc}, {volume}%";
# TODO: Figure out how to get pactl binary?
on-click = "pactl set-sink-mute @DEFAULT_SINK@ toggle";
on-click-right = "pactl set-source-mute @DEFAULT_SOURCE@ toggle";
on-click-middle = "pavucontrol";
};
battery = {
states = {
warning = 30;
critical = 1;
};
format = "{icon} {capacity}%";
tooltip-format = "{timeTo}, {capacity}%";
format-charging = "󰂄 {capacity}%";
format-plugged = " ";
format-alt = "{time} {icon}";
format-icons = [" " " " " " " " " "];
};
memory = {
format = " {}%";
};
backlight = {
format = "{icon} {percent}%";
format-icons = ["󰃞`" "󰃚"];
on-scroll-up = "light -A 1";
on-scroll-down = "light -U 1";
};
network = {
format-wifi = " ";
format-ethernet = "{ifname}: {ipaddr}/{cidr} 󰈀 ";
format-linked = "{ifname} (No IP) ";
format-disconnected = " ";
format-alt = "{ifname}: {ipaddr}/{cidr}";
tooltip-format = "{essid} {signalStrength}%";
};
# "custom/notification" = mkIf config.aa.desktop.addons.swaync.enable {
# tooltip = false;
# format = "{icon} {}";
# format-icons = {
# notification = "<span foreground='red'><sup></sup></span>";
# none = "";
# dnd-notification = "<span foreground='red'><sup></sup></span>";
# dnd-none = "";
# inhibited-notification = "<span foreground='red'><sup></sup></span>";
# inhibited-none = "";
# dnd-inhibited-notification = "<span foreground='red'><sup></sup></span>";
# dnd-inhibited-none = "";
# };
# return-type = "json";
# exec = "${pkgs.swaynotificationcenter}/bin/swaync-client -swb";
# on-click = "${pkgs.swaynotificationcenter}/bin/swaync-client -t -sw";
# on-click-right = "${pkgs.swaynotificationcenter}/bin/swaync-client -d -sw";
# escape = true;
# };
tray = {
spacing = 10;
};
}
];
};
wayland.windowManager.sway.config.bars = [];
};
};
};
}

View file

@ -1,138 +0,0 @@
* {
border: none;
font-family: Hack Nerd Font, sans-serif;
font-size: 1em;
}
window#waybar {
background-color: rgba(29, 32, 33, 0.9);
border-bottom: 3px solid #1d2021;
color: #ffffdf;
transition-property: background-color;
transition-duration: .5s;
}
window#waybar.hidden {
opacity: 0.2;
}
#workspaces,
#mode,
#cpu,
#memory,
#temperature,
#clock,
#idle_inhibitor,
#language,
#pulseaudio,
#backlight,
#battery,
#network,
#tray,
#custom-notification {
background-color: #303030;
padding: 0 10px;
margin: 3px;
border: 3px solid rgba(0, 0, 0, 0);
border-radius: 90px;
background-clip: padding-box;
}
#workspaces button {
padding: 0 5px;
min-width: 20px;
color: #87afaf;
}
#workspaces button:hover {
background-color: rgba(0, 0, 0, 1)
}
#workspaces button.focused {
color: #ffaf00;
}
#workspaces button.urgent {
color: #e06c75;
}
#clock {
color: #61afef;
}
#idle_inhibitor {
color: #abb2bf;
}
#idle_inhibitor.activated {
background-color: #abb2bf;
color: #1e222a;
}
#temperature {
color: #fb4934;
}
#temperature.critical {
color: #1d2021;
background-color: #9d0006;
}
#cpu {
color: #ff8700;
}
#memory {
color: #87af87;
}
#battery {
color: #b8bb26;
}
#battery.charging,
#battery.plugged {
background-color: #1f321c;
color: #ffffaf;
}
@keyframes blink {
to {
background-color: #1f321c;
color: #ffffaf;
}
}
#battery.critical:not(.charging) {
background-color: #afaf00;
color: #303030;
animation-name: blink;
animation-duration: 0.5s;
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-direction: alternate;
}
#pulseaudio {
color: #fabd2f;
}
#pulseaudio.muted {
color: #b57614;
}
#backlight {
color: #17ccd5;
}
#network {
color: #d787af;
}
#network.disconnected {
color: #875f87;
}
#custom\/notification {
color: red;
}

View file

@ -42,7 +42,6 @@ in {
rofi.enable = true;
swayidle.enable = true;
swaylock.enable = true;
waybar.enable = true;
# TODO
# light