Skip to content

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

refactor(bar): simplify refreshing workspaces UI state

Lars Bergerca1dfa9e528a
diff --git a/GlazeWM.Bar/BarViewModel.cs b/GlazeWM.Bar/BarViewModel.cs
index df024159..e52014ac 100644
--- a/GlazeWM.Bar/BarViewModel.cs
+++ b/GlazeWM.Bar/BarViewModel.cs
@@ -11,6 +11,7 @@ namespace GlazeWM.Bar
public class BarViewModel : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
+ public ObservableCollection<Workspace> Workspaces { get; set; } = new ObservableCollection<Workspace>();
private readonly Dispatcher _dispatcher;
private readonly Monitor _monitor;
private readonly BarConfig _barConfig;
@@ -22,17 +23,6 @@ namespace GlazeWM.Bar
_barConfig = barConfig;
}
- private ObservableCollection<Workspace> _workspaces = new ObservableCollection<Workspace>();
- public ObservableCollection<Workspace> Workspaces
- {
- get { return _workspaces; }
- set
- {
- _workspaces = value;
- OnPropertyChanged("Workspaces");
- }
- }
-
public void SetWorkspaces()
{
_dispatcher.Invoke(() =>
@@ -41,8 +31,6 @@ namespace GlazeWM.Bar
foreach (var workspace in _monitor.Children)
Workspaces.Add(workspace as Workspace);
-
- OnPropertyChanged("Workspaces");
});
}