Alexays / Waybar

Highly customizable Wayland bar for Sway and Wlroots based compositors. :v: :tada:
MIT License
6.79k stars 712 forks source link

Hyprland Unknown Module #1697

Closed moncheeta closed 2 years ago

moncheeta commented 2 years ago

I'm using Hyprland on NixOS and I put "hyprland/window" in my configuration. When I run waybar, I get [warning] module hyprland/window: Unknown module: hyprland/window. Am I doing something wrong? It's in the wiki.

Here's my configuration:

{ pkgs, ... }:

let 
  patched_waybar = pkgs.waybar.overrideAttrs (oldAttrs: {
    mesonFlags = oldAttrs.mesonFlags ++ [ "-Dexperimental=true" ];
  });
in {
  programs.waybar = {
    enable = true;
    package = patched_waybar;
    systemd = {
      enable = true;
      target = "hyprland-session.target";
    };
    settings = {
      mainbar = {
        layer = "top";
        position = "bottom";
        height = 22;
        spacing = 10;

        modules-left = [ 
          "custom/dtname"
          "custom/sep" 
          "wlr/workspaces" 
        ];
        modules-center = [ "hyprland/window" ];
        modules-right = [ 
          "tray"
          "custom/sep"
          "custom/spotify"
          "pulseaudio" 
          "custom/sep"
          "cpu" 
          "custom/sep" 
          "memory" 
          "custom/sep" 
          "disk" 
          "custom/sep" 
          "network" 
          "custom/sep" 
          "battery" 
          "clock" 
        ];

        "custom/sep" = {
          format = "|";
          interval = "once";
          tooltip = false;
        };

        "custom/dtname" = {
            format = " ";
            # format = "";
            tooltip = false;
        };

        "hyprland/window" = {
          format = "{}";
        };

        "wlr/taskbar" = {
            format = "{title}";
            on-click = "activate";
            on-click-middle = "close";
        };

        "tray" = {
          icon-size = 12;
          spacing = 10;
          show-passive-items = true;
        };

        "custom/spotify" = {
          format = " {}";
          max-length = 40;
          interval = 0;
          exec = "$NIXOS_CONFIG_DIR/modules/scripts/mediaplayer.sh";
          exec-if = "pgrep spotify";
        };

        "pulseaudio" = {
          format = "{icon} {volume}%";
          format-bluetooth = " {icon} {volume}%";
          format-muted = " ";
          format-icons = {
            headphone = " ";
            headset = " ";
            phone = " ";
            portable = " ";
            car = " ";
            default = [" " " "];
          };
          scroll-step = 1;
          on-click = "pavucontrol";
        };

        "cpu" = {
          format = " {usage}%";
        };

        "memory" = {
          format = " {used:0.1f}/{total:0.1f}GB";
        };

        "disk" = {
          path = "/";
          format = " {used} used of {total}";
        };

        "network" = {
            format-wifi = "{essid}  ";
            format-ethernet = "{ifname}: {ipaddr}/{cidr}  ";
            format-disconnected = "Disconnected ⚠";
            interval = 5;
        };

        "battery" = {
          states = {
            warning = 30;
            critical = 15;
          };
          format = "{icon} {capacity}% |";
          format-icons = [" " " " " " " " " "];
        };

        "clock" = {
          format = "{:%H:%M}";
          timezone = "America/Chicago";
        };
      };
    };
    style = ''
      * {
        color: #e2e2e3;
        background: #2c2e34;
        border: none;
        font-family: JetBrainsMono Nerd Font;
        font-weight: bold;
        font-size: 10px;
        min-height: 0;
      }

      #custom-dtname {
        /*color: #76cce0;*/
        padding-left: 10px;
        color: #b39df3;
      }

      #tray {
        color: #e7c664;
      }

      #custom-spotify {
        color: #9ed072;
      }

      #pulseaudio {
        color: #76cce0;
      }

      #cpu {
        color: #b39df3;
      }

      #memory {
        color: #9ed072;
      }

      #disk {
        color: #f39660;
      }

      #network {
        color: #76cce0;
      }

      #battery {
        color: #9ed072;
      }

      #battery.warning:not(.charging) {
        color: #e7c664;
      }

      @keyframes blink {
        to {
          background-color: #2c2e34;
          color: #e2e2e3;
        }
      }

      #battery.critical:not(.charging) {
        color: #fc5d7c;
        animation-name: blink;
        animation-duration: 0.5s;
        animation-timing-function: linear;
        animation-iteration-count: infinite;
        animation-direction: alternate;
      }

      #clock {
        padding-right: 10px;
      }
    '';
  };
}
TAforever commented 2 years ago

What version of waybar are you using? The hyprland/window module was added recently and only works in the git version.

moncheeta commented 2 years ago

I'm using Waybar v0.9.13

TAforever commented 2 years ago

Version 0.9.13 does not support hyprland. You need to build the current development version.

quantenzitrone commented 2 years ago

I installed the latest git version on NixOS by overriding the package with a nix overlay and it should be on the latest git revision. I still get the error: [warning] module hyprland/window: Unknown module: hyprland/window and no module. How can I check if I am actually on the latest git version, because waybar --version still shows Waybar v0.9.13? Does waybar need any extra dependencies for the hyprland module?

quantenzitrone commented 2 years ago

oh nvm it works i forgor to rebuild my home-manager config and it used the nixpkgs version of waybar every time i tried if anyone wants to use my overlay:

final: prev: 
{
  waybar = (prev.waybar.override {
    catch2 = prev.catch2_3;
    swaySupport = false;
  }).overrideAttrs (oldAttrs: rec {
    version = "1374b0fce40f283b113e051f0558564fa1d9ad22";
    src = prev.fetchFromGitHub {
      owner = "Alexays";
      repo = "Waybar";
      rev = version;
      sha256 = "sha256-UG233AXx7xU9O3/hs5mIXun7PCYibJvlDL1tQhB5gxE=";
    };
    buildInputs = oldAttrs.buildInputs ++ [ prev.wayland-protocols prev.libappindicator-gtk3 prev.libinput prev.jack2 ];
    mesonFlags = oldAttrs.mesonFlags ++ [ "-Dexperimental=true" ];
  });
}