shell.nss mod with Virtual Container

Ready-made snippets of menu items you can quickly insert into your config file.


Post Reply
Rubic
Posts: 15
Joined: Fri Jan 19, 2024 2:41 pm

shell.nss mod with Virtual Container

Post by Rubic »

shell.nss mod

settings
{
	priority=1
	exclude.where = !process.is_explorer
	showdelay = 200
	// Options to allow modification of system items
	modify.remove.duplicate=1
	tip.enabled=true
}

import 'imports/theme.nss'
import 'imports/images.nss'

import 'imports/modify.nss'

menu(mode="multiple" title="Pin/Unpin" image=icon.pin)
{
}

menu(mode="multiple" title=title.more_options image=icon.more_options)
{
}

menu(mode='multiple' expanded='true' where=not(wnd.is_desktop and sel.type==0)
	and sel.raw!='::{645FF040-5081-101B-9F08-00AA002F954E}' 
	and sel.parent.raw!='::{645FF040-5081-101B-9F08-00AA002F954E}')
{
	import 'imports/terminal.nss'
	import 'imports/file-manage.nss'
	import 'imports/develop.nss'
	import 'imports/goto.nss'
}

menu(type='*' where=wnd.is_taskbar expanded='true')
{
	import 'imports/terminal.nss'
	separator()
	import 'imports/taskbar.nss'
}

Virtual Container
The concept of a "Virtual Container" isn't a novel, undocumented idea. This term refers to a scenario where an item of type menu(), possessing the property expanded="true", is combined with an item of type import.

Here's an example:

menu(expanded='true')
{
	import 'file.nss'
}

You can learn more about the expanded property and items here:
https://nilesoft.org/docs/configuration ... s#expanded
https://nilesoft.org/docs/configuration/new-items

Virtual Container #1
This virtual container for the primary context menu. It's structured as follows:

menu(mode='multiple' expanded='true' where=not(wnd.is_desktop and sel.type==0)
	and sel.raw!='::{645FF040-5081-101B-9F08-00AA002F954E}' 
	and sel.parent.raw!='::{645FF040-5081-101B-9F08-00AA002F954E}')
{
	import 'imports/terminal.nss'
	import 'imports/file-manage.nss'
	import 'imports/develop.nss'
	import 'imports/goto.nss'
}
  • mode='multiple' - Without this property, when multiple files are selected, all items within the virtual container won't be displayed.

  • where=not(wnd.is_desktop and sel.type==0) - This restricts displaying menus/items imported from files on system icons on the desktop like Recycle Bin and Windows Spotlight.

    recycle bin 1.png
    recycle bin 1.png (10.33 KiB) Viewed 1654 times
    spotlight.png
    spotlight.png (40.05 KiB) Viewed 1654 times
  • where=sel.raw!='::{645FF040-5081-101B-9F08-00AA002F954E}' and sel.parent.raw!='::{645FF040-5081-101B-9F08-00AA002F954E}' - This further limits the display of menus/items from imported files in the context menu of the Recycle Bin.

    recycle bin 2.png
    recycle bin 2.png (21.91 KiB) Viewed 1654 times
    recycle bin 3.png
    recycle bin 3.png (44.27 KiB) Viewed 1654 times

Virtual Container #2
This virtual container is for the context menu on the taskbar:

menu(type='*' where=wnd.is_taskbar expanded='true')
{
	import 'imports/terminal.nss'
	separator()
	import 'imports/taskbar.nss'
}
  • import 'imports/terminal.nss' - virtual containers restrict the code to apply only to the same container. In this case, if the import of 'terminal.nss' is not duplicated, it will only appear in the main menu.

  • separator() - The separators in the virtual container are always visible. This helps avoid situations where a separator might be missing if it is described as a property in a menu/item, and for a given case, the menu/item is not visualized.

More Features

  • Each virtual container has its arrangement, allowing for customized configurations tailored to specific use cases.
  • If type= isn't specified in the code, the import can be moved from container to container without needing to edit the code itself.

Disadvantages

  • Properties like Title, Tip, Separator, Position, Column, and others are ignored when expanded="true" is set.
  • Duplicating imports doesn't affect the speed of opening the context menu but impacts the code reloading speed.
Post Reply