Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added MaxWindowTitleLength to WindowTitle Component #601

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -235,3 +235,4 @@ _Pvt_Extensions

# IDEA files
.idea/
GlazeWM.exe
2 changes: 1 addition & 1 deletion GlazeWM.Bar/Components/WindowTitleComponentViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ private LabelViewModel CreateLabel(string windowTitle)
var variableDictionary = new Dictionary<string, Func<string>>()
{
// TODO: Make truncate max length configurable from config.
{ "window_title", () => Truncate(windowTitle, 60) }
{ "window_title", () => Truncate(windowTitle, _config.MaxWindowTitleLength) }
};

return XamlHelper.ParseLabel(_config.Label, variableDictionary, this);
Expand Down
1 change: 1 addition & 0 deletions GlazeWM.Domain/UserConfigs/WindowTitleComponentConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ public class WindowTitleComponentConfig : BarComponentConfig
/// Label assigned to the window title component.
/// </summary>
public string Label { get; set; } = "{window_title}";
public int MaxWindowTitleLength { get; set; } = 60;
}
}
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@ Using the example of padding:
- [Image](#bar-component-image)
- [System Tray](#bar-component-system-tray)
- [Music](#bar-component-music)
- [Window Title](#bar-component-window-title)

#### Bar component: Clock

Expand Down Expand Up @@ -498,6 +499,15 @@ Displays currently playing music.
max_artist_length: 20
```

#### Bar component: Window Title

Displays the title of the currently-selected window.

```yaml
- type: "window title"
max_window_title_length: 60
```

## Mixing font properties within a label

Font family, font weight, font size, and foreground color can be changed within parts of a label. This means that icons and text fonts can be used together in a label. To customize a part of the label, wrap it in an <attr> tag:
Expand Down
Loading