332 lines
		
	
	
		
			12 KiB
		
	
	
	
		
			Nix
		
	
	
	
	
	
			
		
		
	
	
			332 lines
		
	
	
		
			12 KiB
		
	
	
	
		
			Nix
		
	
	
	
	
	
{inputs, pkgs, lib, config, ...}:
 | 
						|
let
 | 
						|
  cfg = config.nix-config.style;
 | 
						|
in
 | 
						|
{
 | 
						|
    options.nix-config.waybar = {
 | 
						|
        burninPrevention = lib.mkOption {
 | 
						|
            type = lib.types.bool;
 | 
						|
            default = true;
 | 
						|
            description = "Enable burn-in prevention for Waybar";
 | 
						|
            example = ''
 | 
						|
                burninPrevention = true;
 | 
						|
            '';
 | 
						|
 | 
						|
        };
 | 
						|
    };
 | 
						|
 | 
						|
    config = {
 | 
						|
 | 
						|
        # required to autoload fonts from packages installed via Home Manager
 | 
						|
        fonts.fontconfig.enable = true;
 | 
						|
 | 
						|
        # waybar requires font-awesome
 | 
						|
        home.packages = [
 | 
						|
            pkgs.pavucontrol
 | 
						|
        ];
 | 
						|
 | 
						|
        # enable waybar
 | 
						|
        programs.waybar.enable = true;
 | 
						|
        programs.waybar = {
 | 
						|
            settings = {
 | 
						|
 | 
						|
                mainBar = {
 | 
						|
                    layer = "top";
 | 
						|
                    position = "top";
 | 
						|
 | 
						|
                    margin-top = 5;
 | 
						|
                    # margin-bottom = 2;
 | 
						|
                    # margin-left = 5;
 | 
						|
                    # margin-right = 5;
 | 
						|
 | 
						|
                    # margin between the modules
 | 
						|
                    spacing = 2;
 | 
						|
 | 
						|
                    modules-left = [
 | 
						|
                        "hyprland/workspaces"
 | 
						|
                        "hyprland/window"
 | 
						|
                    ];
 | 
						|
 | 
						|
                    modules-center = [
 | 
						|
                        "clock"
 | 
						|
                        "custom/notification"
 | 
						|
                    ];
 | 
						|
 | 
						|
                    modules-right = [
 | 
						|
                        "tray"
 | 
						|
                        "privacy"
 | 
						|
                        "network"
 | 
						|
                        "bluetooth"
 | 
						|
                        "wireplumber"
 | 
						|
                        "battery"
 | 
						|
                        "backlight"
 | 
						|
                        "idle_inhibitor"
 | 
						|
                    ];
 | 
						|
 | 
						|
 | 
						|
                    # module specific settings
 | 
						|
                    "hyprland/workspaces" = {
 | 
						|
                        format = "{icon}";
 | 
						|
                        format-icons = {
 | 
						|
                            active = "●";
 | 
						|
                            default = "○";
 | 
						|
                        };
 | 
						|
                    };
 | 
						|
                    "hyprland/window"= {
 | 
						|
                        "icon" = true;
 | 
						|
                        "separate-outputs" = true;
 | 
						|
                        "format" = "{}";
 | 
						|
                        "rewrite" = {
 | 
						|
                            "(.*) — Mozilla Firefox" = "$1";
 | 
						|
                            "(.*) — Zen Browser" = "$1";
 | 
						|
                            "(.*) - fish" = "> [$1]";
 | 
						|
                            "(.*) - Visual Studio Code" = "$1";
 | 
						|
                        };
 | 
						|
                    };
 | 
						|
                    "clock" = {
 | 
						|
                        format = "{:%H:%M}";
 | 
						|
                        interval = 1;
 | 
						|
                        tooltip-format = "{calendar}";
 | 
						|
                        # calendar = {
 | 
						|
                        #     format = "%Y-%m-%d\n %A\n\n%H:%M";
 | 
						|
                        #     start-day = 1; # Monday
 | 
						|
                        #     first-weekday = 1; # Monday
 | 
						|
                        #     week-number = false;
 | 
						|
                        #     long-weekdays = true;
 | 
						|
                        #     hide-if-empty = false;
 | 
						|
                        # };
 | 
						|
                    };
 | 
						|
                    "idle_inhibitor" = {
 | 
						|
                        format = "{icon}";
 | 
						|
                        format-icons = {
 | 
						|
                            activated = "";
 | 
						|
                            deactivated = "☕";
 | 
						|
                        };
 | 
						|
                        tooltip = "true";
 | 
						|
                    };
 | 
						|
                    "bluetooth" = {
 | 
						|
                        format-on = "";
 | 
						|
                        format-off = "";
 | 
						|
                        format-disabled = "";
 | 
						|
                        format-connected-battery = "{device_battery_percentage}% ";
 | 
						|
                        format-alt = "{device_alias} ";
 | 
						|
                        tooltip-format = "{controller_alias}\t{controller_address}\n\n{num_connections} connected";
 | 
						|
                        tooltip-format-connected = "{controller_alias}\t{controller_address}\n\n{num_connections} connected\n\n{device_enumerate}";
 | 
						|
                        tooltip-format-enumerate-connected = "{device_alias}\n{device_address}";
 | 
						|
                        tooltip-format-enumerate-connected-battery = "{device_alias}\n{device_address}\n{device_battery_percentage}%";
 | 
						|
                        on-click-right = "XDG_CURRENT_DESKTOP=GNOME gnome-control-center bluetooth";
 | 
						|
                    };
 | 
						|
                    "battery" = {
 | 
						|
                        interval = 60;
 | 
						|
                        states = {
 | 
						|
                            good = 80;
 | 
						|
                            warning = 30;
 | 
						|
                            critical = 10;
 | 
						|
                        };
 | 
						|
                        format = "{capacity}% {icon}";
 | 
						|
                        format-charging = "{capacity}% ";
 | 
						|
                        format-plugged = "{capacity}% ";
 | 
						|
                        format-icons = [ "" "" "" "" "" "" ];
 | 
						|
                    };
 | 
						|
                    "backlight" = {
 | 
						|
                        # format = "{percent}% {icon}";
 | 
						|
                        format = "{icon}";
 | 
						|
                        tooltip-format = "{percent}%";
 | 
						|
                        format-icons = [ "" "" "" "" "" "" "" "" "" ];
 | 
						|
                    };
 | 
						|
                    "wireplumber" = {
 | 
						|
                        scroll-step = 1;
 | 
						|
                        format = "{volume}% {icon}";# {format_source}";
 | 
						|
                        format-bluetooth = "{volume}% {icon}";# {format_source}";
 | 
						|
                        format-bluetooth-muted = " {icon}";# {format_source}";
 | 
						|
                        format-muted = "";# {format_source}";
 | 
						|
                        format-alt = "{format_source} {icon}";
 | 
						|
                        # format-source = " {volume}%";
 | 
						|
                        # format-source-muted = "";
 | 
						|
                        format-icons = {
 | 
						|
                            headphone = "";
 | 
						|
                            hands-free = "";
 | 
						|
                            headset = "";
 | 
						|
                            phone = "";
 | 
						|
                            portable = "";
 | 
						|
                            default = [
 | 
						|
                                ""
 | 
						|
                                ""
 | 
						|
                                ""
 | 
						|
                            ];
 | 
						|
                        };
 | 
						|
                        on-click = "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle";
 | 
						|
                        on-click-right = "XDG_CURRENT_DESKTOP=GNOME gnome-control-center sound";
 | 
						|
                    };
 | 
						|
                    "memory" = {
 | 
						|
                        interval = 5;
 | 
						|
                        format = " {}%";
 | 
						|
                        max-length = 10;
 | 
						|
                    };
 | 
						|
                    "tray" = {
 | 
						|
                        spacing = 5;
 | 
						|
                    };
 | 
						|
                    "custom/notification" = {
 | 
						|
                        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-if = "which swaync-client";
 | 
						|
                        exec = "swaync-client -swb";
 | 
						|
                        on-click = "swaync-client -t -sw";
 | 
						|
                        on-click-right = "swaync-client -d -sw";
 | 
						|
                        escape = true;
 | 
						|
                    };
 | 
						|
                    "network" = {
 | 
						|
                        format =  "";
 | 
						|
                        format-ethernet = " {ipaddr}";
 | 
						|
                        format-wifi = "{icon}";
 | 
						|
                        format-icons = [ "" "" "" "" "" ];
 | 
						|
                        format-disconnected = "";
 | 
						|
                        tooltip-format = " {ifname} via {gwaddr}";
 | 
						|
                        tooltip-format-wifi = ''
 | 
						|
                             {essid}({signalStrength}%), {frequency} GHz (Interface: {ifname})
 | 
						|
                            IP: {ipaddr}    GW: {gwaddr}
 | 
						|
 | 
						|
                            <span color='#a6da95'>{bandwidthUpBits}</span>    <span color='#ee99a0'>{bandwidthDownBits}</span>    <span color='#c6a0f6'>{bandwidthTotalBits}</span>
 | 
						|
                        '';
 | 
						|
                        tooltip-format-ethernet = ''
 | 
						|
                             {ifname} - {ipaddr}/{cidr}
 | 
						|
 | 
						|
                            <span color='#a6da95'>{bandwidthUpBits}</span>    <span color='#ee99a0'>{bandwidthDownBits}</span>    <span color='#c6a0f6'>{bandwidthTotalBits}</span>
 | 
						|
                        '';
 | 
						|
                        tooltip-format-disconnected = "Disconnected";
 | 
						|
                        on-click = "XDG_CURRENT_DESKTOP=GNOME gnome-control-center wifi";
 | 
						|
                    };
 | 
						|
                    "privacy" = {
 | 
						|
                        icon-spacing = 4;
 | 
						|
                        # icon-size" = 18;
 | 
						|
                        transition-duration = 250;
 | 
						|
                        modules = [
 | 
						|
                            {
 | 
						|
                                type = "screenshare";
 | 
						|
                                tooltip = true;
 | 
						|
                                # tooltip-icon-size = 24
 | 
						|
                            }
 | 
						|
                            {
 | 
						|
                                type = "audio-out";
 | 
						|
                                tooltip = true;
 | 
						|
                                # tooltip-icon-size = 24
 | 
						|
                            }
 | 
						|
                            {
 | 
						|
                                type = "audio-in";
 | 
						|
                                tooltip = true;
 | 
						|
                                # tooltip-icon-size = 24
 | 
						|
                            }
 | 
						|
                        ];
 | 
						|
                    };
 | 
						|
                };
 | 
						|
            };
 | 
						|
 | 
						|
            style = ''
 | 
						|
                * {
 | 
						|
                    font-family: "${cfg.monospaceFont}";
 | 
						|
                    font-weight: bold;
 | 
						|
                    font-size: ${builtins.toString (cfg.fontSizes.desktop + 5)}px;
 | 
						|
                }
 | 
						|
 | 
						|
                window#waybar {
 | 
						|
                    background-color: transparent;
 | 
						|
                }
 | 
						|
 | 
						|
                .module {
 | 
						|
                    background: rgba(0, 0, 0, 0.6);
 | 
						|
                    color: white;
 | 
						|
                    border-radius: 7px;
 | 
						|
                    margin: 1px 3px;
 | 
						|
                    padding: 1px 6px;
 | 
						|
                    animation: bgFade 3600s infinite alternate, textColorFade 3600s infinite alternate;
 | 
						|
                }
 | 
						|
 | 
						|
                box.module button:hover {
 | 
						|
                    box-shadow: inset 0 -3px #ffffff;
 | 
						|
                }
 | 
						|
 | 
						|
                /*.modules-left {
 | 
						|
                    padding: 3px;
 | 
						|
                }
 | 
						|
 | 
						|
                .modules-right {
 | 
						|
                    padding: 3px;
 | 
						|
                }
 | 
						|
 | 
						|
                .modules-center {
 | 
						|
                    padding: 3px;
 | 
						|
                }*/
 | 
						|
 | 
						|
                #workspaces button {
 | 
						|
                    color: white;
 | 
						|
                    background: none;
 | 
						|
                    animation: textColorFade 3600s infinite alternate;
 | 
						|
                }
 | 
						|
 | 
						|
                #battery.warning {
 | 
						|
                    background:rgba(240, 165, 0, 0.6);
 | 
						|
                }
 | 
						|
                #battery.critical {
 | 
						|
                    background:rgba(255, 0, 0, 0.6);
 | 
						|
                }
 | 
						|
                #battery.charging {
 | 
						|
                    background-color:rgba(14, 173, 0, 0.6);
 | 
						|
                }
 | 
						|
 | 
						|
 | 
						|
                #privacy {
 | 
						|
                    color: #ffffff;
 | 
						|
                    background:rgba(240, 165, 0, 0.6);
 | 
						|
                    border-radius: 7px;
 | 
						|
                    margin: 1px 3px;
 | 
						|
                    padding: 1px 6px;
 | 
						|
 | 
						|
                }
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
                @keyframes bgFade {
 | 
						|
                    0% {
 | 
						|
                        background-color: white;
 | 
						|
                    }
 | 
						|
                    100% {
 | 
						|
                        background-color: black;
 | 
						|
                    }
 | 
						|
                }
 | 
						|
 | 
						|
                @keyframes textColorFade {
 | 
						|
                    0% {
 | 
						|
                        color: black;
 | 
						|
                    }
 | 
						|
                    /* 45% {
 | 
						|
                        color: black;
 | 
						|
                    } */
 | 
						|
                    60% {
 | 
						|
                        color: rgb(29, 38, 96);
 | 
						|
                    }
 | 
						|
                    /* 55% {
 | 
						|
                        color: white;
 | 
						|
                    } */
 | 
						|
                    100% {
 | 
						|
                        color: white;
 | 
						|
                    }
 | 
						|
                }
 | 
						|
 | 
						|
            '';
 | 
						|
        };
 | 
						|
    };
 | 
						|
}
 | 
						|
 |