How to use waybar-hyprland

I have setup hyprland using a flake, and I am using the HM module for hyprland and also waybar.

How can I specify the hyprland-specific package of waybar in the HM module.

I have tried this:

programs.waybar = {
  enable = true;
  package = pkgs.waybar-hyprland;
  ...

but I got the error:

attribute 'waybar-hyprland' missing

I dunno what you are trying to do, did the hyprland team fork waybar? I am also using hyprland as of a few weeks ago, using the flake of their latest release tag, but I am just using the regular waybar package from nixpkgs and it works fine.

Did you get wlr/workspaces working? I get no output from that module.

No I don’t use that module as I have always used particular applications in particular workspaces so my muscle memory pretty much has me covered. I see in the wiki that the workspaces module does require special attention, so I checked their flake, and indeed they export a special package for it:

❯ n repl github:hyprwm/Hyprland/v0.24.1
Welcome to Nix 2.13.4. Type :? for help.

Loading installable 'github:hyprwm/Hyprland/v0.24.1#'...
Added 7 variables.
nix-repl> packages.x86_64-linux.waybar-hyprland
«derivation /nix/store/7a0skd68bkzvfym4l3b6hwar9jn8y7km-waybar-0.9.17.drv»

So just grab the package from the hyprland flake, instead of from nixpkgs and that should do it.

Cool. That’s what I want to do, but it’s above my pay grade. How can I grab the package? Can I modify the package entry in my waybar module above to specify the hyprland flake version?

sure so you would use:

{pkgs, ...}:
  # inputs are your flake inputs, assuming hyprland is one of them.
  programs.waybar.package = inputs.hyprland.packages.${pkgs.system}.waybar-hyprland
}

Awesome. That worked.

Curious, are you able to get on-click actions working in any modules?

I have a few actions defined in various modules, but none of them are working. I have one set up in the pulseaudio module to mute, but it isn’t working. I now have “activate” set as an on-click action in workspaces, but it also isn’t working.

I have an on-click to open pavucontrol when clicking on the pulseaudio module and it works fine.

OK. Strange. It has to do with running waybar as a systemd service.

I had set programs.waybar.systemd.enable = true;, which seemed to be working just fine, except that on-clicks weren’t working. If I stop the systemd service and run waybar at the command line, my on-clicks work.

Any ideas?

The systemd service likely doesn’t have the correct environment in some way or another. Personally I just start waybar from the exec-once = stanza of the hyprland config.