232 lines
4.8 KiB
Nix
232 lines
4.8 KiB
Nix
{ config, lib, ... }:
|
|
|
|
let cfg = config.custom.gui.bar;
|
|
|
|
in {
|
|
|
|
options.custom.gui.bar = with lib; with types; {
|
|
network.wifi = lib.mkOption {
|
|
type = str;
|
|
default = "";
|
|
};
|
|
network.eth = lib.mkOption {
|
|
type = str;
|
|
default = "";
|
|
};
|
|
network.vpn = lib.mkOption {
|
|
type = str;
|
|
default = "";
|
|
};
|
|
audio.wireplumber = lib.mkOption {
|
|
type = bool;
|
|
default = true;
|
|
};
|
|
battery.name = lib.mkOption {
|
|
type = str;
|
|
default = "";
|
|
};
|
|
bluetooth.enable = lib.mkEnableOption "bluetooth";
|
|
};
|
|
|
|
config = {
|
|
programs.waybar = {
|
|
enable = true;
|
|
systemd = {
|
|
enable = true;
|
|
target = "sway-session.target";
|
|
};
|
|
settings = [{
|
|
margin = "3";
|
|
position = "bottom";
|
|
exclusive = false;
|
|
layer = "top";
|
|
modules-right = with lib; flatten [
|
|
"sway/workspaces"
|
|
"sway/mode"
|
|
(optional (cfg.battery.name != "") "battery")
|
|
"network"
|
|
(if cfg.audio.wireplumber
|
|
then "wireplumber"
|
|
else "pulseaudio")
|
|
"clock#date"
|
|
"clock#time"
|
|
];
|
|
"mpd" = {
|
|
"format" = "{artist} | {title}";
|
|
"format-stopped" = "";
|
|
"format-disconnected" = "";
|
|
};
|
|
"clock#time" = {
|
|
"format" = "{:%H:%M}";
|
|
"interval" = 1;
|
|
};
|
|
"clock#date" = {
|
|
"format" = "{:%Y-%m-%d}";
|
|
"interval" = 60;
|
|
};
|
|
"network" = {
|
|
"format-wifi" = "{essid}";
|
|
"format-ethernet" = "eth";
|
|
"format-disconnected" = "";
|
|
};
|
|
"pulseaudio" = {
|
|
"format" = "{desc} | {volume}%";
|
|
};
|
|
"wireplumber" = {
|
|
"format" = "{node_name} | {volume}%";
|
|
};
|
|
"battery" = {
|
|
"bat" = cfg.battery.name;
|
|
"format-discharging" = "{capacity}%";
|
|
"format-charging" = "{capacity}%";
|
|
"format-full" = "";
|
|
"states" = {
|
|
"critical" = 20;
|
|
};
|
|
};
|
|
"bluetooth" = {
|
|
"format" = "";
|
|
"format-on" = "";
|
|
"format-connected" = "{device_alias}";
|
|
};
|
|
}];
|
|
|
|
# TODO: make this fancy scss
|
|
style = ''
|
|
/* General/shared styles */
|
|
|
|
* {
|
|
font-family: 'Fira Code';
|
|
font-weight: 700;
|
|
font-size: 12px;
|
|
}
|
|
|
|
window#waybar {
|
|
background-color: transparent;
|
|
}
|
|
|
|
.modules-right {
|
|
background-color: #424242;
|
|
border-radius: 40px;
|
|
padding-left: 2px;
|
|
}
|
|
|
|
#battery,
|
|
#bluetooth,
|
|
#clock,
|
|
#cpu,
|
|
#disk,
|
|
#mode,
|
|
#mpd,
|
|
#network,
|
|
#pulseaudio,
|
|
#wireplumber
|
|
{
|
|
padding: 5px 10px;
|
|
margin: 5px 2px;
|
|
border-radius: 100px;
|
|
color: #ffffff;
|
|
background-color: rgba(0, 0, 0, 0.4);
|
|
}
|
|
|
|
|
|
/* Sway chips */
|
|
|
|
#workspaces {
|
|
padding: 0;
|
|
margin: 5px 2px 5px 5px;
|
|
border-radius: 200px;
|
|
background-color: rgba(0, 0, 0, 0.4);
|
|
}
|
|
|
|
#workspaces button {
|
|
border: 2px solid;
|
|
border-color: transparent;
|
|
border-radius: 100px;
|
|
color: #ffffff;
|
|
font-size: 9px;
|
|
margin: 0;
|
|
padding: 0 5px;
|
|
}
|
|
|
|
#workspaces button.visible.focused {
|
|
color: #ffffff;
|
|
border-color: #2bdafc;
|
|
}
|
|
|
|
#workspaces button.visible {
|
|
color: #2bdafc;
|
|
}
|
|
|
|
#mode {
|
|
color: #212121;
|
|
background-color: #2bdafc;
|
|
}
|
|
|
|
|
|
/* Clock chips */
|
|
|
|
#clock {
|
|
color: #ffffff;
|
|
padding: 5px 10px;
|
|
background-color: rgba(0, 0, 0, 0.4);
|
|
}
|
|
|
|
#clock.date {
|
|
padding-right: 5px;
|
|
margin-right: 0;
|
|
border-radius: 14px 0 0 14px;
|
|
}
|
|
#clock.time {
|
|
padding-left: 5px;
|
|
margin-left: 0;
|
|
border-radius: 0 14px 14px 0;
|
|
margin-right: 5px;
|
|
}
|
|
|
|
|
|
/* Radio chips */
|
|
|
|
#network.disconnected {
|
|
color: #ffffff;
|
|
background-color: transparent;
|
|
}
|
|
|
|
#bluetooth.connected {
|
|
background-color: #3988e3;
|
|
}
|
|
|
|
|
|
/* Audio chip */
|
|
|
|
#pulseaudio.muted,
|
|
#wireplumber.muted
|
|
{
|
|
color: rgba(207, 207, 207, 0.9);
|
|
|
|
}
|
|
|
|
|
|
/* Battery chip */
|
|
|
|
#battery {
|
|
border: 2px solid;
|
|
border-color: transparent;
|
|
border-radius: 200px;
|
|
padding: 5px 8px;
|
|
color: #ffffff;
|
|
background-color: rgba(0, 0, 0, 0.4);
|
|
}
|
|
|
|
#battery.charging {
|
|
border-color: #2bdafc;
|
|
}
|
|
|
|
#battery.critical {
|
|
border-color: #eb3b5b;
|
|
}
|
|
'';
|
|
};
|
|
};
|
|
|
|
}
|