Nilesoft Shell 配置指南
Nilesoft Shell 是 Windows 文件资源管理器的扩展,用于创建高性能的右键菜单项。支持自定义菜单结构、主题、图标等。
一、安装
安装方式
| 方式 | 命令 |
|---|---|
| 安装版 | 运行 setup.exe,按步骤安装 |
| 便携版 | 运行 setup.exe,勾选 Portable Mode,然后管理员运行 shell -register -restart |
| winget | winget install Nilesoft.Shell |
| Scoop | scoop install nilesoft-shell |
| Chocolatey | choco install nilesoft.shell |
命令行选项
-register (-r)— 注册-unregister (-u)— 取消注册-restart (-re)— 重启资源管理器-treat— 禁用 Windows 11 右键菜单-silent (-s)— 静默模式
快捷键(右键时按住)
Ctrl— 启用并重新加载配置Win— 优先显示 Windows 11 现代右键菜单Ctrl+Win— 禁用 Shell,恢复经典右键菜单右键+左键— 重新加载配置文件
二、配置文件结构
默认路径
C:\Program Files\Nilesoft Shell\
├── shell.exe
├── shell.nss # 主配置文件
├── imports/
│ ├── modify.nss # 修改现有菜单项
│ └── ...
shell.nss 基本结构
shell {
// 变量声明
$variable-name = variable-value
// 图片声明
@image-id = image-value
// 设置(可选)
settings { }
// 主题(可选)
theme { }
// 修改现有菜单项(可选)
modify ( property-name = property-value )
remove ( property-name = property-value )
// 新增菜单项(可选)
item ( property-name = property-value )
separator [()]
menu ( property-name = property-value ) {
item ( property-name = property-value )
}
}
语法规则
- 语法不区分大小写
- 等号
=两侧的空格可选 - 属性用括号
( )包裹,属性间用空格分隔或换行 - 可通过
import导入其他.nss文件 - 错误记录在
shell.log日志文件中
刷新配置
编辑 .nss 文件后,按住 Ctrl+右键 点击桌面或任务栏,强制 Shell 重新加载配置。
三、Settings(全局设置)
settings {
// 菜单显示延迟 (0~4000)
showdelay = 200
// 排除特定窗口或进程
exclude {
where = 布尔值
window = 窗口名称
process = 进程名称
}
// 工具提示设置
tip {
enabled = true
normal = [default, default]
primary = [#000, #fff]
info = [#88f, #fff]
success = [#8f8, #fff]
warning = [#ff8, #fff]
danger = [#f88, #fff]
width = 400 // 最大宽度 200~2000
opacity = 100 // 不透明度 0~100
radius = 3 // 圆角大小 0~3
time = 1.5 // 显示时间
padding = [8, 4]
}
// 修改项处理控制
modify {
enabled = 布尔值
image = [0=禁用, 1=启用, 2=自动重置图像]
title = 布尔值
visibility = 布尔值
parent = 布尔值
position = 布尔值
separator = 布尔值
auto = 布尔值
}
// 新项处理控制
new {
enabled = 布尔值
image = 布尔值
}
}
四、Theme(主题配置)
基本结构
theme {
// 主题名称: auto, classic, white, black, modern
name = "modern"
// 视图: auto, compact, small, medium, large, wide
view = view.compact
// 深色模式: true, false, default
dark = default
}
背景配置
theme {
background {
// 颜色
color = color value
// 不透明度 (0~100)
opacity = 50
// 效果: 0=禁用, 1=透明, 2=模糊, 3=亚克力
effect = 3
// 亚克力效果(自定义色调)
// effect = [3, tint_color, opacity]
effect = [3, color.accent, 30]
// 渐变
gradient {
enabled = true
// 线性渐变: [x1, x2, y1, y2]
linear = [0, 100, 0, 0]
// 或径向渐变: [cx, cy, r, fx, fy]
radial = [100, 100, 150, 100, 100]
// 色标: [offset, stop-color]
stop = [0.5, color.accent, 20]
}
}
}
亚克力背景示例
// 跟随系统主题色
theme {
name = "modern"
dark = default
background {
effect = [3, color.accent, 30]
opacity = 70
}
}
// 更通透的效果
theme {
background {
effect = [3, color.accent, 15]
opacity = 50
}
}
// 更浓郁的主题色
theme {
background {
effect = [3, color.accent, 50]
opacity = 80
}
}
菜单项配置
theme {
item {
opacity = 100
radius = 0~3
prefix = 1 // 0=不显示, 1=显示, 2=忽略
text {
normal = color
normal.disabled = color
select = color
select.disabled = color
}
back {
normal = color
normal.disabled = color
select = color
select.disabled = color
}
border {
normal = color
normal.disabled = color
select = color
select.disabled = color
}
padding { left, top, right, bottom }
margin { left, top, right, bottom }
}
}
边框配置
theme {
border {
enabled = true
size = 1 // 0~10
color = #ffffff
opacity = 100
radius = 5
padding { left, top, right, bottom }
}
}
阴影配置
theme {
shadow {
enabled = true
size = 5 // 0~30
color = #000000
opacity = 50 // 0~100
offset = 5 // 0~30
}
}
字体配置
theme {
font {
size = 12 // 最小 6
name = "tahoma"
weight = 4 // 1~9
italic = 0
}
}
分隔线配置
theme {
separator {
size = 1 // 0~40
color = #808080
opacity = 100
margin { left, top, right, bottom }
}
}
符号配置
theme {
symbol {
normal = color
normal.disabled = color
select = color
select.disabled = color
// 或细分
chevron { normal, normal.disabled, select, select.disabled }
checkmark { normal, normal.disabled, select, select.disabled }
bullet { normal, normal.disabled, select, select.disabled }
}
}
图片配置
theme {
image {
enabled = true
color = [color1, color2, color3]
gap = 4
glyph = "font name"
scale = true
align = 1 // 0=仅显示勾选标记, 1=仅显示图片, 2=同时显示
}
}
布局配置
theme {
layout {
rtl = false // 右到左布局(中东语言)
popup = 0 // 子菜单位置 (-20~20)
}
}
五、Modify Items(修改现有菜单项)
语法
modify(find = value [property = value [...]])
示例
// 修改图标颜色
modify(find = 'copy' image = #00ff00)
modify(find = 'paste' image = #0000ff)
// 移除菜单项
remove(find = "format")
// 收纳不常用菜单到"更多选项"
modify(mode=mode.multiple find="收藏夹|打印|共享|PowerRename" menu=title.more_options)
// 批量收纳
modify(mode=mode.multiple find="百度|QQ|Acrobat|Adobe|OneDrive" menu=title.more_options)
属性说明
验证属性:
type— 对象类型:*,File,Directory/Dir,Drive,USB,DVD等where— 布尔表达式,决定是否处理
过滤属性:
find(必填) — 匹配 title 的模式|分隔多个模式*通配符!取反
in— 指定子菜单位置
六、New Items(创建新菜单项)
创建菜单项
item(title = value [property = value [...]])
必填: title 或 image(至少设一个)
创建子菜单
menu(title = value [property = value [...]]) {
item(...)
menu() { ... }
separator
import 'path/to/file.nss'
}
创建分隔线
separator
separator(property = value)
实用示例
添加”用 VS Code 打开”:
item(title='Open with VS Code' image=[\uE272, #22A7F2] cmd='code' args='"@sel.path" && exit' sep='top')
创建编辑目录:
menu(mode="multiple" title="编辑" image=image.glyph("\uE0A1")) {
// 子项...
}
收藏夹菜单:
menu(type='desktop|taskbar' title='Favorites' image=#00ff00) {
menu(title='Applications' image=#ff0000) {
item(title='Command prompt' image cmd='cmd.exe')
item(title='PowerShell' image cmd='powershell.exe')
item(title='Registry editor' image cmd='regedit.exe')
separator
item(title='Paint' image cmd='mspaint.exe')
item(title='Notepad' image cmd='notepad.exe')
}
separator
menu(title='Directories' image=#0000ff) {
item(title='Downloads' cmd=user.downloads)
item(title='Pictures' cmd=user.pictures)
item(title='Home' cmd=user.directory)
}
}
七、Properties(属性参考)
属性分类
| 类型 | 缩写 | 说明 |
|---|---|---|
| modify item | mi | 修改项条目本身 |
| modify target | mt | 被修改的目标菜单项 |
| new menu | nm | 新建菜单 |
| new item | ni | 新建项 |
| new separator | ns | 新建分隔符 |
菜单项属性
| 属性 | 说明 | 默认值 |
|---|---|---|
title | 标题 | null |
vis | 可见性:Hidden/Normal/Disable/Static/Label | Normal |
image | 图标 | null |
parent/menu | 父级菜单 | null |
checked | 选中状态:0=无, 1=勾选, 2=单选 | 0 |
default | 默认项(粗体) | false |
pos | 位置 | null |
sep | 分隔符:None/Before/After | None |
tip | 工具提示 | null |
keys | 快捷键 | null |
命令属性
| 属性 | 说明 | 默认值 |
|---|---|---|
cmd | 命令 | null |
args | 参数 | null |
invoke | 调用方式:0=单次, 1=多次 | 0 |
window | 窗口:Hidden/Show/Minimized/Maximized | show |
dir | 工作目录 | null |
admin | 管理员权限 | false |
verb | 动词:open/edit/runas/print/explore | open |
wait | 等待完成 | false |
八、表达式与函数
变量
$variable-name = value
运算符
- 算术:
+-*/% - 关系:
==!=<><=>= - 逻辑:
&&||! - 三元:
condition ? true : false
常用变量
| 变量 | 说明 |
|---|---|
@sel.path | 选中项路径 |
@sel.name | 选中项名称 |
@sel.count | 选中项数量 |
@sel.parent | 父目录 |
@user.name | 当前用户名 |
@sys.dark | 是否深色模式 |
@sys.is11 | 是否 Windows 11 |
常用函数
| 函数 | 说明 |
|---|---|
str.contains(str, sub) | 是否包含子串 |
str.replace(str, old, new) | 替换子串 |
path.exists(path) | 路径是否存在 |
if(cond, true, false) | 条件判断 |
九、Padding 和 Margin 语法
// 四个值
padding = [1, 2, 3, 4]
// 等同于
left = 1, right = 2, top = 3, bottom = 4
// 两个值
padding = [4, 2]
// 等同于
left = 4, right = 4, top = 2, bottom = 2
// 一个值
padding = 4
// 等同于
left = 4, right = 4, top = 4, bottom = 4