Skip to content

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

feat: add border radius option for bar components (#265)

Joonatan08066cb99831
diff --git a/GlazeWM.Bar/Components/ComponentPortal.xaml b/GlazeWM.Bar/Components/ComponentPortal.xaml
index 247eccaf..e616991a 100644
--- a/GlazeWM.Bar/Components/ComponentPortal.xaml
+++ b/GlazeWM.Bar/Components/ComponentPortal.xaml
@@ -8,40 +8,40 @@
mc:Ignorable="d">
<Grid
Visibility="{Binding Visibility}"
- Margin="{Binding Margin}"
- Background="{Binding Background}">
+ Margin="{Binding Margin}">
<Border
+ CornerRadius="{Binding BorderRadius}"
BorderThickness="{Binding BorderWidth}"
BorderBrush="{Binding BorderColor}">
- <Grid Margin="{Binding Padding}">
+ <Grid>
<ContentPresenter Content="{Binding .}">
<ContentPresenter.Resources>
<DataTemplate DataType="{x:Type components:BatteryComponentViewModel}">
- <components:BatteryComponent />
+ <components:BatteryComponent Padding="{Binding Padding}" Background="{Binding Background}" />
</DataTemplate>
<DataTemplate DataType="{x:Type components:BindingModeComponentViewModel}">
- <components:BindingModeComponent />
+ <components:BindingModeComponent Padding="{Binding Padding}" Background="{Binding Background}" />
</DataTemplate>
<DataTemplate DataType="{x:Type components:ClockComponentViewModel}">
- <components:ClockComponent />
+ <components:ClockComponent Padding="{Binding Padding}" Background="{Binding Background}" />
</DataTemplate>
<DataTemplate DataType="{x:Type components:TextComponentViewModel}">
- <components:TextComponent />
+ <components:TextComponent Padding="{Binding Padding}" Background="{Binding Background}" />
</DataTemplate>
<DataTemplate DataType="{x:Type components:NetworkComponentViewModel}">
- <components:NetworkComponent />
+ <components:NetworkComponent Padding="{Binding Padding}" Background="{Binding Background}" />
</DataTemplate>
<DataTemplate DataType="{x:Type components:WindowTitleComponentViewModel}">
- <components:WindowTitleComponent />
+ <components:WindowTitleComponent Padding="{Binding Padding}" Background="{Binding Background}" />
</DataTemplate>
<DataTemplate DataType="{x:Type components:SystemTrayComponentViewModel}">
- <components:SystemTrayComponent />
+ <components:SystemTrayComponent Padding="{Binding Padding}" Background="{Binding Background}" />
</DataTemplate>
<DataTemplate DataType="{x:Type components:TilingDirectionComponentViewModel}">
- <components:TilingDirectionComponent />
+ <components:TilingDirectionComponent Padding="{Binding Padding}" Background="{Binding Background}" />
</DataTemplate>
<DataTemplate DataType="{x:Type components:WorkspacesComponentViewModel}">
- <components:WorkspacesComponent />
+ <components:WorkspacesComponent Padding="{Binding Padding}" Background="{Binding Background}" />
</DataTemplate>
</ContentPresenter.Resources>
</ContentPresenter>
diff --git a/GlazeWM.Bar/Components/ComponentViewModel.cs b/GlazeWM.Bar/Components/ComponentViewModel.cs
index 2c0e06e4..ff709fe9 100644
--- a/GlazeWM.Bar/Components/ComponentViewModel.cs
+++ b/GlazeWM.Bar/Components/ComponentViewModel.cs
@@ -21,6 +21,7 @@ namespace GlazeWM.Bar.Components
public string BorderColor => XamlHelper.FormatColor(_componentConfig.BorderColor);
public string BorderWidth =>
XamlHelper.FormatRectShorthand(_componentConfig.BorderWidth);
+ public string BorderRadius => XamlHelper.FormatSize(_componentConfig.BorderRadius);
public string Padding => XamlHelper.FormatRectShorthand(_componentConfig.Padding);
public string Margin => XamlHelper.FormatRectShorthand(_componentConfig.Margin);
diff --git a/GlazeWM.Bar/MainWindow.xaml b/GlazeWM.Bar/MainWindow.xaml
index a06a9958..0f946644 100644
--- a/GlazeWM.Bar/MainWindow.xaml
+++ b/GlazeWM.Bar/MainWindow.xaml
@@ -13,7 +13,7 @@
ShowInTaskbar="False"
Width="800"
Height="50"
- Background="{Binding Background}"
+ Background="Transparent"
FontFamily="{Binding FontFamily}"
FontWeight="{Binding FontWeight}"
FontSize="{Binding FontSize}"
@@ -23,7 +23,8 @@
<Border
CornerRadius="{Binding BorderRadius}"
BorderThickness="{Binding BorderWidth}"
- BorderBrush="{Binding BorderColor}">
+ BorderBrush="{Binding BorderColor}"
+ Background="{Binding Background}">
<Grid Margin="{Binding Padding}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
diff --git a/GlazeWM.Domain/UserConfigs/BarComponentConfig.cs b/GlazeWM.Domain/UserConfigs/BarComponentConfig.cs
index 0021720c..59b7d9e1 100644
--- a/GlazeWM.Domain/UserConfigs/BarComponentConfig.cs
+++ b/GlazeWM.Domain/UserConfigs/BarComponentConfig.cs
@@ -37,6 +37,11 @@ namespace GlazeWM.Domain.UserConfigs
public string BorderColor { get; set; } = "blue";
+ /// <summary>
+ /// Radius of the border in pixels.
+ /// </summary>
+ public string BorderRadius { get; set; } = "0px";
+
/// <summary>
/// Width of the border in pixels. To set a different border width for each side, specify four
/// values (eg. "5 0 5 0"). The borders widths apply to the top, right, bottom, and left in that