fix: resolve dock item drag position accumulation and Flatpak application launching

This commit is contained in:
Sho 2026-08-01 23:27:13 +09:00
parent 676819cecb
commit 8d4612d83a
2 changed files with 12 additions and 16 deletions

View File

@ -217,9 +217,8 @@ Item {
onPositionChanged: (mouse) => {
if (pressed && (mouse.buttons & Qt.LeftButton)) {
var delta = mouse.x - pressStartX
dragXOffset += delta
if (Math.abs(dragXOffset) > 8) {
dragXOffset = mouse.x - pressStartX
if (Math.abs(dragXOffset) > 6) {
isDragActive = true
}
dockRow.activeDragXOffset = dragXOffset
@ -244,19 +243,15 @@ Item {
TaskService.reorderPinnedApps(index, targetIndex)
}
}
} else if (mouse.button === Qt.LeftButton) {
let globalPos = dockItem.mapToItem(null, 0, 0)
TaskService.focusApp(modelData.appId, modelData.cmd, globalPos.x, globalPos.y)
} else if (mouse.button === Qt.RightButton) {
root.contextTargetApp = modelData
root.contextTargetX = Math.round(dockItem.mapToItem(null, 0, 0).x)
PopupService.toggleDockMenu()
}
}
onClicked: (mouse) => {
if (mouse.button === Qt.LeftButton && !isDragActive) {
let globalPos = dockItem.mapToItem(null, 0, 0)
TaskService.focusApp(modelData.appId, modelData.cmd, globalPos.x, globalPos.y)
}
}
}
}
}

View File

@ -150,13 +150,14 @@ Item {
}
root.activeAppId = execCmd.toLowerCase()
if (execCmd.startsWith("org.") || execCmd.startsWith("io.") || execCmd.startsWith("com.")) {
Quickshell.execDetached(["gtk-launch", execCmd])
// Handle flatpak / desktop ID vs raw command execution safely using shell wrapper
if (execCmd.startsWith("flatpak run ") || execCmd.includes("flatpak ")) {
Quickshell.execDetached(["sh", "-c", execCmd + " &"])
} else if ((execCmd.startsWith("org.") || execCmd.startsWith("io.") || execCmd.startsWith("com.") || execCmd.startsWith("app.")) && !execCmd.includes(" ")) {
let desktopName = execCmd.replace(/\.desktop$/, "")
Quickshell.execDetached(["sh", "-c", "flatpak run " + desktopName + " 2>/dev/null || gtk-launch " + desktopName + " 2>/dev/null || gtk-launch " + desktopName + ".desktop 2>/dev/null || " + execCmd + " &"])
} else {
let parts = execCmd.split(/\s+/).filter(p => p !== "")
if (parts.length > 0) {
Quickshell.execDetached(parts)
}
Quickshell.execDetached(["sh", "-c", execCmd + " &"])
}
}