1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-28 23:42:51 -05:00

dwl: hide empty tags by default

This commit is contained in:
bbedward
2025-10-29 23:07:15 -04:00
parent 7ed0b752a8
commit 1c323f54ee
6 changed files with 107 additions and 40 deletions

View File

@@ -131,6 +131,7 @@ Singleton {
property bool showWorkspaceApps: false property bool showWorkspaceApps: false
property int maxWorkspaceIcons: 3 property int maxWorkspaceIcons: 3
property bool workspacesPerMonitor: true property bool workspacesPerMonitor: true
property bool dwlShowAllTags: false
property var workspaceNameIcons: ({}) property var workspaceNameIcons: ({})
property bool waveProgressEnabled: true property bool waveProgressEnabled: true
property bool clockCompactMode: false property bool clockCompactMode: false
@@ -433,6 +434,7 @@ Singleton {
maxWorkspaceIcons = settings.maxWorkspaceIcons !== undefined ? settings.maxWorkspaceIcons : 3 maxWorkspaceIcons = settings.maxWorkspaceIcons !== undefined ? settings.maxWorkspaceIcons : 3
workspaceNameIcons = settings.workspaceNameIcons !== undefined ? settings.workspaceNameIcons : ({}) workspaceNameIcons = settings.workspaceNameIcons !== undefined ? settings.workspaceNameIcons : ({})
workspacesPerMonitor = settings.workspacesPerMonitor !== undefined ? settings.workspacesPerMonitor : true workspacesPerMonitor = settings.workspacesPerMonitor !== undefined ? settings.workspacesPerMonitor : true
dwlShowAllTags = settings.dwlShowAllTags !== undefined ? settings.dwlShowAllTags : false
waveProgressEnabled = settings.waveProgressEnabled !== undefined ? settings.waveProgressEnabled : true waveProgressEnabled = settings.waveProgressEnabled !== undefined ? settings.waveProgressEnabled : true
clockCompactMode = settings.clockCompactMode !== undefined ? settings.clockCompactMode : false clockCompactMode = settings.clockCompactMode !== undefined ? settings.clockCompactMode : false
focusedWindowCompactMode = settings.focusedWindowCompactMode !== undefined ? settings.focusedWindowCompactMode : false focusedWindowCompactMode = settings.focusedWindowCompactMode !== undefined ? settings.focusedWindowCompactMode : false
@@ -647,6 +649,7 @@ Singleton {
"showWorkspaceApps": showWorkspaceApps, "showWorkspaceApps": showWorkspaceApps,
"maxWorkspaceIcons": maxWorkspaceIcons, "maxWorkspaceIcons": maxWorkspaceIcons,
"workspacesPerMonitor": workspacesPerMonitor, "workspacesPerMonitor": workspacesPerMonitor,
"dwlShowAllTags": dwlShowAllTags,
"workspaceNameIcons": workspaceNameIcons, "workspaceNameIcons": workspaceNameIcons,
"waveProgressEnabled": waveProgressEnabled, "waveProgressEnabled": waveProgressEnabled,
"clockCompactMode": clockCompactMode, "clockCompactMode": clockCompactMode,
@@ -774,7 +777,7 @@ Singleton {
} }
function cleanupUnusedKeys() { function cleanupUnusedKeys() {
const validKeys = ["currentThemeName", "customThemeFile", "matugenScheme", "runUserMatugenTemplates", "matugenTargetMonitor", "dankBarTransparency", "dankBarWidgetTransparency", "popupTransparency", "dockTransparency", "use24HourClock", "showSeconds", "useFahrenheit", "nightModeEnabled", "weatherLocation", "weatherCoordinates", "useAutoLocation", "weatherEnabled", "showLauncherButton", "showWorkspaceSwitcher", "showFocusedWindow", "showWeather", "showMusic", "showClipboard", "showCpuUsage", "showMemUsage", "showCpuTemp", "showGpuTemp", "selectedGpuIndex", "enabledGpuPciIds", "showSystemTray", "showClock", "showNotificationButton", "showBattery", "showControlCenterButton", "controlCenterShowNetworkIcon", "controlCenterShowBluetoothIcon", "controlCenterShowAudioIcon", "controlCenterWidgets", "showWorkspaceIndex", "workspaceScrolling", "showWorkspacePadding", "showWorkspaceApps", "maxWorkspaceIcons", "workspacesPerMonitor", "workspaceNameIcons", "waveProgressEnabled", "clockCompactMode", "focusedWindowCompactMode", "runningAppsCompactMode", "keyboardLayoutNameCompactMode", "runningAppsCurrentWorkspace", "runningAppsGroupByApp", "clockDateFormat", "lockDateFormat", "mediaSize", "dankBarLeftWidgets", "dankBarCenterWidgets", "dankBarRightWidgets", "appLauncherViewMode", "spotlightModalViewMode", "sortAppsAlphabetically", "networkPreference", "iconTheme", "launcherLogoMode", "launcherLogoCustomPath", "launcherLogoColorOverride", "launcherLogoColorInvertOnMode", "launcherLogoBrightness", "launcherLogoContrast", "launcherLogoSizeOffset", "fontFamily", "monoFontFamily", "fontWeight", "fontScale", "dankBarFontScale", "notepadUseMonospace", "notepadFontFamily", "notepadFontSize", "notepadShowLineNumbers", "notepadTransparencyOverride", "notepadLastCustomTransparency", "soundsEnabled", "useSystemSoundTheme", "soundNewNotification", "soundVolumeChanged", "soundPluggedIn", "gtkThemingEnabled", "qtThemingEnabled", "syncModeWithPortal", "showDock", "dockAutoHide", "dockGroupByApp", "dockOpenOnOverview", "dockPosition", "dockSpacing", "dockBottomGap", "dockIconSize", "dockIndicatorStyle", "cornerRadius", "notificationOverlayEnabled", "dankBarAutoHide", "dankBarOpenOnOverview", "dankBarVisible", "dankBarSpacing", "dankBarBottomGap", "dankBarInnerPadding", "dankBarSquareCorners", "dankBarNoBackground", "dankBarGothCornersEnabled", "dankBarBorderEnabled", "dankBarBorderColor", "dankBarBorderOpacity", "dankBarBorderThickness", "popupGapsAuto", "popupGapsManual", "dankBarPosition", "lockScreenShowPowerActions", "enableFprint", "maxFprintTries", "hideBrightnessSlider", "widgetBackgroundColor", "surfaceBase", "wallpaperFillMode", "blurredWallpaperLayer", "blurWallpaperOnOverview", "notificationTimeoutLow", "notificationTimeoutNormal", "notificationTimeoutCritical", "notificationPopupPosition", "osdAlwaysShowValue", "powerActionConfirm", "customPowerActionLock", "customPowerActionLogout", "customPowerActionSuspend", "customPowerActionHibernate", "customPowerActionReboot", "customPowerActionPowerOff", "updaterUseCustomCommand", "updaterCustomCommand", "updaterTerminalAdditionalParams", "screenPreferences", "showOnLastDisplay", "animationSpeed", "customAnimationDuration", "acMonitorTimeout", "acLockTimeout", "acSuspendTimeout", "acHibernateTimeout", "batteryMonitorTimeout", "batteryLockTimeout", "batterySuspendTimeout", "batteryHibernateTimeout", "lockBeforeSuspend", "loginctlLockIntegration", "launchPrefix", "brightnessDevicePins", "configVersion"] const validKeys = ["currentThemeName", "customThemeFile", "matugenScheme", "runUserMatugenTemplates", "matugenTargetMonitor", "dankBarTransparency", "dankBarWidgetTransparency", "popupTransparency", "dockTransparency", "use24HourClock", "showSeconds", "useFahrenheit", "nightModeEnabled", "weatherLocation", "weatherCoordinates", "useAutoLocation", "weatherEnabled", "showLauncherButton", "showWorkspaceSwitcher", "showFocusedWindow", "showWeather", "showMusic", "showClipboard", "showCpuUsage", "showMemUsage", "showCpuTemp", "showGpuTemp", "selectedGpuIndex", "enabledGpuPciIds", "showSystemTray", "showClock", "showNotificationButton", "showBattery", "showControlCenterButton", "controlCenterShowNetworkIcon", "controlCenterShowBluetoothIcon", "controlCenterShowAudioIcon", "controlCenterWidgets", "showWorkspaceIndex", "workspaceScrolling", "showWorkspacePadding", "showWorkspaceApps", "maxWorkspaceIcons", "workspacesPerMonitor", "dwlShowAllTags", "workspaceNameIcons", "waveProgressEnabled", "clockCompactMode", "focusedWindowCompactMode", "runningAppsCompactMode", "keyboardLayoutNameCompactMode", "runningAppsCurrentWorkspace", "runningAppsGroupByApp", "clockDateFormat", "lockDateFormat", "mediaSize", "dankBarLeftWidgets", "dankBarCenterWidgets", "dankBarRightWidgets", "appLauncherViewMode", "spotlightModalViewMode", "sortAppsAlphabetically", "networkPreference", "iconTheme", "launcherLogoMode", "launcherLogoCustomPath", "launcherLogoColorOverride", "launcherLogoColorInvertOnMode", "launcherLogoBrightness", "launcherLogoContrast", "launcherLogoSizeOffset", "fontFamily", "monoFontFamily", "fontWeight", "fontScale", "dankBarFontScale", "notepadUseMonospace", "notepadFontFamily", "notepadFontSize", "notepadShowLineNumbers", "notepadTransparencyOverride", "notepadLastCustomTransparency", "soundsEnabled", "useSystemSoundTheme", "soundNewNotification", "soundVolumeChanged", "soundPluggedIn", "gtkThemingEnabled", "qtThemingEnabled", "syncModeWithPortal", "showDock", "dockAutoHide", "dockGroupByApp", "dockOpenOnOverview", "dockPosition", "dockSpacing", "dockBottomGap", "dockIconSize", "dockIndicatorStyle", "cornerRadius", "notificationOverlayEnabled", "dankBarAutoHide", "dankBarOpenOnOverview", "dankBarVisible", "dankBarSpacing", "dankBarBottomGap", "dankBarInnerPadding", "dankBarSquareCorners", "dankBarNoBackground", "dankBarGothCornersEnabled", "dankBarBorderEnabled", "dankBarBorderColor", "dankBarBorderOpacity", "dankBarBorderThickness", "popupGapsAuto", "popupGapsManual", "dankBarPosition", "lockScreenShowPowerActions", "enableFprint", "maxFprintTries", "hideBrightnessSlider", "widgetBackgroundColor", "surfaceBase", "wallpaperFillMode", "blurredWallpaperLayer", "blurWallpaperOnOverview", "notificationTimeoutLow", "notificationTimeoutNormal", "notificationTimeoutCritical", "notificationPopupPosition", "osdAlwaysShowValue", "powerActionConfirm", "customPowerActionLock", "customPowerActionLogout", "customPowerActionSuspend", "customPowerActionHibernate", "customPowerActionReboot", "customPowerActionPowerOff", "updaterUseCustomCommand", "updaterCustomCommand", "updaterTerminalAdditionalParams", "screenPreferences", "showOnLastDisplay", "animationSpeed", "customAnimationDuration", "acMonitorTimeout", "acLockTimeout", "acSuspendTimeout", "acHibernateTimeout", "batteryMonitorTimeout", "batteryLockTimeout", "batterySuspendTimeout", "batteryHibernateTimeout", "lockBeforeSuspend", "loginctlLockIntegration", "launchPrefix", "brightnessDevicePins", "configVersion"]
try { try {
const content = settingsFile.text() const content = settingsFile.text()
@@ -1270,6 +1273,11 @@ Singleton {
saveSettings() saveSettings()
} }
function setDwlShowAllTags(enabled) {
dwlShowAllTags = enabled
saveSettings()
}
function setWorkspaceNameIcon(workspaceName, iconData) { function setWorkspaceNameIcon(workspaceName, iconData) {
var iconMap = JSON.parse(JSON.stringify(workspaceNameIcons)) var iconMap = JSON.parse(JSON.stringify(workspaceNameIcons))
iconMap[workspaceName] = iconData iconMap[workspaceName] = iconData

View File

@@ -576,10 +576,13 @@ Item {
return monitorWorkspaces.sort((a, b) => a.id - b.id) return monitorWorkspaces.sort((a, b) => a.id - b.id)
} else if (CompositorService.isDwl) { } else if (CompositorService.isDwl) {
if (!DwlService.dwlAvailable || DwlService.tagCount === 0) { if (!DwlService.dwlAvailable) {
return Array.from({length: 9}, (_, i) => i) return [0]
} }
return Array.from({length: DwlService.tagCount}, (_, i) => i) if (SettingsData.dwlShowAllTags) {
return Array.from({length: DwlService.tagCount}, (_, i) => i)
}
return DwlService.getVisibleTags(barWindow.screenName)
} else if (CompositorService.isSway) { } else if (CompositorService.isSway) {
const workspaces = I3.workspaces?.values || [] const workspaces = I3.workspaces?.values || []
if (workspaces.length === 0) return [{"num": 1}] if (workspaces.length === 0) return [{"num": 1}]

View File

@@ -278,15 +278,23 @@ Item {
const output = DwlService.getOutputState(root.screenName) const output = DwlService.getOutputState(root.screenName)
if (!output || !output.tags || output.tags.length === 0) { if (!output || !output.tags || output.tags.length === 0) {
const tagCount = DwlService.tagCount || 9 return [{"tag": 0}]
const tags = []
for (let i = 0; i < tagCount; i++) {
tags.push({"tag": i})
}
return tags
} }
return output.tags.map(tag => ({"tag": tag.tag, "state": tag.state, "clients": tag.clients, "focused": tag.focused})) if (SettingsData.dwlShowAllTags) {
return output.tags.map(tag => ({"tag": tag.tag, "state": tag.state, "clients": tag.clients, "focused": tag.focused}))
}
const visibleTagIndices = DwlService.getVisibleTags(root.screenName)
return visibleTagIndices.map(tagIndex => {
const tagData = output.tags.find(t => t.tag === tagIndex)
return {
"tag": tagIndex,
"state": tagData?.state ?? 0,
"clients": tagData?.clients ?? 0,
"focused": tagData?.focused ?? false
}
})
} }
function getDwlActiveTag() { function getDwlActiveTag() {

View File

@@ -138,6 +138,17 @@ Item {
return SettingsData.setWorkspacesPerMonitor(checked); return SettingsData.setWorkspacesPerMonitor(checked);
} }
} }
DankToggle {
width: parent.width
text: I18n.tr("Show All Tags")
description: I18n.tr("Show all 9 tags instead of only occupied tags (DWL only)")
checked: SettingsData.dwlShowAllTags
visible: CompositorService.isDwl
onToggled: checked => {
return SettingsData.setDwlShowAllTags(checked);
}
}
} }
} }

View File

@@ -3,13 +3,14 @@ pragma ComponentBehavior: Bound
import QtQuick import QtQuick
import Quickshell import Quickshell
import Quickshell.Io
Singleton { Singleton {
id: root id: root
property bool dwlAvailable: false property bool dwlAvailable: false
property var outputs: ({}) property var outputs: ({})
property var tagCount: 0 property var tagCount: 9
property var layouts: [] property var layouts: []
property string activeOutput: "" property string activeOutput: ""
property var outputScales: ({}) property var outputScales: ({})
@@ -39,15 +40,9 @@ Singleton {
if (DMSService.dmsAvailable) { if (DMSService.dmsAvailable) {
checkCapabilities() checkCapabilities()
} }
refreshOutputScales() if (dwlAvailable) {
} refreshOutputScales()
}
Timer {
id: scaleRefreshTimer
interval: 2000
repeat: true
running: dwlAvailable
onTriggered: refreshOutputScales()
} }
function checkCapabilities() { function checkCapabilities() {
@@ -61,6 +56,7 @@ Singleton {
dwlAvailable = true dwlAvailable = true
console.info("DwlService: DWL capability detected") console.info("DwlService: DWL capability detected")
requestState() requestState()
refreshOutputScales()
} else if (!hasDwl) { } else if (!hasDwl) {
dwlAvailable = false dwlAvailable = false
} }
@@ -80,7 +76,7 @@ Singleton {
function handleStateUpdate(state) { function handleStateUpdate(state) {
outputs = state.outputs || {} outputs = state.outputs || {}
tagCount = state.tagCount || 0 tagCount = state.tagCount || 9
layouts = state.layouts || [] layouts = state.layouts || []
activeOutput = state.activeOutput || "" activeOutput = state.activeOutput || ""
stateChanged() stateChanged()
@@ -178,30 +174,71 @@ Singleton {
Quickshell.execDetached(["mmsg", "-d", "quit"]) Quickshell.execDetached(["mmsg", "-d", "quit"])
} }
function refreshOutputScales() { Process {
if (!dwlAvailable) return id: scaleQueryProcess
command: ["wlr-randr", "--json"]
running: false
Proc.runCommand("wlr-randr", ["--json"], (output, exitCode) => { stdout: StdioCollector {
onStreamFinished: {
try {
const outputData = JSON.parse(text)
const newScales = {}
for (const outputInfo of outputData) {
if (outputInfo.name && outputInfo.scale !== undefined) {
newScales[outputInfo.name] = outputInfo.scale
}
}
outputScales = newScales
} catch (e) {
console.warn("DwlService: Failed to parse wlr-randr output:", e)
}
}
}
onExited: exitCode => {
if (exitCode !== 0) { if (exitCode !== 0) {
console.warn("DwlService: wlr-randr failed with exit code:", exitCode) console.warn("DwlService: wlr-randr failed with exit code:", exitCode)
return
} }
try { }
const outputData = JSON.parse(output) }
const newScales = {}
for (const outputInfo of outputData) { function refreshOutputScales() {
if (outputInfo.name && outputInfo.scale !== undefined) { if (!dwlAvailable) return
newScales[outputInfo.name] = outputInfo.scale scaleQueryProcess.running = true
}
}
outputScales = newScales
} catch (e) {
console.warn("DwlService: Failed to parse wlr-randr output:", e)
}
}, 0)
} }
function getOutputScale(outputName) { function getOutputScale(outputName) {
return outputScales[outputName] return outputScales[outputName]
} }
function getVisibleTags(outputName) {
const output = getOutputState(outputName)
if (!output || !output.tags) {
return [0]
}
const occupiedTags = output.tags
.filter(tag => tag.clients > 0)
.map(tag => tag.tag)
.sort((a, b) => a - b)
if (occupiedTags.length === 0) {
return [0]
}
const minTag = occupiedTags[0]
const maxTag = occupiedTags[occupiedTags.length - 1]
const visibleTags = []
for (let i = minTag; i <= maxTag; i++) {
visibleTags.push(i)
}
if (maxTag + 1 < tagCount) {
visibleTags.push(maxTag + 1)
}
return visibleTags
}
} }

View File

@@ -47,7 +47,7 @@ Suggests: qt6ct
%description %description
DankMaterialShell (DMS) is a modern Wayland desktop shell built with Quickshell DankMaterialShell (DMS) is a modern Wayland desktop shell built with Quickshell
and optimized for the niri and hyprland compositors. Features notifications, and optimized for the niri, hyprland, sway, and dwl (MangoWC) compositors. Features notifications,
app launcher, wallpaper customization, and fully customizable with plugins. app launcher, wallpaper customization, and fully customizable with plugins.
Includes auto-theming for GTK/Qt apps with matugen, 20+ customizable widgets, Includes auto-theming for GTK/Qt apps with matugen, 20+ customizable widgets,