kvichans / cuda_config_menu

CudaText plugin to make custom menu
2 stars 1 forks source link

Add to `menu.json` contents of the Tab context menu #40

Open reregaga opened 1 year ago

reregaga commented 1 year ago

@kvichans plugin "Config Menu" by pressing button "Create config file with native menu" doesn't create any other items than top-menu, top menu submenu, editor context-menu . I think it would be useful if it also have ability to create a default menu for tab header context menu and dropdown submenu of toolbar buttons, something like this:

,{"cap":"", "hint":"tab", "sub":[
     {"cap":"Close tab", "cmd":"cmd_FileClose"}
    ,{"cap":"Close", "sub":[
       {"cap":"Others (same group)","cmd":"cmd_FileCloseOtherThis"}
      ,{"cap":"Others (all groups)","cmd":"cmd_FileCloseOtherAll"}
...

So far I'm creating it manually (and then add the items I need), here's a default template if anyone needs one:

{
  {"cap":"", "hint":"tab", "sub":[
     {"cap":"Close tab", "cmd":"cmd_FileClose"}
    ,{"cap":"Close", "sub":[
       {"cap":"Others (same group)","cmd":"cmd_FileCloseOtherThis"}
      ,{"cap":"Others (all groups)","cmd":"cmd_FileCloseOtherAll"}
      ,{"cap":"All (same group)","cmd":"?"}
      ,{"cap":"All (all groups)","cmd":"cmd_FileCloseAll"}
      ,{"cap":"Left tabs (same group)","cmd":"?"}
      ,{"cap":"Right tabs (same group)","cmd":"?"}
    ]}
    ,{"cap":"-"}
    ,{"cap":"Save", "cmd":"cmd_FileSave"}
    ,{"cap":"Save as...", "cmd":"cmd_FileSaveAs"}
    ,{"cap":"-"}
    ,{"cap":"Copy to clipboard","sub":[
       {"cap":"Copy full filepath", "cmd":"cmd_CopyFilenameFull"}
      ,{"cap":"Copy filepath only", "cmd":"cmd_CopyFilenameDir"}
      ,{"cap":"Copy filename only", "cmd":"cmd_CopyFilenameName"}
    ]}
    ,{"cap":"Move tab to group","sub":[
       {"cap":"1","cmd":"cmd_MoveTabToGroup1"}
      ,{"cap":"2","cmd":"cmd_MoveTabToGroup2"}
      ,{"cap":"3","cmd":"cmd_MoveTabToGroup3"}
      ,{"cap":"4","cmd":"cmd_MoveTabToGroup4"}
      ,{"cap":"5","cmd":"cmd_MoveTabToGroup5"}
      ,{"cap":"6","cmd":"cmd_MoveTabToGroup6"}
      ,{"cap":"-"}
      ,{"cap":"Floating 1","cmd":"cmd_MoveTabToGroupFloating1"}
      ,{"cap":"Floating 2","cmd":"cmd_MoveTabToGroupFloating2"}
      ,{"cap":"Floating 3","cmd":"cmd_MoveTabToGroupFloating3"}
      ,{"cap":"-"}
      ,{"cap":"Next","cmd":"cmd_MoveTabToGroupNext"}
      ,{"cap":"Previous","cmd":"cmd_MoveTabToGroupPrev"}
    ]}
    ,{"cap":"Pinned","cmd":"cmd_ToggleTabPinned"}
    ,{"cap":"Set tab color...","cmd":"cmd_SetTabColor"}
  ]}
}

Note: "?" are put in place of commands that I could not find.

Alexey-T commented 1 year ago

this cannot be done 100% correct. because tab-context-menu items do not map to commands. they have special pascal handlers which handle right-click on passive tabs. but commands - work always on the active tab.

so internally, tab-context-menu items do not map to commands. so menu.json cannot be filled for tab-menu.