GlazeWM is a tiling window manager for macOS and Windows inspired by i3wm.
feat(bar): add bindings for workspace component styles (partially implemented)
Lars Berger253199d85a3e
diff --git a/GlazeWM.Bar/BarViewModel.cs b/GlazeWM.Bar/BarViewModel.csindex 678e7be0..314150fc 100644--- a/GlazeWM.Bar/BarViewModel.cs+++ b/GlazeWM.Bar/BarViewModel.cs@@ -16,9 +16,11 @@ namespace GlazeWM.Bar{public Dispatcher Dispatcher { get; set; }public Monitor Monitor { get; set; }+private BarService _barService = ServiceLocator.Provider.GetRequiredService<BarService>();private UserConfigService _userConfigService = ServiceLocator.Provider.GetRequiredService<UserConfigService>();private BarConfig _barConfig => _userConfigService.UserConfig.Bar;+public string Background => _barConfig.Background;public string FontFamily => _barConfig.FontFamily;public string FontSize => _barConfig.FontSize;diff --git a/GlazeWM.Bar/Components/ComponentViewModel.cs b/GlazeWM.Bar/Components/ComponentViewModel.csindex 70b5ef39..f2832856 100644--- a/GlazeWM.Bar/Components/ComponentViewModel.cs+++ b/GlazeWM.Bar/Components/ComponentViewModel.cs@@ -9,7 +9,7 @@ namespace GlazeWM.Bar.Components{private BarService _barService = ServiceLocator.Provider.GetRequiredService<BarService>();protected readonly BarViewModel _parentViewModel;- protected readonly BarComponentConfig _baseConfig;+ public readonly BarComponentConfig _baseConfig;public string Background => _baseConfig.Background;public string FontFamily => _baseConfig.FontFamily;public string FontSize => _baseConfig.FontSize;diff --git a/GlazeWM.Bar/Components/WorkspacesComponent.xaml b/GlazeWM.Bar/Components/WorkspacesComponent.xamlindex c943694c..6f2a4cf5 100644--- a/GlazeWM.Bar/Components/WorkspacesComponent.xaml+++ b/GlazeWM.Bar/Components/WorkspacesComponent.xaml@@ -1,5 +1,6 @@<UserControlx:Class="GlazeWM.Bar.Components.WorkspacesComponent"+ x:Name="Self"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"@@ -9,10 +10,7 @@<ItemsControl ItemsSource="{Binding Workspaces}"><ItemsControl.ItemsPanel><ItemsPanelTemplate>- <UniformGrid- Rows="1"- HorizontalAlignment="Left"- IsItemsHost="True" />+ <StackPanel Orientation="Horizontal" /></ItemsPanelTemplate></ItemsControl.ItemsPanel>@@ -21,10 +19,11 @@<Buttonx:Name="WorkspaceButton"Content="{Binding Name}"- Background="#242424"- Foreground="White"- BorderBrush="Transparent"+ Background="{Binding DataContext.Config.DefaultWorkspaceBackground, ElementName=Self}"+ Foreground="{Binding DataContext.Config.DefaultWorkspaceForeground, ElementName=Self}"+ BorderBrush="{Binding DataContext.Config.DefaultWorkspaceBorderColor, ElementName=Self}"BorderThickness="0"+ Cursor="Hand"MinWidth="{Binding ActualHeight, RelativeSource={RelativeSource Self}}"MinHeight="{Binding ActualWidth, RelativeSource={RelativeSource Self}}" />@@ -35,15 +34,40 @@<SetterTargetName="WorkspaceButton"Property="Background"- Value="#42403e" />+ Value="{Binding DataContext.Config.DisplayedWorkspaceBackground, ElementName=Self}" />+ <Setter+ TargetName="WorkspaceButton"+ Property="Foreground"+ Value="{Binding DataContext.Config.DisplayedWorkspaceForeground, ElementName=Self}" />+ <Setter+ TargetName="WorkspaceButton"+ Property="BorderBrush"+ Value="{Binding DataContext.Config.DisplayedWorkspaceBorderColor, ElementName=Self}" />+ <Setter+ TargetName="WorkspaceButton"+ Property="BorderThickness"+ Value="0" /></DataTrigger>+<DataTriggerBinding="{Binding HasFocus}"Value="True"><SetterTargetName="WorkspaceButton"Property="Background"- Value="Orange" />+ Value="{Binding DataContext.Config.FocusedWorkspaceBackground, ElementName=Self}" />+ <Setter+ TargetName="WorkspaceButton"+ Property="Foreground"+ Value="{Binding DataContext.Config.FocusedWorkspaceForeground, ElementName=Self}" />+ <Setter+ TargetName="WorkspaceButton"+ Property="BorderBrush"+ Value="{Binding DataContext.Config.FocusedWorkspaceBorderColor, ElementName=Self}" />+ <Setter+ TargetName="WorkspaceButton"+ Property="BorderThickness"+ Value="0" /></DataTrigger></DataTemplate.Triggers></DataTemplate>diff --git a/GlazeWM.Bar/Components/WorkspacesComponentViewModel.cs b/GlazeWM.Bar/Components/WorkspacesComponentViewModel.csindex 2025a5df..546c540a 100644--- a/GlazeWM.Bar/Components/WorkspacesComponentViewModel.cs+++ b/GlazeWM.Bar/Components/WorkspacesComponentViewModel.cs@@ -16,7 +16,7 @@ namespace GlazeWM.Bar.Components{public class WorkspacesComponentViewModel : ComponentViewModel{- private WorkspacesComponentConfig _config => _baseConfig as WorkspacesComponentConfig;+ public WorkspacesComponentConfig Config => _baseConfig as WorkspacesComponentConfig;private Bus _bus = ServiceLocator.Provider.GetRequiredService<Bus>();private Dispatcher _dispatcher => _parentViewModel.Dispatcher;private Monitor _monitor => _parentViewModel.Monitor;