Skip to content

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

feat: add custom text to tiling direction component (#202)

Joonatana29cf48f6379
diff --git a/GlazeWM.Bar/Components/TilingDirectionComponentViewModel.cs b/GlazeWM.Bar/Components/TilingDirectionComponentViewModel.cs
index 1c530c3e..dac20e2c 100644
--- a/GlazeWM.Bar/Components/TilingDirectionComponentViewModel.cs
+++ b/GlazeWM.Bar/Components/TilingDirectionComponentViewModel.cs
@@ -15,7 +15,12 @@ namespace GlazeWM.Bar.Components
private Dispatcher _dispatcher => _parentViewModel.Dispatcher;
private readonly Bus _bus = ServiceLocator.GetRequiredService<Bus>();
private readonly ContainerService _containerService =
- ServiceLocator.GetRequiredService<ContainerService>();
+ ServiceLocator.GetRequiredService<ContainerService>();
+
+ private TilingDirectionComponentConfig _config => _componentConfig as TilingDirectionComponentConfig;
+
+ private string TextVertical => _config.TextVertical;
+ private string TextHorizontal => _config.TextHorizontal;
/// <summary>
/// The layout of the currently focused container. Can be null on app startup when
@@ -26,7 +31,7 @@ namespace GlazeWM.Bar.Components
(_containerService.FocusedContainer.Parent as SplitContainer)?.Layout;
public string TilingDirectionString =>
- _tilingDirection == Layout.VERTICAL ? "vertical" : "horizontal";
+ _tilingDirection == Layout.VERTICAL ? TextVertical : TextHorizontal;
public TilingDirectionComponentViewModel(
BarViewModel parentViewModel,
diff --git a/GlazeWM.Domain/UserConfigs/TilingDirectionComponentConfig.cs b/GlazeWM.Domain/UserConfigs/TilingDirectionComponentConfig.cs
index 29d42868..c892fb5f 100644
--- a/GlazeWM.Domain/UserConfigs/TilingDirectionComponentConfig.cs
+++ b/GlazeWM.Domain/UserConfigs/TilingDirectionComponentConfig.cs
@@ -2,5 +2,14 @@ namespace GlazeWM.Domain.UserConfigs
{
public class TilingDirectionComponentConfig : BarComponentConfig
{
+ /// <summary>
+ /// Text to display in vertical mode.
+ /// </summary>
+ public string TextVertical { get; set; } = "vertical";
+
+ /// <summary>
+ /// Text to display horizontal mode.
+ /// </summary>
+ public string TextHorizontal { get; set; } = "horizontal";
}
}