fix: resolve dock item drag position accumulation and Flatpak application launching
This commit is contained in:
parent
676819cecb
commit
8d4612d83a
@ -217,9 +217,8 @@ Item {
|
|||||||
|
|
||||||
onPositionChanged: (mouse) => {
|
onPositionChanged: (mouse) => {
|
||||||
if (pressed && (mouse.buttons & Qt.LeftButton)) {
|
if (pressed && (mouse.buttons & Qt.LeftButton)) {
|
||||||
var delta = mouse.x - pressStartX
|
dragXOffset = mouse.x - pressStartX
|
||||||
dragXOffset += delta
|
if (Math.abs(dragXOffset) > 6) {
|
||||||
if (Math.abs(dragXOffset) > 8) {
|
|
||||||
isDragActive = true
|
isDragActive = true
|
||||||
}
|
}
|
||||||
dockRow.activeDragXOffset = dragXOffset
|
dockRow.activeDragXOffset = dragXOffset
|
||||||
@ -244,19 +243,15 @@ Item {
|
|||||||
TaskService.reorderPinnedApps(index, targetIndex)
|
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) {
|
} else if (mouse.button === Qt.RightButton) {
|
||||||
root.contextTargetApp = modelData
|
root.contextTargetApp = modelData
|
||||||
root.contextTargetX = Math.round(dockItem.mapToItem(null, 0, 0).x)
|
root.contextTargetX = Math.round(dockItem.mapToItem(null, 0, 0).x)
|
||||||
PopupService.toggleDockMenu()
|
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)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -150,13 +150,14 @@ Item {
|
|||||||
}
|
}
|
||||||
root.activeAppId = execCmd.toLowerCase()
|
root.activeAppId = execCmd.toLowerCase()
|
||||||
|
|
||||||
if (execCmd.startsWith("org.") || execCmd.startsWith("io.") || execCmd.startsWith("com.")) {
|
// Handle flatpak / desktop ID vs raw command execution safely using shell wrapper
|
||||||
Quickshell.execDetached(["gtk-launch", execCmd])
|
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 {
|
} else {
|
||||||
let parts = execCmd.split(/\s+/).filter(p => p !== "")
|
Quickshell.execDetached(["sh", "-c", execCmd + " &"])
|
||||||
if (parts.length > 0) {
|
|
||||||
Quickshell.execDetached(parts)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user