Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

waybar support broken(?) #445

Open
tbaumann opened this issue Jun 21, 2024 · 5 comments
Open

waybar support broken(?) #445

tbaumann opened this issue Jun 21, 2024 · 5 comments

Comments

@tbaumann
Copy link

tbaumann commented Jun 21, 2024

I feel like I'm going a bit crazy.

  stylix.targets.waybar.enable = true; # Superfluous with autoEnable but I wanted to be sure
  stylix.targets.waybar.enableLeftBackColors = true;
  stylix.targets.waybar.enableCenterBackColors = true;
  stylix.targets.waybar.enableRightBackColors = true;

  programs.waybar.enable = true;
  programs.waybar.settings = [
    {
       ...

But no style is defined. (No file ~/.config/waybar/style.css exists)

I can set my own style with

  programs.waybar.style = "blah ...";

But I expected stylix to set that value.

The code looks right. I see no error in the hm module or my config. It's probably sometime totally stupid and I apoligize in advance for wasting your time.

Full config at https://github.com/tbaumann/nix-conf/blob/main/nix/home-manager/desktop/waybar.nix

@danth
Copy link
Owner

danth commented Jun 22, 2024

Strange; I can't see any obvious issues.

@tbaumann
Copy link
Author

You can see in th git repo that I changed the way the bars were defined. My syntax may have been a bit older.
But either way it made no difference.

@Sporesirius
Copy link

Sporesirius commented Jun 22, 2024

Hi, I have encountered the same problem, and it also affects other programs such as hyprland, yazi, dunst, and btop.

EDIT: I believe I have identified the issue. I have Home Manager set up as standalone, and I only configured the theme, fonts, etc., on the host side but not on the HM side. I assumed I could set up the theme, fonts, and cursor on the host, and the specific programs would inherit these settings from HM.

Here's how I configured the NixOS host:

  stylix = {
    enable = true;
    polarity = "dark";
    base16Scheme = "${pkgs.base16-schemes}/share/themes/gruvbox-dark-medium.yaml";
    image = /.../screenshots/a_cartoon_of_a_woman_with_flowers_in_her_hair.jpg;
    cursor = {
      package = pkgs.bibata-cursors;
      name = "Bibata-Modern-Ice";
      size = 16;
    };
    fonts = {
        serif = {
          package = pkgs.dejavu_fonts;
          name = "DejaVu Serif";
        };
        sansSerif = {
          package = pkgs.dejavu_fonts;
          name = "DejaVu Sans";
        };
        monospace = {
          package = pkgs.nerdfonts.override {fonts = ["FiraCode"];};
          name = "FiraCode Nerd Font Mono";
        };
        emoji = {
          package = pkgs.noto-fonts-emoji;
          name = "Noto Color Emoji";
        };
      };
  };

Initially, I thought this was sufficient because of stylix.homeManagerIntegration.autoImport and stylix.homeManagerIntegration.followSystem, but I didn't get any themes or fonts applied to the programs managed by HM. Therefore, I added the following configuration in HM:

  stylix.targets.waybar.enable = true;
  stylix.targets.waybar.enableCenterBackColors = true;
  stylix.targets.waybar.enableLeftBackColors = true;
  stylix.targets.waybar.enableRightBackColors = true;

  stylix.targets.dunst.enable = true;
  stylix.targets.btop.enable = true;
  stylix.targets.yazi.enable = true;
  stylix.targets.vesktop.enable = true;
  stylix.targets.fish.enable = true;
  stylix.targets.wezterm.enable = true;
  stylix.targets.rofi.enable  = true;

  stylix.targets.gtk.enable = true;

However, this still didn't work. I wondered if I also needed to set stylix.enable = true; in HM. This resulted in a "stylix.image missing" error message, so I added my entire Stylix configuration from the NixOS host side to HM as well. This resolved the issue, but I suspect this approach might not be correct?

Also, this is my flake.nix:

{
  description = "My NixOS system configuration";

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
    hardware.url = "github:nixos/nixos-hardware";
    systems.url = "github:nix-systems/default-linux";

    impermanence.url = "github:nix-community/impermanence";
    stylix.url = "github:danth/stylix";
    sops-nix = {
      url = "github:mic92/sops-nix";
      inputs.nixpkgs.follows = "nixpkgs";
    };
    home-manager = {
      url = "github:nix-community/home-manager";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  outputs = {
    self,
    nixpkgs,
    home-manager,
    systems,
    ...
  } @inputs: let
    inherit (self) outputs;
    lib = nixpkgs.lib // home-manager.lib;
    forEachSystem = f: lib.genAttrs (import systems) (system: f pkgsFor.${system});
    pkgsFor = lib.genAttrs (import systems) (
      system:
        import nixpkgs {
          inherit system;
        }
    );
  in {
      inherit lib;
      nixosModules = import ./modules/nixos;
      homeManagerModules = import ./modules/home-manager;

      overlays = import ./overlays {inherit inputs outputs;};

      packages = forEachSystem (pkgs: import ./pkgs {inherit pkgs;});
      devShells = forEachSystem (pkgs: import ./shell.nix {inherit pkgs;});

      nixosConfigurations = {
        # Main desktop
        blackeye =  lib.nixosSystem {
          modules = [
            inputs.stylix.nixosModules.stylix
            ./hosts/blackeye
          ];
          specialArgs = {
            inherit inputs outputs;
          };
        };
      };

      homeConfigurations = {
        "jk@blackeye" = lib.homeManagerConfiguration {
          modules = [
            inputs.stylix.homeManagerModules.stylix
            ./home/jk/blackeye.nix
          ];
          pkgs = pkgsFor.x86_64-linux;
          extraSpecialArgs = {
            inherit inputs outputs;
          };
        };
      };
    };
}

@trueNAHO
Copy link
Collaborator

Potentially related: #400 (comment)

@UnknownHiker
Copy link

UnknownHiker commented Jun 24, 2024

Im having similar issues, but its especially weird because, in KDE (X11) mostly everything (also Home-Manager defined programs) gets nicely themed, and when i switch to a Hyprland Session, even the programs that have been themed before, dont get themed anymore. So i feel its a Wayland- or Hyprland-specific issue, because Home Manager actually is able to inherit the Stylix Settings from the Nix Configuration.

If you need any configs, logs, screenshots for further analysis, id be glad to help.

UPDATE: So apparently the Styling only works when using the Home Manager Module for the Program.
Now, waybar and rofi are getting styled.

But there are still some Programs, like Krusader, Dolphin and LF that are getting styled in KDE but not in Hyprland.
LF is also defined as a Home Manage module, so i cant really tell, where exactly the Problem is.

Edit: The following workaround seems to fix dark theme of specific apps, but it breaks the Plasma Desktop session (blackscreen), so i disabled it again:

Part of home.nix

gtk = {
  iconTheme = {
    name = "Papirus-Dark";
    package = pkgs.papirus-icon-theme;
  };
  gtk3.extraConfig = {
    gtk-application-prefer-dark-theme = 1;
  };
  gtk4.extraConfig = {
    gtk-application-prefer-dark-theme = 1;
  };
};
qt = {
  enable = true;
  style.name = "adw-gtk3-dark";
  platformTheme.name = "gtk3";
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants