Nilesoft Shell GitHub

Syntax Rules for Configuration Files


This chapter describes the syntax rules for the configuration files.

The main configuration file shell.nss is located in the installation directory of Shell, depending on your installation method.

General rules
  • Syntax is case-insensitive.
  • Spaces around the equal (=) sign are optional and are ignored.
  • The properties of modify-items and new-items items are separated by blank spaces or on a separate line and must be placed in parentheses ( ).
  • Other configuration files can be imported using the import tag.
Tip: When there is an error, it is recorded in the log file (shell.log, which is also located in your installation directory.).
shell.nss structure

The global section shell{} may have the following subsections:

Example
// variable declaration
$variable-name = variable-value

//image declaration
@image-id = image-value
	
settings
{
	key-name = key-value
	key-name = [key-value, key-value, ...]
	...
}

theme
{
	key-name = key-value
	...
}

// modify items
modify ( property-name = property-value   ... )
remove ( property-name = property-value   ... )

// new items

item ( property-name = property-value   ... )

separator [( property-name = property-value   ... )]

menu ( property-name = property-value   ... )
{
	$variable-name = variable-value
	
	item ( property-name = property-value   ... )
	...
}

Breaking Long Lines

For best readability, users often like to avoid lines longer than 80 characters. single quotes also allow break up a line.

item(title='Command prompt'
	cmd='cmd.exe')

Import tag

To better organise the configuration file, parts of the configuration can be saved in separate files. These are then imported using the import tag. With this method, it is also possible to import the same file as a sort of "module" into different parts of the configuration. A convenient way to include the same sub-menu in different locations..

Syntax

The general syntax is as follows:

import %path%
%section% import %path%
import lang %path%

Where

  • %section% is the name of a section. Optional. If given, it must be settings or theme. The section name is written literally, without any quotes (or the percent signs), and it comes before import: settings import %path%, not import settings %path%.
  • lang (or loc), written right after import, imports a language file: lines of name="text" that titles use as loc.name.
  • %path% is a string literal, that returns the path to the config file that shall be imported. This can be a relative path to the location of the file where the import tag is used, or it can be an absolute path. Expressions are supported when using single quotes.

There are effectively two different ways this tag is applied, depending on whether the optional %section% is given:

  • Import an entire section
  • Import as a partial
Import an entire section
// import an entire section
%section% import %path%
In this case, the content of the file found at %path% will be imported into a newly created %section%{}. The result would then look like so:
// import an entire section
%section% {
	/* content of the imported file goes here! Do not include
	 *
	 * %section% {
	 * }
	 *
	 * in your imported file!
	 */
}

For example, with this in imports/my-settings.nss:

priority=1
showdelay=200

this line in shell.nss:

settings import 'imports/my-settings.nss'

is the same as writing:

settings
{
	priority=1
	showdelay=200
}

This syntax may be used only at the top level of the configuration, with settings or theme. Sub-sections such as settings.tip or theme.background cannot be imported this way.

Import as a partial
section {
	// some code might go here. Optional.

	// import of a partial section
	import %path%

	// some more content might go here. Optional.
}
In this case, the content of the file found at %path% will be imported into the already existing section{}. The result would then look like so:
section {
	// some code might go here. Optional.

	// import of a partial section
	/* content of the imported file goes here! Do not include
	 *
	 * section {
	 * }
	 *
	 * in your imported file!
	 */

	// some more content might go here. Optional.
}

This syntax may be used nearly anywhere: