451 lines
10 KiB
Nix
451 lines
10 KiB
Nix
{
|
|
pkgs,
|
|
config,
|
|
lib,
|
|
...
|
|
}:
|
|
let
|
|
cfg = config.xyno.desktop.waybar;
|
|
json = pkgs.formats.json { };
|
|
waybarCfg = {
|
|
layer = "top";
|
|
position = "top";
|
|
height = 20;
|
|
modules-left =
|
|
(lib.optionals (cfg.mode == "river") [
|
|
"river/tags"
|
|
"river/layout"
|
|
"river/window"
|
|
])
|
|
++ (lib.optionals (cfg.mode == "niri") [
|
|
"niri/workspaces"
|
|
"niri/window"
|
|
]);
|
|
modules-right = [
|
|
"tray"
|
|
"idle_inhibitor"
|
|
"wireplumber"
|
|
"battery"
|
|
"power-profiles-daemon"
|
|
"backlight"
|
|
"temperature"
|
|
"cpu"
|
|
"memory"
|
|
"disk"
|
|
"network"
|
|
"clock"
|
|
];
|
|
"power-profiles-daemon" = {
|
|
format = "{icon} ";
|
|
tooltip-format = "Power profile: {profile}\nDriver: {driver}";
|
|
tooltip = true;
|
|
format-icons = {
|
|
"default" = "";
|
|
"performance" = "";
|
|
"balanced" = "";
|
|
"power-saver" = "";
|
|
};
|
|
};
|
|
"river/window" = {
|
|
max-length = 40;
|
|
};
|
|
"niri/window" = {
|
|
max-length = 80;
|
|
};
|
|
wireplumber = {
|
|
"format" = "{icon} {volume:.2f} dB";
|
|
"format-muted" = " -inf dB";
|
|
# "on-click" = "${pkgs.pwvucontrol}/bin/pwvucontrol";
|
|
"on-click" = "${pkgs.pavucontrol}/bin/pavucontrol";
|
|
"on-click-right" = "${pkgs.wireplumber}/bin/wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle";
|
|
"on-scroll-up" = "${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ -l 1 1%+";
|
|
"on-scroll-down" = "${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ -l 1 1%-";
|
|
"format-icons" = [
|
|
""
|
|
""
|
|
""
|
|
];
|
|
};
|
|
"backlight" = {
|
|
"device" = "amdgpu_bl1";
|
|
"format" = "{icon} {percent}%";
|
|
"format-icons" = [
|
|
""
|
|
""
|
|
""
|
|
""
|
|
""
|
|
""
|
|
""
|
|
];
|
|
"on-scroll-up" = "${pkgs.light}/bin/light -A 5";
|
|
"on-scroll-down" = "${pkgs.light}/bin/light -U 5";
|
|
};
|
|
"idle_inhibitor" = {
|
|
format = "{icon} ";
|
|
format-icons = {
|
|
"activated" = "";
|
|
"deactivated" = "";
|
|
};
|
|
};
|
|
battery = {
|
|
"states" = {
|
|
"warning" = 30;
|
|
"critical" = 15;
|
|
};
|
|
"format" = "{icon} {capacity}%";
|
|
"format-icons" = [
|
|
""
|
|
""
|
|
""
|
|
""
|
|
""
|
|
];
|
|
"tooltip-format" = "Capacity: {capacity}%\nPower Draw: {power:0.2f}W\n{timeTo}\nCycles: {cycles}";
|
|
"max-length" = 25;
|
|
};
|
|
"cpu" = {
|
|
"interval" = 10;
|
|
"format" = " {:0.0f}%";
|
|
"max-length" = 10;
|
|
};
|
|
"temperature" = {
|
|
"format" = " {temperatureC}°C";
|
|
};
|
|
memory = {
|
|
interval = 30;
|
|
format = " {used:0.0f}/{total:0.0f}GB";
|
|
};
|
|
clock = {
|
|
interval = 1;
|
|
format = "{:%a %Y-%m-%dT%H:%M:%S%z}";
|
|
"tooltip-format" = "<tt><small>{calendar}</small></tt>";
|
|
"calendar" = {
|
|
"mode" = "year";
|
|
"mode-mon-col" = 3;
|
|
"weeks-pos" = "right";
|
|
"on-scroll" = 1;
|
|
"format" = {
|
|
"months" = "<span color='#ffead3'><b>{}</b></span>";
|
|
"days" = "<span color='#ecc6d9'><b>{}</b></span>";
|
|
"weeks" = "<span color='#99ffdd'><b>W{}</b></span>";
|
|
"weekdays" = "<span color='#ffcc66'><b>{}</b></span>";
|
|
"today" = "<span color='#ff6699'><b><u>{}</u></b></span>";
|
|
};
|
|
};
|
|
"actions" = {
|
|
"on-click-right" = "mode";
|
|
"on-scroll-up" = "shift_up";
|
|
"on-scroll-down" = "shift_down";
|
|
};
|
|
};
|
|
disk = {
|
|
format = " {specific_used:0.1f}/{specific_total:0.1f}TB";
|
|
unit = "TB";
|
|
path = "/";
|
|
};
|
|
"network" = {
|
|
"on-click" =
|
|
"${pkgs.alacritty}/bin/alacritty --class floating-alacritty -e ${pkgs.impala}/bin/impala";
|
|
"format" = "{ifname}";
|
|
"format-wifi" = " {essid}";
|
|
"format-ethernet" = " {ifname}";
|
|
"format-disconnected" = " ";
|
|
"tooltip-format" = "{ifname} via {gwaddr}\n{ipaddr}/{cidr}";
|
|
"tooltip-format-wifi" = "{essid} ({signaldBm} dBm) {frequency} GHz\n{ipaddr}/{cidr}";
|
|
"tooltip-format-ethernet" = "{ifname}\n{ipaddr}/{cidr}";
|
|
"tooltip-format-disconnected" = "Disconnected";
|
|
"max-length" = 50;
|
|
};
|
|
};
|
|
waybarCfgFile = json.generate "waybar-config.json" waybarCfg;
|
|
waybarStyleCss = ''
|
|
|
|
* {
|
|
/* `otf-font-awesome` is required to be installed for icons */
|
|
font-family: "Source Sans 3";
|
|
font-size: 11px;
|
|
}
|
|
|
|
|
|
window#waybar {
|
|
color: #a89984;
|
|
background-color: #1d2021;
|
|
}
|
|
|
|
window#waybar.hidden {
|
|
opacity: 0.2;
|
|
}
|
|
|
|
/*
|
|
window#waybar.empty {
|
|
background-color: transparent;
|
|
}
|
|
window#waybar.solo {
|
|
background-color: #FFFFFF;
|
|
}
|
|
*/
|
|
|
|
/*window#waybar.termite {
|
|
background-color: #3F3F3F;
|
|
}
|
|
|
|
window#waybar.chromium {
|
|
background-color: #000000;
|
|
border: none;
|
|
}*/
|
|
|
|
#workspaces button {
|
|
padding: 0 2px;
|
|
background-color: #1d2021;
|
|
color: #ebdbb2;
|
|
/* Use box-shadow instead of border so the text isn't offset */
|
|
box-shadow: inset 0 -3px transparent;
|
|
/* Avoid rounded borders under each workspace name */
|
|
border: none;
|
|
border-radius: 0;
|
|
}
|
|
|
|
/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */
|
|
#workspaces button:hover {
|
|
background: rgba(0, 0, 0, 0.2);
|
|
/* box-shadow: inset 0 -3px #fbf1c7;
|
|
*/
|
|
background-color: #3c3836;
|
|
}
|
|
|
|
#workspaces button.focused {
|
|
/* box-shadow: inset 0 -3px #fbf1c7;
|
|
*/
|
|
background-color: #3c3836;
|
|
color: #ebdbb2;
|
|
}
|
|
|
|
#workspaces button.occupied {
|
|
color: #d3869b;
|
|
}
|
|
#workspaces button.urgent {
|
|
background-color: #cc241d;
|
|
color: #ebdbb2;
|
|
}
|
|
|
|
#mode {
|
|
background-color: #64727D;
|
|
border-bottom: 3px solid #fbf1c7;
|
|
}
|
|
|
|
#clock,
|
|
#battery,
|
|
#cpu,
|
|
#memory,
|
|
#disk,
|
|
#temperature,
|
|
#backlight,
|
|
#network,
|
|
#pulseaudio,
|
|
#custom-media,
|
|
#tray,
|
|
#mode,
|
|
#idle_inhibitor,
|
|
#custom-poweroff,
|
|
#custom-suspend,
|
|
#mpd {
|
|
padding: 0 2px;
|
|
background-color: #1d2021;
|
|
color: #ebdbb2;
|
|
}
|
|
|
|
#window,
|
|
#workspaces,
|
|
#tags {
|
|
margin: 0 2px;
|
|
}
|
|
|
|
/* If workspaces is the leftmost module, omit left margin */
|
|
.modules-left > widget:first-child > #workspaces {
|
|
margin-left: 0;
|
|
}
|
|
|
|
/* If workspaces is the rightmost module, omit right margin */
|
|
.modules-right > widget:last-child > #workspaces {
|
|
margin-right: 0;
|
|
}
|
|
|
|
|
|
#battery {
|
|
color: #d3869b;
|
|
}
|
|
|
|
#battery.charging, #battery.plugged {
|
|
color: #98971a;
|
|
}
|
|
|
|
@keyframes blink {
|
|
to {
|
|
background-color: #fbf1c7;
|
|
color: #df3f71;
|
|
}
|
|
}
|
|
|
|
#battery.critical:not(.charging) {
|
|
background-color: #1d2021;
|
|
color: #d3869b;
|
|
animation-name: blink;
|
|
animation-duration: 0.5s;
|
|
animation-timing-function: linear;
|
|
animation-iteration-count: infinite;
|
|
animation-direction: alternate;
|
|
}
|
|
|
|
label:focus {
|
|
background-color: #000000;
|
|
}
|
|
|
|
#backlight {
|
|
color: #458588;
|
|
}
|
|
|
|
#temperature {
|
|
color: #fabd2f;
|
|
}
|
|
|
|
#temperature.critical {
|
|
background-color: #fbf1c7;
|
|
color: #b57614;
|
|
}
|
|
|
|
#memory {
|
|
color: #FCF434; /* enby yellow */
|
|
}
|
|
#disk {
|
|
color: #FFFFFF; /* enby white */
|
|
}
|
|
#network {
|
|
color: #b8bb26; /* enby green */
|
|
}
|
|
#clock {
|
|
color: #9C59D1; /* enby purple */
|
|
/*color: #2C2C2C; enby black */
|
|
}
|
|
|
|
|
|
#network.disconnected {
|
|
background-color: #fbf1c7;
|
|
color: #9d0006;
|
|
}
|
|
|
|
|
|
#wireplumber {
|
|
color: #fe8019;
|
|
}
|
|
|
|
#tray {
|
|
}
|
|
|
|
#tray > .needs-attention {
|
|
background-color: #fbf1c7;
|
|
color: #3c3836;
|
|
}
|
|
|
|
#idle_inhibitor {
|
|
background-color: #1d2021;
|
|
color: #ebdbb2;
|
|
}
|
|
|
|
#idle_inhibitor.activated {
|
|
background-color: #fbf1c7;
|
|
color: #3c3836;
|
|
}
|
|
|
|
#custom-media {
|
|
background-color: #66cc99;
|
|
color: #2a5c45;
|
|
min-width: 100px;
|
|
}
|
|
|
|
#custom-media.custom-spotify {
|
|
background-color: #66cc99;
|
|
}
|
|
|
|
#custom-media.custom-vlc {
|
|
background-color: #ffa000;
|
|
}
|
|
|
|
#mpd {
|
|
background-color: #66cc99;
|
|
color: #2a5c45;
|
|
}
|
|
|
|
#mpd.disconnected {
|
|
background-color: #f53c3c;
|
|
}
|
|
|
|
#mpd.stopped {
|
|
background-color: #90b1b1;
|
|
}
|
|
|
|
#mpd.paused {
|
|
background-color: #51a37a;
|
|
}
|
|
|
|
#language {
|
|
background: #00b093;
|
|
color: #740864;
|
|
padding: 0 5px;
|
|
margin: 0 5px;
|
|
min-width: 16px;
|
|
}
|
|
|
|
#keyboard-state {
|
|
background: #97e1ad;
|
|
color: #000000;
|
|
padding: 0 0px;
|
|
margin: 0 5px;
|
|
min-width: 16px;
|
|
}
|
|
|
|
#keyboard-state > label {
|
|
padding: 0 5px;
|
|
}
|
|
|
|
#keyboard-state > label.locked {
|
|
background: rgba(0, 0, 0, 0.2);
|
|
}
|
|
'';
|
|
waybarCssFile = pkgs.writeText "waybar.css" waybarStyleCss;
|
|
|
|
in
|
|
{
|
|
options.xyno.desktop.waybar.enable = lib.mkEnableOption "enable mako notification daemon";
|
|
options.xyno.desktop.waybar.wantedBy = lib.mkOption {
|
|
type = lib.types.str;
|
|
default = "niri.service";
|
|
};
|
|
options.xyno.desktop.waybar.package = lib.mkOption {
|
|
type = lib.types.package;
|
|
default = pkgs.unstable.waybar;
|
|
};
|
|
options.xyno.desktop.waybar.mode = lib.mkOption {
|
|
type = lib.types.str;
|
|
default = "niri";
|
|
};
|
|
config = lib.mkIf cfg.enable {
|
|
programs.waybar.enable = true;
|
|
programs.waybar.package = cfg.package.overrideAttrs (super: {
|
|
# version = super.version + "-patched";
|
|
patches = [
|
|
./waybar-wireplumber-db.patch
|
|
];
|
|
});
|
|
programs.light.enable = true;
|
|
|
|
systemd.user.services.waybar.wantedBy = lib.mkForce [ cfg.wantedBy ];
|
|
systemd.user.services.waybar.restartTriggers = [
|
|
waybarCfgFile
|
|
waybarCssFile
|
|
];
|
|
environment.etc."xdg/waybar/config".source = waybarCfgFile;
|
|
environment.etc."xdg/waybar/style.css".source = waybarCssFile;
|
|
|
|
};
|
|
}
|