Sublime Forum

How to detect click in sidebar region?

#1

When using sublime.log_commands(True), mouse events can be detected like the following : command: drag_select {"event": {"button": 1, "x": 86.5, "y": 16.5}} in upper side of sidebar region. But EventListener can not catch, is it intended ? or is there anyway to solve it ? Overriding Default.sublime-mousemap is working, but it is not good for me.

0 Likes

#2

Why do you need the click event of the sidebar?

Most likely you’d create a WindowCommand and add an item for it in the context menu of the sidebar. Running the command from the sidebar’s context menu would provide a list of all selected files to run the command for.

Your WindowCommand just needs to define a paths argument for that. The following example shows the item of “rename_path” command as provided by the Default package.

{ "caption": "Rename…", "command": "rename_path", "args": {"paths": []} },
0 Likes

#3

Thanks for reply.
But I know how to use the context menu on sidebar, it only can be activated over file list. I need sidebar container region (rectangle below) out of the file list.

When using Default.sublime-mousemap, the event can be passed for other commands ?

0 Likes

#4

The mousemap is used to map mouse buttons or combinations of mouse and keyboard buttons to commands.

I guess there is no API for what you intend to do as the GUI is not designed to create custom controls via themes to interact with.

0 Likes