Skip to content

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

feat(bar,domain): add 'custom_display_name' property to workspace config for changing displayed name in bar

Lyze31a17dbab839
diff --git a/GlazeWM.Bar/Components/WorkspacesComponent.xaml b/GlazeWM.Bar/Components/WorkspacesComponent.xaml
index 7b54cac8..287b6e60 100644
--- a/GlazeWM.Bar/Components/WorkspacesComponent.xaml
+++ b/GlazeWM.Bar/Components/WorkspacesComponent.xaml
@@ -18,7 +18,7 @@
<DataTemplate>
<Button
x:Name="WorkspaceButton"
- Content="{Binding Name}"
+ Content="{Binding CustomDisplayName}"
Command="{Binding DataContext.FocusWorkspaceCommand, ElementName=_workspacesComponent}"
CommandParameter="{Binding Name}"
Background="{Binding DataContext.DefaultWorkspaceBackground, ElementName=_workspacesComponent}"
diff --git a/GlazeWM.Domain/Workspaces/Workspace.cs b/GlazeWM.Domain/Workspaces/Workspace.cs
index b224a398..8840ff8c 100644
--- a/GlazeWM.Domain/Workspaces/Workspace.cs
+++ b/GlazeWM.Domain/Workspaces/Workspace.cs
@@ -1,4 +1,5 @@
using System;
+using System.Linq;
using GlazeWM.Domain.Containers;
using GlazeWM.Domain.Monitors;
using GlazeWM.Domain.UserConfigs;
@@ -11,6 +12,9 @@ namespace GlazeWM.Domain.Workspaces
{
public string Name { get; set; }
+ public string CustomDisplayName =>
+ _userConfigService.UserConfig.Workspaces.First(w => w.Name == Name).CustomDisplayName ?? Name;
+
private UserConfigService _userConfigService =
ServiceLocator.Provider.GetRequiredService<UserConfigService>();