workspaces: window icons limit (#1267)

* workspace window icons display limit

* serialization
This commit is contained in:
Robin Seger 2026-03-15 07:34:52 +01:00 committed by GitHub
parent 12b07b7cdf
commit 1508abd3e1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 49 additions and 2 deletions

View file

@ -71,6 +71,7 @@ JsonObject {
property bool occupiedBg: false property bool occupiedBg: false
property bool showWindows: true property bool showWindows: true
property bool showWindowsOnSpecialWorkspaces: showWindows property bool showWindowsOnSpecialWorkspaces: showWindows
property int maxWindowIcons: 0 // 0 = unlimited
property bool activeTrail: false property bool activeTrail: false
property bool perMonitorWorkspaces: true property bool perMonitorWorkspaces: true
property string label: " " // if empty, will show workspace name's first letter property string label: " " // if empty, will show workspace name's first letter

View file

@ -209,6 +209,7 @@ Singleton {
occupiedBg: bar.workspaces.occupiedBg, occupiedBg: bar.workspaces.occupiedBg,
showWindows: bar.workspaces.showWindows, showWindows: bar.workspaces.showWindows,
showWindowsOnSpecialWorkspaces: bar.workspaces.showWindowsOnSpecialWorkspaces, showWindowsOnSpecialWorkspaces: bar.workspaces.showWindowsOnSpecialWorkspaces,
maxWindowIcons: bar.workspaces.maxWindowIcons,
activeTrail: bar.workspaces.activeTrail, activeTrail: bar.workspaces.activeTrail,
perMonitorWorkspaces: bar.workspaces.perMonitorWorkspaces, perMonitorWorkspaces: bar.workspaces.perMonitorWorkspaces,
label: bar.workspaces.label, label: bar.workspaces.label,

View file

@ -224,7 +224,11 @@ Item {
Repeater { Repeater {
model: ScriptModel { model: ScriptModel {
values: Hypr.toplevels.values.filter(c => c.workspace?.id === ws.wsId) values: {
const windows = Hypr.toplevels.values.filter(c => c.workspace?.id === ws.wsId);
const maxIcons = Config.bar.workspaces.maxWindowIcons;
return maxIcons > 0 ? windows.slice(0, maxIcons) : windows;
}
} }
MaterialIcon { MaterialIcon {

View file

@ -87,7 +87,11 @@ ColumnLayout {
Repeater { Repeater {
model: ScriptModel { model: ScriptModel {
values: Hypr.toplevels.values.filter(c => c.workspace?.id === root.ws) values: {
const windows = Hypr.toplevels.values.filter(c => c.workspace?.id === root.ws);
const maxIcons = Config.bar.workspaces.maxWindowIcons;
return maxIcons > 0 ? windows.slice(0, maxIcons) : windows;
}
} }
MaterialIcon { MaterialIcon {

View file

@ -38,6 +38,7 @@ Item {
property bool workspacesActiveIndicator: Config.bar.workspaces.activeIndicator ?? true property bool workspacesActiveIndicator: Config.bar.workspaces.activeIndicator ?? true
property bool workspacesOccupiedBg: Config.bar.workspaces.occupiedBg ?? false property bool workspacesOccupiedBg: Config.bar.workspaces.occupiedBg ?? false
property bool workspacesShowWindows: Config.bar.workspaces.showWindows ?? false property bool workspacesShowWindows: Config.bar.workspaces.showWindows ?? false
property int workspacesMaxWindowIcons: Config.bar.workspaces.maxWindowIcons ?? 0
property bool workspacesPerMonitor: Config.bar.workspaces.perMonitorWorkspaces ?? true property bool workspacesPerMonitor: Config.bar.workspaces.perMonitorWorkspaces ?? true
property bool scrollWorkspaces: Config.bar.scrollActions.workspaces ?? true property bool scrollWorkspaces: Config.bar.scrollActions.workspaces ?? true
property bool scrollVolume: Config.bar.scrollActions.volume ?? true property bool scrollVolume: Config.bar.scrollActions.volume ?? true
@ -81,6 +82,7 @@ Item {
Config.bar.workspaces.activeIndicator = root.workspacesActiveIndicator; Config.bar.workspaces.activeIndicator = root.workspacesActiveIndicator;
Config.bar.workspaces.occupiedBg = root.workspacesOccupiedBg; Config.bar.workspaces.occupiedBg = root.workspacesOccupiedBg;
Config.bar.workspaces.showWindows = root.workspacesShowWindows; Config.bar.workspaces.showWindows = root.workspacesShowWindows;
Config.bar.workspaces.maxWindowIcons = root.workspacesMaxWindowIcons;
Config.bar.workspaces.perMonitorWorkspaces = root.workspacesPerMonitor; Config.bar.workspaces.perMonitorWorkspaces = root.workspacesPerMonitor;
Config.bar.scrollActions.workspaces = root.scrollWorkspaces; Config.bar.scrollActions.workspaces = root.scrollWorkspaces;
Config.bar.scrollActions.volume = root.scrollVolume; Config.bar.scrollActions.volume = root.scrollVolume;
@ -402,6 +404,41 @@ Item {
} }
} }
StyledRect {
Layout.fillWidth: true
implicitHeight: workspacesMaxWindowIconsRow.implicitHeight + Appearance.padding.large * 2
radius: Appearance.rounding.normal
color: Colours.layer(Colours.palette.m3surfaceContainer, 2)
Behavior on implicitHeight {
Anim {}
}
RowLayout {
id: workspacesMaxWindowIconsRow
anchors.left: parent.left
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
anchors.margins: Appearance.padding.large
spacing: Appearance.spacing.normal
StyledText {
Layout.fillWidth: true
text: qsTr("Max window icons")
}
CustomSpinBox {
min: 0
max: 20
value: root.workspacesMaxWindowIcons
onValueModified: value => {
root.workspacesMaxWindowIcons = value;
root.saveConfig();
}
}
}
}
StyledRect { StyledRect {
Layout.fillWidth: true Layout.fillWidth: true
implicitHeight: workspacesPerMonitorRow.implicitHeight + Appearance.padding.large * 2 implicitHeight: workspacesPerMonitorRow.implicitHeight + Appearance.padding.large * 2