Skip to content

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

feat(bar): add basic template for workspaces component

Lars Bergerafe1ccb046b5
diff --git a/GlazeWM.Bar/Components/WorkspacesComponent.xaml b/GlazeWM.Bar/Components/WorkspacesComponent.xaml
index 75bc9ce8..320092fd 100644
--- a/GlazeWM.Bar/Components/WorkspacesComponent.xaml
+++ b/GlazeWM.Bar/Components/WorkspacesComponent.xaml
@@ -6,9 +6,47 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:GlazeWM.Bar.Components"
mc:Ignorable="d">
- <Button
- Name="Fill"
- Width="50"
- Content="{Binding Type}"
- Background="Blue" />
+ <ItemsControl ItemsSource="{Binding Workspaces}">
+ <ItemsControl.ItemsPanel>
+ <ItemsPanelTemplate>
+ <UniformGrid
+ Columns="10"
+ HorizontalAlignment="Left"
+ IsItemsHost="True" />
+ </ItemsPanelTemplate>
+ </ItemsControl.ItemsPanel>
+
+ <ItemsControl.ItemTemplate>
+ <DataTemplate>
+ <Button
+ x:Name="WorkspaceButton"
+ Content="{Binding Name}"
+ Background="#242424"
+ Foreground="White"
+ BorderBrush="Transparent"
+ BorderThickness="0"
+ MinWidth="{Binding ActualHeight, RelativeSource={RelativeSource Self}}"
+ MinHeight="{Binding ActualWidth, RelativeSource={RelativeSource Self}}" />
+
+ <DataTemplate.Triggers>
+ <DataTrigger
+ Binding="{Binding IsDisplayed}"
+ Value="True">
+ <Setter
+ TargetName="WorkspaceButton"
+ Property="Background"
+ Value="#42403e" />
+ </DataTrigger>
+ <DataTrigger
+ Binding="{Binding HasFocus}"
+ Value="True">
+ <Setter
+ TargetName="WorkspaceButton"
+ Property="Background"
+ Value="Orange" />
+ </DataTrigger>
+ </DataTemplate.Triggers>
+ </DataTemplate>
+ </ItemsControl.ItemTemplate>
+ </ItemsControl>
</UserControl>