moudey / Shell

Powerful context menu manager for Windows File Explorer
https://nilesoft.org
MIT License
3.76k stars 124 forks source link

[Question] Is there a way to have a default click action for a menu? #500

Open CatsArmy opened 3 months ago

CatsArmy commented 3 months ago

ive tried:

menu(mode="multiple" separator="after" title=title.copy_path image=icon.copy_path)
    {
        item(where=sel.count > 1 title='Copy (@sel.count) items selected' cmd=@clipboard.set(sel(false, "\n")) keys ='@sel(false, "\n")' image=icon.copy_path)
        separator()
        //copy path
        item(mode="single" title='Copy path' cmd=@clipboard.set(sel.path) tip=sel.path image=icon.copy_path keys='@sel.path')
        //@sel.parent.len>3 == C:\ or just [Drive Letter]:\ aka not a drive
        item(mode="single" title='Copy parent path' where=@sel.parent.len>3  cmd=@clipboard.set(sel.parent) tip=sel.parent image=icon.copy_path)
        //copy file name with extension
        menu(mode="multiple" title="Copy full name" image=icon.copy_path tip=sel.file.name)
        {
            item(mode="single" title="Copy full name" where=sel.file.len != sel.file.title.len type='file|dir|back.dir|namespace' 
            cmd=@clipboard.set(sel.file.name) tip=sel.file.name image=icon.copy_path keys='@sel.file.name' vis=hidden default=true) 
            //copy name
            item(mode="single" title="Copy name" type='file' 
                cmd=@clipboard.set(sel.file.title) tip=sel.file.title image=inherit keys='@sel.file.title')
            //copy extension
            item(mode="single" title="Copy extension" type='file' where=sel.file.ext.len>0 
                cmd=@clipboard.set(sel.file.ext) tip=sel.file.ext image=inherit keys='@sel.file.ext')
        }
        item(mode="single" type='file' separator="before" find='.lnk' title='Open file location' image=icon.copy_path)
        separator
    }

ive also tried:

menu(mode="multiple" separator="after" title=title.copy_path image=icon.copy_path)
    {
        item(where=sel.count > 1 title='Copy (@sel.count) items selected' cmd=@clipboard.set(sel(false, "\n")) keys ='@sel(false, "\n")' image=icon.copy_path)
        separator()
        //copy path
        item(mode="single" title='Copy path' cmd=@clipboard.set(sel.path) tip=sel.path image=icon.copy_path keys='@sel.path')
        //@sel.parent.len>3 == C:\ or just [Drive Letter]:\ aka not a drive
        item(mode="single" title='Copy parent path' where=@sel.parent.len>3  cmd=@clipboard.set(sel.parent) tip=sel.parent image=icon.copy_path)
        //copy file name with extension
        menu(mode="multiple" title="Copy full name" where=sel.file.len != sel.file.title.len type='file|dir|back.dir|namespace' 
        cmd=@clipboard.set(sel.file.name) tip=sel.file.name image=icon.copy_path keys='@sel.file.name') 
        {
            //copy name
            item(mode="single" title="Copy name" type='file' 
                cmd=@clipboard.set(sel.file.title) tip=sel.file.title image=inherit keys='@sel.file.title')
            //copy extension
            item(mode="single" title="Copy extension" type='file' where=sel.file.ext.len>0 
                cmd=@clipboard.set(sel.file.ext) tip=sel.file.ext image=inherit keys='@sel.file.ext')
        }
        item(mode="single" type='file' separator="before" find='.lnk' title='Open file location' image=icon.copy_path)
        separator
    }
ghost commented 3 months ago

Regarding the first default=true, @RubicBG mentioned this on discord:

I think it last worked in version 1.8.1 when the whole menu was loaded at once, then moudey made the submenus load on call which made the menu run faster but apparently this method misses that option you want. I let him know but he has not found a solution by now

Regarding the second one, It's not possible to assign a command to a menu.

CatsArmy commented 3 months ago

yea i read the docs and also figured the second one wont work. welp its fine for now hope it will comeback oneday