GlazeWM is a tiling window manager for macOS and Windows inspired by i3wm.
feat(bar): reset focus after bar window is launched to previously focused window
Lars Berger56c777568ed6
diff --git a/GlazeWM.Bar/BarService.cs b/GlazeWM.Bar/BarService.csindex 0754e932..9598ff0b 100644--- a/GlazeWM.Bar/BarService.cs+++ b/GlazeWM.Bar/BarService.cs@@ -1,11 +1,10 @@using GlazeWM.Domain.Monitors.Events;-using GlazeWM.Domain.Workspaces;using GlazeWM.Infrastructure.Bussing;using System.Reactive.Linq;using System;using System.Threading;-using GlazeWM.Domain.UserConfigs;using System.Linq;+using static GlazeWM.Infrastructure.WindowsApi.WindowsApiService;namespace GlazeWM.Bar{@@ -30,6 +29,8 @@ namespace GlazeWM.Bar{application.Dispatcher.Invoke(() =>{+ var originalFocusedHandle = GetForegroundWindow();+var barViewModel = new BarViewModel(){Monitor = (@event as MonitorAddedEvent).AddedMonitor,@@ -38,6 +39,9 @@ namespace GlazeWM.Barvar barWindow = new MainWindow(barViewModel);barWindow.Show();++ // Reset focus to whichever window was focused before the bar window was launched.+ SetForegroundWindow(originalFocusedHandle);});});