Omnipen
English | 中文
English
A global screen pen for Windows. Click the ✏️ icon in the VS Code status bar to lay a transparent drawing layer over the primary screen and annotate anywhere — VS Code, the desktop, or other apps. It keeps working when VS Code is minimized, in the background, or closed.
Features
- Status-bar toggle; the overlay covers the primary screen and runs independently of the VS Code window
- Icon-only toolbar with short tooltips; 1–32 dynamic width, also adjustable with the mouse wheel over the canvas (scroll away = thinner, toward you = thicker)
- Pressure-sensitive ink for graphics tablets: pen pressure controls stroke width
- Adaptive quadratic sampling plus a light low-pass filter — strokes are final while you draw and never re-layout afterwards
- Eraser removes points and splits strokes; a mint ring shows the eraser size, updates live with the wheel, and hides the system cursor
- Undo, redo, clear
- Save the current primary screen as PNG, JPEG, BMP, GIF or TIFF (desktop content plus ink)
- Click-through:
Ctrl+Alt+X lets clicks reach other apps through empty areas while a compact 4-icon bar stays clickable and draggable
- Close:
Ctrl+Alt+Q or the × button; toggle from VS Code: Ctrl+Alt+U
Notes
- Windows only. Requires .NET Framework 4.8 + WPF, included in Windows 10/11.
- VS Code's extension API cannot overlay arbitrary UI, so a separate transparent topmost window covers the primary screen; the extension only launches and stops it.
- Ink is screen-level, not tied to a file or window: it stays put when you scroll or move windows.
- In drawing mode the whole primary screen captures the mouse. Press
Ctrl+Alt+X to interact with other apps through empty areas.
- Primary monitor only for now; display-resolution changes re-fit the overlay automatically.
- Pass-through uses an alpha-0 background; clicking exactly on an ink stroke still hits the overlay.
Development
npm install
npm run build:helper # compile helper/OmniPen.cs to bin/OmniPen.exe with the built-in csc
npm run compile
Open this folder in VS Code and press F5 to debug.
Package & install
npm run package
code --install-extension omnipen-0.0.17.vsix
Structure
src/extension.ts — status bar, command, helper process control
helper/OmniPen.cs — transparent topmost WPF window + custom smoothed ink layer
scripts/build-helper.mjs — compiles the helper with the .NET Framework csc
bin/OmniPen.exe — build output (packed into the VSIX)
中文
English | 中文
Windows 专用的全局屏幕画笔。点状态栏的 ✏️ 图标,会在主屏幕上盖一层透明画布,用鼠标直接写字、画圈、标注;VS Code 最小化、切到后台或关闭后依然可用。
功能
- 状态栏开关;覆盖层铺满主屏,独立运行,VS Code 最小化 / 后台 / 关闭后仍可使用
- 纯图标工具栏(悬停显示提示),1–32 动态粗细滑杆,画布上滚轮也能调(前滚变细、后滚变粗);笔和橡皮共用
- 支持数位板压感:笔压控制线条粗细,轨迹用二次曲线自适应采样并做轻度低通,边写边平滑,结束后不再重排
- 小清新浅色工具栏;内嵌 HSV 色环调色盘(色环选色相、方块调饱和度/明度)
- 橡皮擦(按点擦除,擦出透明;圆圈显示大小,随滚轮实时变化,隐藏系统十字光标)
- 撤销 / 重做 / 清空
- 保存当前主屏画面为 PNG / JPEG / BMP / GIF / TIFF(含桌面内容和笔迹)
- 点击穿透:
Ctrl+Alt+X,空白处直接操作任意软件;左上角保留撤销 / 清空 / 保存 / 恢复绘制 4 个图标按钮,可拖动
- 关闭画笔:
Ctrl+Alt+Q 或工具栏 ×
- VS Code 内开关快捷键:
Ctrl+Alt+U
重要说明
- 只支持 Windows。依赖 .NET Framework 4.8 + WPF,Windows 10/11 自带。
- VS Code 的扩展 API 不允许在任意界面上叠加画布,所以这里用一个独立的透明置顶窗口铺满主屏,扩展只负责启动/关闭它。
- 笔迹是"屏幕层"的,不绑定文件或窗口:相当于在显示器上画,滚动或移动窗口时笔迹不动。
- 绘制模式下整块主屏的鼠标都会被接管,按
Ctrl+Alt+X 穿透后空白处可直接点其他软件;穿透时左上角只保留 4 个图标按钮,点笔形按钮或再按 Ctrl+Alt+X 恢复绘制。
- 主屏模式暂不支持多显示器;切换分辨率会自动重新铺满主屏。
- 穿透使用透明背景,点在墨迹线条上时仍会由覆盖层接收。
开发
npm install
npm run build:helper # 用系统自带 csc 把 helper/OmniPen.cs 编译成 bin/OmniPen.exe
npm run compile
在 VS Code 中打开本目录,按 F5 调试。
打包安装
npm run package
code --install-extension omnipen-0.0.17.vsix
结构
src/extension.ts:状态栏、命令、helper 进程控制
helper/OmniPen.cs:透明置顶 WPF 窗口 + 自绘平滑笔迹层
scripts/build-helper.mjs:用 .NET Framework 自带的 csc 编译 helper
bin/OmniPen.exe:编译产物(打包进 VSIX)