{ lib, config, pkgs, flakeRoot, ... }: let # Use the config option defaultUser directly, fallback to "henrov" username = config.defaultUser or "henrov"; assetPath = "${flakeRoot}/generated/.config/waybar"; in { # Install Waybar system-wide environment.systemPackages = [ pkgs.waybar ]; home-manager.users = { ${username} = { home.file = { ".config/waybar/config" = { text = builtins.readFile "${assetPath}/config"; force = true; }; ".config/waybar/style.css" = { text = builtins.readFile "${assetPath}/style.css"; force = true; }; ".config/waybar/scripts/bluetooth-status.sh" = { text = builtins.readFile "${assetPath}/scripts/bluetooth-status.sh"; force = true; executable = true; }; ".config/waybar/scripts/workspaces_content.sh" = { text = builtins.readFile "${assetPath}/scripts/workspaces_content.sh"; force = true; executable = true; }; ".config/waybar/scripts/hyprscroll-menu.sh" = { text = builtins.readFile "${assetPath}/scripts/hyprscroll-menu.sh"; force = true; executable = true; }; }; }; }; # Systemd user service for Waybar systemd.user.services.waybar = { description = "Waybar for Hyprland"; after = [ "graphical-session.target" ]; serviceConfig = { ExecStart = "${pkgs.waybar}/bin/waybar"; Restart = "always"; Environment = '' WAYLAND_DISPLAY=${config.environment.sessionVariables.WAYLAND_DISPLAY or "wayland-0"} XDG_CURRENT_DESKTOP=Hyprland ''; }; wantedBy = [ "default.target" ]; }; }