1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-06-07 19:59:14 -04:00

feat(workspace): optionally group app icons on the active workspace

Closes #1208
This commit is contained in:
purian23
2026-06-03 18:32:53 -04:00
parent 6991b45fbe
commit e3de54c941
4 changed files with 27 additions and 2 deletions
+1
View File
@@ -372,6 +372,7 @@ Singleton {
property bool showWorkspaceApps: false property bool showWorkspaceApps: false
property bool workspaceDragReorder: true property bool workspaceDragReorder: true
property bool groupWorkspaceApps: true property bool groupWorkspaceApps: true
property bool groupActiveWorkspaceApps: false
property int maxWorkspaceIcons: 3 property int maxWorkspaceIcons: 3
property int workspaceAppIconSizeOffset: 0 property int workspaceAppIconSizeOffset: 0
property bool workspaceFollowFocus: false property bool workspaceFollowFocus: false
@@ -134,6 +134,7 @@ var SPEC = {
maxWorkspaceIcons: { def: 3 }, maxWorkspaceIcons: { def: 3 },
workspaceAppIconSizeOffset: { def: 0 }, workspaceAppIconSizeOffset: { def: 0 },
groupWorkspaceApps: { def: true }, groupWorkspaceApps: { def: true },
groupActiveWorkspaceApps: { def: false },
workspaceFollowFocus: { def: false }, workspaceFollowFocus: { def: false },
showOccupiedWorkspacesOnly: { def: false }, showOccupiedWorkspacesOnly: { def: false },
reverseScrolling: { def: false }, reverseScrolling: { def: false },
@@ -340,7 +340,8 @@ Item {
const keyBase = (w.app_id || w.appId || w.class || w.windowClass || "unknown"); const keyBase = (w.app_id || w.appId || w.class || w.windowClass || "unknown");
const moddedId = Paths.moddedAppId(keyBase); const moddedId = Paths.moddedAppId(keyBase);
const key = isActiveWs || !SettingsData.groupWorkspaceApps ? `${moddedId}_${i}` : moddedId; const groupThisWs = SettingsData.groupWorkspaceApps && (!isActiveWs || SettingsData.groupActiveWorkspaceApps);
const key = groupThisWs ? moddedId : `${moddedId}_${i}`;
if (!byApp[key]) { if (!byApp[key]) {
const isQuickshell = keyBase === "org.quickshell" || keyBase === "com.danklinux.dms"; const isQuickshell = keyBase === "org.quickshell" || keyBase === "com.danklinux.dms";
@@ -1091,7 +1092,7 @@ Item {
} }
} }
return (SettingsData.groupWorkspaceApps && !isActive) ? groupedCount : totalCount; return (SettingsData.groupWorkspaceApps && (!isActive || SettingsData.groupActiveWorkspaceApps)) ? groupedCount : totalCount;
} }
readonly property real baseWidth: root.isVertical ? (SettingsData.showWorkspaceApps ? Math.max(widgetHeight * 0.7, root.appIconSize + Theme.spacingXS * 2) : widgetHeight * 0.5) : (isActive ? Math.max(root.widgetHeight * 1.05, root.appIconSize * 1.6) : Math.max(root.widgetHeight * 0.7, root.appIconSize * 1.2)) readonly property real baseWidth: root.isVertical ? (SettingsData.showWorkspaceApps ? Math.max(widgetHeight * 0.7, root.appIconSize + Theme.spacingXS * 2) : widgetHeight * 0.5) : (isActive ? Math.max(root.widgetHeight * 1.05, root.appIconSize * 1.6) : Math.max(root.widgetHeight * 0.7, root.appIconSize * 1.2))
@@ -1883,6 +1884,12 @@ Item {
delegateRoot.updateAllData(); delegateRoot.updateAllData();
} }
} }
Connections {
target: root
function onCurrentWorkspaceChanged() {
delegateRoot.updateAllData();
}
}
Connections { Connections {
target: NiriService target: NiriService
enabled: CompositorService.isNiri enabled: CompositorService.isNiri
@@ -1907,6 +1914,12 @@ Item {
function onAppIdSubstitutionsChanged() { function onAppIdSubstitutionsChanged() {
delegateRoot.updateAllData(); delegateRoot.updateAllData();
} }
function onGroupWorkspaceAppsChanged() {
delegateRoot.updateAllData();
}
function onGroupActiveWorkspaceAppsChanged() {
delegateRoot.updateAllData();
}
} }
Connections { Connections {
target: DwlService target: DwlService
@@ -125,6 +125,16 @@ Item {
onToggled: checked => SettingsData.set("groupWorkspaceApps", checked) onToggled: checked => SettingsData.set("groupWorkspaceApps", checked)
} }
SettingsToggleRow {
settingKey: "groupActiveWorkspaceApps"
tags: ["workspace", "apps", "icons", "group", "grouped", "active", "focused"]
text: I18n.tr("Group Active Workspace")
description: I18n.tr("Also group repeated application icons on the active workspace")
checked: SettingsData.groupActiveWorkspaceApps
visible: SettingsData.showWorkspaceApps && SettingsData.groupWorkspaceApps
onToggled: checked => SettingsData.set("groupActiveWorkspaceApps", checked)
}
SettingsToggleRow { SettingsToggleRow {
settingKey: "workspaceActiveAppHighlightEnabled" settingKey: "workspaceActiveAppHighlightEnabled"
tags: ["workspace", "apps", "icons", "highlight", "active", "focused"] tags: ["workspace", "apps", "icons", "highlight", "active", "focused"]