mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2025-12-08 06:25:37 -05:00
dwl: tag changes
This commit is contained in:
@@ -36,12 +36,19 @@ Item {
|
|||||||
} else if (CompositorService.isHyprland) {
|
} else if (CompositorService.isHyprland) {
|
||||||
return getHyprlandActiveWorkspace()
|
return getHyprlandActiveWorkspace()
|
||||||
} else if (CompositorService.isDwl) {
|
} else if (CompositorService.isDwl) {
|
||||||
return getDwlActiveTag()
|
const activeTags = getDwlActiveTags()
|
||||||
|
return activeTags.length > 0 ? activeTags[0] : 0
|
||||||
} else if (CompositorService.isSway) {
|
} else if (CompositorService.isSway) {
|
||||||
return getSwayActiveWorkspace()
|
return getSwayActiveWorkspace()
|
||||||
}
|
}
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
property var dwlActiveTags: {
|
||||||
|
if (CompositorService.isDwl) {
|
||||||
|
return getDwlActiveTags()
|
||||||
|
}
|
||||||
|
return []
|
||||||
|
}
|
||||||
property var workspaceList: {
|
property var workspaceList: {
|
||||||
if (CompositorService.isNiri) {
|
if (CompositorService.isNiri) {
|
||||||
const baseList = getNiriWorkspaces()
|
const baseList = getNiriWorkspaces()
|
||||||
@@ -297,18 +304,13 @@ Item {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDwlActiveTag() {
|
function getDwlActiveTags() {
|
||||||
if (!DwlService.dwlAvailable) {
|
if (!DwlService.dwlAvailable) {
|
||||||
return 0
|
return [0]
|
||||||
}
|
}
|
||||||
|
|
||||||
const output = DwlService.getOutputState(root.screenName)
|
const activeTags = DwlService.getActiveTags(root.screenName)
|
||||||
if (!output || !output.tags) {
|
return activeTags.length > 0 ? activeTags : [0]
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
const activeTag = output.tags.find(tag => tag.state === 1)
|
|
||||||
return activeTag ? activeTag.tag : 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
readonly property real padding: Math.max(Theme.spacingXS, Theme.spacingS * (widgetHeight / 30))
|
readonly property real padding: Math.max(Theme.spacingXS, Theme.spacingS * (widgetHeight / 30))
|
||||||
@@ -438,7 +440,7 @@ Item {
|
|||||||
if (CompositorService.isHyprland) {
|
if (CompositorService.isHyprland) {
|
||||||
return modelData && modelData.id === root.currentWorkspace
|
return modelData && modelData.id === root.currentWorkspace
|
||||||
} else if (CompositorService.isDwl) {
|
} else if (CompositorService.isDwl) {
|
||||||
return modelData && modelData.tag === root.currentWorkspace
|
return modelData && root.dwlActiveTags.includes(modelData.tag)
|
||||||
} else if (CompositorService.isSway) {
|
} else if (CompositorService.isSway) {
|
||||||
return modelData && modelData.num === root.currentWorkspace
|
return modelData && modelData.num === root.currentWorkspace
|
||||||
}
|
}
|
||||||
@@ -508,7 +510,7 @@ Item {
|
|||||||
hoverEnabled: !isPlaceholder
|
hoverEnabled: !isPlaceholder
|
||||||
cursorShape: isPlaceholder ? Qt.ArrowCursor : Qt.PointingHandCursor
|
cursorShape: isPlaceholder ? Qt.ArrowCursor : Qt.PointingHandCursor
|
||||||
enabled: !isPlaceholder
|
enabled: !isPlaceholder
|
||||||
onClicked: {
|
onClicked: mouse => {
|
||||||
if (isPlaceholder) {
|
if (isPlaceholder) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -518,7 +520,14 @@ Item {
|
|||||||
} else if (CompositorService.isHyprland && modelData?.id) {
|
} else if (CompositorService.isHyprland && modelData?.id) {
|
||||||
Hyprland.dispatch(`workspace ${modelData.id}`)
|
Hyprland.dispatch(`workspace ${modelData.id}`)
|
||||||
} else if (CompositorService.isDwl && modelData?.tag !== undefined) {
|
} else if (CompositorService.isDwl && modelData?.tag !== undefined) {
|
||||||
DwlService.switchToTag(root.screenName, modelData.tag)
|
console.log("DWL tag clicked:", modelData.tag, "modifiers:", mouse.modifiers, "ctrl:", (mouse.modifiers & Qt.ControlModifier))
|
||||||
|
if (mouse.modifiers & Qt.ControlModifier) {
|
||||||
|
console.log("Using toggleTag for tag", modelData.tag)
|
||||||
|
DwlService.toggleTag(root.screenName, modelData.tag)
|
||||||
|
} else {
|
||||||
|
console.log("Using switchToTag for tag", modelData.tag)
|
||||||
|
DwlService.switchToTag(root.screenName, modelData.tag)
|
||||||
|
}
|
||||||
} else if (CompositorService.isSway && modelData?.num) {
|
} else if (CompositorService.isSway && modelData?.num) {
|
||||||
try { I3.dispatch(`workspace number ${modelData.num}`) } catch(_){}
|
try { I3.dispatch(`workspace number ${modelData.num}`) } catch(_){}
|
||||||
}
|
}
|
||||||
@@ -585,8 +594,16 @@ Item {
|
|||||||
radius: Theme.cornerRadius
|
radius: Theme.cornerRadius
|
||||||
color: isActive ? Theme.primary : isUrgent ? Theme.error : isPlaceholder ? Theme.surfaceTextLight : isHovered ? Theme.outlineButton : Theme.surfaceTextAlpha
|
color: isActive ? Theme.primary : isUrgent ? Theme.error : isPlaceholder ? Theme.surfaceTextLight : isHovered ? Theme.outlineButton : Theme.surfaceTextAlpha
|
||||||
|
|
||||||
border.width: isUrgent && !isActive ? 2 : 0
|
border.width: {
|
||||||
border.color: isUrgent && !isActive ? Theme.error : Theme.withAlpha(Theme.error, 0)
|
if (isUrgent && !isActive) return 2
|
||||||
|
if (CompositorService.isDwl && isActive && root.dwlActiveTags.length > 1) return 2
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
border.color: {
|
||||||
|
if (isUrgent && !isActive) return Theme.error
|
||||||
|
if (CompositorService.isDwl && isActive && root.dwlActiveTags.length > 1) return Qt.lighter(Theme.primary, 1.3)
|
||||||
|
return Theme.withAlpha(Theme.error, 0)
|
||||||
|
}
|
||||||
|
|
||||||
Behavior on width {
|
Behavior on width {
|
||||||
enabled: (!SettingsData.showWorkspaceApps || SettingsData.maxWorkspaceIcons <= 3)
|
enabled: (!SettingsData.showWorkspaceApps || SettingsData.maxWorkspaceIcons <= 3)
|
||||||
@@ -618,6 +635,13 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Behavior on border.color {
|
||||||
|
ColorAnimation {
|
||||||
|
duration: Theme.shortDuration
|
||||||
|
easing.type: Theme.emphasizedEasing
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Loader {
|
Loader {
|
||||||
id: appIconsLoader
|
id: appIconsLoader
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|||||||
@@ -218,17 +218,22 @@ Singleton {
|
|||||||
return [0]
|
return [0]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const activeTags = output.tags
|
||||||
|
.filter(tag => tag.state === 1)
|
||||||
|
.map(tag => tag.tag)
|
||||||
|
|
||||||
const occupiedTags = output.tags
|
const occupiedTags = output.tags
|
||||||
.filter(tag => tag.clients > 0)
|
.filter(tag => tag.clients > 0)
|
||||||
.map(tag => tag.tag)
|
.map(tag => tag.tag)
|
||||||
.sort((a, b) => a - b)
|
|
||||||
|
|
||||||
if (occupiedTags.length === 0) {
|
const combinedTags = [...new Set([...activeTags, ...occupiedTags])].sort((a, b) => a - b)
|
||||||
|
|
||||||
|
if (combinedTags.length === 0) {
|
||||||
return [0]
|
return [0]
|
||||||
}
|
}
|
||||||
|
|
||||||
const minTag = occupiedTags[0]
|
const minTag = combinedTags[0]
|
||||||
const maxTag = occupiedTags[occupiedTags.length - 1]
|
const maxTag = combinedTags[combinedTags.length - 1]
|
||||||
|
|
||||||
const visibleTags = []
|
const visibleTags = []
|
||||||
for (let i = minTag; i <= maxTag; i++) {
|
for (let i = minTag; i <= maxTag; i++) {
|
||||||
|
|||||||
Reference in New Issue
Block a user