Skip to content

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

feat(domain,infra): add binding for bar background color

Lars Berger2620472e49f0
diff --git a/GlazeWM.Bar/BarViewModel.cs b/GlazeWM.Bar/BarViewModel.cs
index e52014ac..9e2da7db 100644
--- a/GlazeWM.Bar/BarViewModel.cs
+++ b/GlazeWM.Bar/BarViewModel.cs
@@ -12,6 +12,7 @@ namespace GlazeWM.Bar
{
public event PropertyChangedEventHandler PropertyChanged;
public ObservableCollection<Workspace> Workspaces { get; set; } = new ObservableCollection<Workspace>();
+ public string Background { get; set; }
private readonly Dispatcher _dispatcher;
private readonly Monitor _monitor;
private readonly BarConfig _barConfig;
@@ -23,6 +24,12 @@ namespace GlazeWM.Bar
_barConfig = barConfig;
}
+ public void InitializeState()
+ {
+ Background = _barConfig.Background;
+ SetWorkspaces();
+ }
+
public void SetWorkspaces()
{
_dispatcher.Invoke(() =>
diff --git a/GlazeWM.Bar/MainWindow.xaml b/GlazeWM.Bar/MainWindow.xaml
index ef49117d..f755f553 100644
--- a/GlazeWM.Bar/MainWindow.xaml
+++ b/GlazeWM.Bar/MainWindow.xaml
@@ -8,7 +8,7 @@
mc:Ignorable="d"
WindowStyle="None"
ResizeMode="NoResize"
- Background="#101010"
+ Background="{Binding Background}"
Title="GlazeWMBar"
ShowInTaskbar="False"
Width="800"
diff --git a/GlazeWM.Bar/MainWindow.xaml.cs b/GlazeWM.Bar/MainWindow.xaml.cs
index 96b8f06e..e718fa02 100644
--- a/GlazeWM.Bar/MainWindow.xaml.cs
+++ b/GlazeWM.Bar/MainWindow.xaml.cs
@@ -38,7 +38,7 @@ namespace GlazeWM.Bar
var barConfig = _userConfigService.UserConfig.Bar;
var viewModel = new BarViewModel(Dispatcher, monitor, barConfig);
- viewModel.SetWorkspaces();
+ viewModel.InitializeState();
DataContext = viewModel;
var workspaceAttachedEvent = _bus.Events.Where(@event => @event is WorkspaceAttachedEvent);
diff --git a/GlazeWM.Domain/UserConfigs/BarConfig.cs b/GlazeWM.Domain/UserConfigs/BarConfig.cs
index 6fc31a02..f5c1a367 100644
--- a/GlazeWM.Domain/UserConfigs/BarConfig.cs
+++ b/GlazeWM.Domain/UserConfigs/BarConfig.cs
@@ -3,5 +3,6 @@ namespace GlazeWM.Domain.UserConfigs
public class BarConfig
{
public int Height { get; set; } = 50;
+ public string Background { get; set; } = "#101010";
}
}