{ config, lib, ... }:
let
  inherit (lib) mkIf;
  cfg = config.programs.uwsm;
in
{
  config = mkIf cfg.enable {
    services.dbus.implementation = lib.mkForce "dbus";

    programs.uwsm = {
      waylandCompositors = {
        hyprland = mkIf config.programs.hyprland.enable {
          prettyName = "Hyprland";
          comment = "Hyprland compositor managed by UWSM";
          binPath = "/run/current-system/sw/bin/Hyprland";
        };
        sway = mkIf config.programs.sway.enable {
          prettyName = "Sway";
          comment = "Sway compositor managed by UWSM";
          binPath = "/run/current-system/sw/bin/sway";
        };
      };
    };
  };
}