mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2025-12-05 21:15:38 -05:00
dwl: dont show empty tags
This commit is contained in:
@@ -510,22 +510,25 @@ Item {
|
|||||||
hoverEnabled: !isPlaceholder
|
hoverEnabled: !isPlaceholder
|
||||||
cursorShape: isPlaceholder ? Qt.ArrowCursor : Qt.PointingHandCursor
|
cursorShape: isPlaceholder ? Qt.ArrowCursor : Qt.PointingHandCursor
|
||||||
enabled: !isPlaceholder
|
enabled: !isPlaceholder
|
||||||
|
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||||
onClicked: mouse => {
|
onClicked: mouse => {
|
||||||
if (isPlaceholder) {
|
if (isPlaceholder) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const isRightClick = mouse.button === Qt.RightButton
|
||||||
|
|
||||||
if (CompositorService.isNiri) {
|
if (CompositorService.isNiri) {
|
||||||
NiriService.switchToWorkspace(modelData - 1)
|
NiriService.switchToWorkspace(modelData - 1)
|
||||||
} 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) {
|
||||||
console.log("DWL tag clicked:", modelData.tag, "modifiers:", mouse.modifiers, "ctrl:", (mouse.modifiers & Qt.ControlModifier))
|
console.log("DWL click - tag:", modelData.tag, "rightClick:", isRightClick)
|
||||||
if (mouse.modifiers & Qt.ControlModifier) {
|
if (isRightClick) {
|
||||||
console.log("Using toggleTag for tag", modelData.tag)
|
console.log("Calling toggleTag")
|
||||||
DwlService.toggleTag(root.screenName, modelData.tag)
|
DwlService.toggleTag(root.screenName, modelData.tag)
|
||||||
} else {
|
} else {
|
||||||
console.log("Using switchToTag for tag", modelData.tag)
|
console.log("Calling switchToTag")
|
||||||
DwlService.switchToTag(root.screenName, modelData.tag)
|
DwlService.switchToTag(root.screenName, modelData.tag)
|
||||||
}
|
}
|
||||||
} else if (CompositorService.isSway && modelData?.num) {
|
} else if (CompositorService.isSway && modelData?.num) {
|
||||||
|
|||||||
@@ -166,8 +166,31 @@ Singleton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function toggleTag(outputName, tagIndex) {
|
function toggleTag(outputName, tagIndex) {
|
||||||
const tagmask = 1 << tagIndex
|
const output = getOutputState(outputName)
|
||||||
setTags(outputName, tagmask, 1)
|
if (!output || !output.tags) {
|
||||||
|
console.log("toggleTag: no output or tags for", outputName)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
let currentMask = 0
|
||||||
|
output.tags.forEach(tag => {
|
||||||
|
if (tag.state === 1) {
|
||||||
|
currentMask |= (1 << tag.tag)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const clickedMask = 1 << tagIndex
|
||||||
|
const newMask = currentMask ^ clickedMask
|
||||||
|
|
||||||
|
console.log("toggleTag:", outputName, "tag:", tagIndex, "currentMask:", currentMask.toString(2), "clickedMask:", clickedMask.toString(2), "newMask:", newMask.toString(2))
|
||||||
|
|
||||||
|
if (newMask === 0) {
|
||||||
|
console.log("toggleTag: newMask is 0, switching to tag", tagIndex)
|
||||||
|
setTags(outputName, 1 << tagIndex, 0)
|
||||||
|
} else {
|
||||||
|
console.log("toggleTag: setting combined mask", newMask)
|
||||||
|
setTags(outputName, newMask, 0)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function quit() {
|
function quit() {
|
||||||
@@ -223,32 +246,14 @@ Singleton {
|
|||||||
return [0]
|
return [0]
|
||||||
}
|
}
|
||||||
|
|
||||||
const activeTags = output.tags
|
const visibleTags = new Set([0])
|
||||||
.filter(tag => tag.state === 1)
|
|
||||||
.map(tag => tag.tag)
|
|
||||||
|
|
||||||
const occupiedTags = output.tags
|
output.tags.forEach(tag => {
|
||||||
.filter(tag => tag.clients > 0)
|
if (tag.state === 1 || tag.clients > 0) {
|
||||||
.map(tag => tag.tag)
|
visibleTags.add(tag.tag)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
const combinedTags = [...new Set([...activeTags, ...occupiedTags])].sort((a, b) => a - b)
|
return Array.from(visibleTags).sort((a, b) => a - b)
|
||||||
|
|
||||||
if (combinedTags.length === 0) {
|
|
||||||
return [0]
|
|
||||||
}
|
|
||||||
|
|
||||||
const minTag = combinedTags[0]
|
|
||||||
const maxTag = combinedTags[combinedTags.length - 1]
|
|
||||||
|
|
||||||
const visibleTags = []
|
|
||||||
for (let i = minTag; i <= maxTag; i++) {
|
|
||||||
visibleTags.push(i)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (maxTag + 1 < tagCount) {
|
|
||||||
visibleTags.push(maxTag + 1)
|
|
||||||
}
|
|
||||||
|
|
||||||
return visibleTags
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" fill="#fff">
|
|
||||||
<path fill-rule="evenodd" style="shape-rendering:geometricPrecision" d="M580 70q8-3 15 2l15 58 20 60 20 50q8 7 30 12l40 13 35 13q19 9 10 17l-145 2-160-2h-80l-35 13q-6 8 5 12l55-10q-1-8 5-8l110 2 30 10 40-4 10-4 100-2q8 0 8 6t-6 8v22l-4 30-8 25q-7 11-30 15l40 15 70 15q21 7 20 22 1 14-20 18l-130 2-5 18-10 40-5 40q-7 31-30 55a48 48 0 0 1-40 13l-70-28-80-45-60-45-12-30-10-60-6-60q0-21 6-50l-73-2q-19-3-13-18l28-15 60-20 15-40 25-95 10-40q8-24 30-25l80 7h40l25-6Zm-135 130 95 2 90 8 12 30-32-2-90-3-110 3-50 6-15-29 25-9Zm120 135q8-4 13 3l17 27 15 20q15 15 45 30l50 17 65 16q15 6 15 17 0 5-15 5l-130-5-60-10-60-3q-15 0-28-6-6-6-4-18l12-18 30-25 15-25Zm-143 0q3 5 6 20l7 25q8 15 30 18 5 0 5 2-15 3-28-5l-12-17-8-30Zm283-3v20l-5 23-10 15q-8 8-28 8 0-3 8-4l20-8 8-16Zm-375 218 30 50 45 70 40 60 35 70 35 55 20-55 10-60-15-30 15-20 15-15 30 20-5 25 15 50 15 60 7-50 3-60v-120l10 10 15 15 25 25 35 30 40 25-5 25-25 50-25 45-30 50-35 55-35 40-20 5-35-25-70-55-80-60-70-55-80-65-60-40 20-15 50-30 35-25 5-15 15-25Zm238-182q4 3 4 8-3 3-9 0Z"/>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 1.1 KiB |
Reference in New Issue
Block a user