How to change special shortcut via extension?

Current shorcut of dragging map is [Space + Left Mouse Button], and I really don’t like this shortcut, because when I use the shortcut, space always do the wrong thing, such as toggle the visible of current layer, and the space is not easy to press, because it’s a big and long key in the keyboard.

So I want to use [Ctrl + Left Mouse Button] to instead [Space + Left Mouse Button], but I could not found any way to do this in Preferenced.

Now I want to use a tiled.registerTool or tiled.registerAction to do this, but how could I finish the script?

My thought is, when I pressing the space key, then I also pressing the ctrl key.

/// <reference types="@mapeditor/tiled-api" />

/* global tiled */

const dragLayer = tiled.registerAction("DragLayer", function (/* action */) {
	tiled.alert(`My desired shortcut is pressing [Ctrl + Left Mounse Button] to drag map,

	but current shortcut is pressing [Space + Left Mouse Button], and how to do it?`)
dragLayer.text = "DragLayer"
dragLayer.shortcut = "Space"

tiled.extendMenu("Layer", [
	{ action: "DragLayer", before: "SelectPreviousLayer" },

And I don’t want to use Middle Mouse Button too.

You can’t change the default shortcut for this as it’s hard-coded, and Actions are one-time things, they cannot be used to implement dragging behaviour. So, what you’re trying to do is not possible via scripting; you would have to modify Tiled itself.

Scripted Tools can implement dragging behaviour because they can react to mouse movement and click events, but you’d have to switch to the tool to pan, it’s not something you’d do with a modifier.

OK, I see. Change this shortcut by script seems not convient, maybe recompile c++ code is better.

Thank you for replying.

Finally I use AutoHotKey to solve the problem, now I can use [Ctrl+LeftMouseButon] to dragging and also [Ctrl+Mouse Wheel] to zoom in and zoom out.

I think it is much more better than [Space+LeftMouseButon] and [Ctrl+Mouse Wheel], and it also could fix the bug I found (in Issue #3672)

Here is the AutoHotKey script

#IfWinActive ahk_exe tiled.exe
KeyWait, LButton, Down
SendInput , {Space Down}
KeyWait, LCtrl, U
SendInput , {Space Up}