Skip to content

GlazeWM is a tiling window manager for macOS and Windows inspired by i3wm.

feat(bar): created static class for configuring services for Bar project

Larsaaf410647de5
diff --git a/LarsWM.Bar/DependencyInjection.cs b/LarsWM.Bar/DependencyInjection.cs
new file mode 100644
index 00000000..23959a96
--- /dev/null
+++ b/LarsWM.Bar/DependencyInjection.cs
@@ -0,0 +1,28 @@
+using LarsWM.Bar.CommandHandlers;
+using LarsWM.Bar.EventHandlers;
+using LarsWM.Infrastructure.Bussing;
+using Microsoft.Extensions.DependencyInjection;
+using System;
+
+namespace LarsWM.Bar
+{
+ public static class DependencyInjection
+ {
+ public static IServiceCollection AddBarServices(this IServiceCollection services)
+ {
+ services.AddSingleton<LaunchBarOnMonitorHandler>();
+ services.AddSingleton<MonitorAddedHandler>();
+
+ return services;
+ }
+
+ public static IServiceProvider RegisterBarHandlers(this IServiceProvider serviceProvider)
+ {
+ var bus = serviceProvider.GetRequiredService<IBus>();
+ bus.RegisterCommandHandler<LaunchBarOnMonitorHandler>();
+ bus.RegisterEventHandler<MonitorAddedHandler>();
+
+ return serviceProvider;
+ }
+ }
+}