Make waybar more configurable

This commit is contained in:
Riley Apeldoorn 2023-06-13 11:30:19 +02:00 committed by Riley Apeldoorn
parent 255d76da31
commit 369ad06b76
3 changed files with 175 additions and 130 deletions

View file

@ -1,4 +1,29 @@
{ ... }: {
{ 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;
};
};
config = {
programs.waybar = {
enable = true;
systemd = {
@ -11,12 +36,15 @@
"sway/workspaces"
"sway/mode"
];
modules-right = [
modules-right = lib.flatten [
"cpu"
"disk"
"wireplumber"
"network#wifi"
"network#eth"
(lib.optional (cfg.network.wifi != "") "network#wifi")
(lib.optional (cfg.network.eth != "") "network#eth")
(lib.optional (cfg.network.vpn != "") "network#vpn")
(if cfg.audio.wireplumber
then "wireplumber"
else "pulseaudio")
"clock#date"
"clock#time"
];
@ -29,10 +57,13 @@
"interval" = 60;
};
"network#wifi" = {
"interface" = "wlp6s0";
"interface" = cfg.network.wifi;
};
"network#eth" = {
"interface" = "enp9s0";
"interface" = cfg.network.eth;
};
"network#vpn" = {
"interface" = cfg.network.vpn;
};
"wireplumber" = {
"format" = "{node_name}: {volume}%";
@ -106,14 +137,14 @@
background-color: #27e67a;
}
#wireplumber {
#wireplumber, #pulseaudio {
padding: 2px 10px;
margin: 5px;
border-radius: 100px;
background-color: #edd340;
}
#wireplumber.muted {
#wireplumber.muted, #pulseaudio.muted {
color: #ffffff;
background-color: rgba(207, 207, 207, 0.4);
}
@ -128,4 +159,6 @@
'';
};
};
}

View file

@ -11,7 +11,14 @@
home-manager.enable = false;
};
custom.gui.enable = true;
custom.gui = {
enable = true;
bar = {
network.wifi = "wlp0s20f3";
network.vpn = "wg-dev";
audio.wireplumber = false;
};
};
xdg.systemDirs.data = [ "/usr/share" "/usr/local/share" ];
fonts.fontconfig.enable = true;

View file

@ -1,5 +1,10 @@
{ ... }:
{
custom.gui.enable = true;
custom.gui = {
enable = true;
bar = {
network.eth = "enp9s0";
};
};
}