modularize waybar config, TODO: styles

This commit is contained in:
Noa Aarts 2024-04-04 00:04:41 +02:00
parent 5f5dadd292
commit 9b7b35a686
11 changed files with 170 additions and 75 deletions

19
modules/waybar/vpn.nix Normal file
View file

@ -0,0 +1,19 @@
{ lib, config, ... }:
let
name = "custom/vpn";
in
{
options.modules.waybar.modules = import ./addname.nix lib name;
options.modules.waybar.${name} = {
enable = lib.mkEnableOption "enable ${name} waybar module";
};
config = lib.mkIf config.modules.waybar.${name}.enable {
programs.waybar.settings.mainbar."${name}" = {
format = "VPN";
exec = "echo '{\"class\": \"connected\"}'";
exec-if = "test -d /proc/sys/net/ipv4/conf/tun0";
return-type = "json";
interval = 5;
};
};
}