[Ft. Request] NOTIFICATION.MENUCOMMAND
The docs mention an ENUM for MENUCOMMAND, and a method notepad.menuCommand, however it seems impossible to hook into this event with NOTIFICATION. It doesn't seem possible to hook into any generic menucommand.
The NOTIFICATION would ideally be hooked on like so:
def listener(cmd, *args):
# cmd would be one of the available MENUCOMMAND enum entries
# in this case args would have the full folder path (or w/e NPP sends as input to the command) as first index
if cmd == MENUCOMMAND.FILE_OPENFOLDERASWORKSPACE:
print(args[0]); # C:\Users\xxxxxx\Documents\my-dev-project
notepad.callback(listener, [NOTIFICATION.MENUCOMMAND])
Context of current use case:
I would like to write a Pythonscript that reads the .gitignore file in the root of a folder opened as workspace, then sets the hidden attribute to all files and folders defined in it (this is currently the only way to make Notepad++ skip indexing these files/folders).
@webketje The available notifications are defined by N++ itself, see https://github.com/bruderstein/PythonScript/blob/master/NppPlugin/include/Notepad_plus_msgs.h#L472-L614 , so this can't be changed just at python plugin side and would require a feature request for N++ itself at https://github.com/notepad-plus-plus/notepad-plus-plus/issues. Maybe you could ask this question also at https://community.notepad-plus-plus.org/, if a workaround for this use case is possible with the currently available functionality. There are some guys around using pythonscript more extensively than myself.