Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions plugins/zhu-zhi-liao-toy/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
## 插件介绍

- 竹知了桌宠是一个基于 ZTools 的桌面玩具插件,仿照传统玩具「竹知了」(竹蝉/拉线蝉)。
- 启动后,鼠标指针会变成一把小竹签,下面用线拴着一只竹蝉(会振翅的小竹筒)。

## 玩法

- **长按左键晃动**:按住鼠标左键,像甩真玩具一样画圈/晃动,竹蝉就绕着竹签甩起来,转得越快叫得越响——"哇——哇——"。
- **松开左键**:竹蝉靠惯性继续转几下,余音渐歇。
- **右键点击**:退出玩具,恢复普通鼠标。

## 说明

- 竹蝉发出的是「哇哇」声,用 Web Audio 合成(锯齿波 + 调幅 + 扫频带通 + 膜腔共振峰),零外部依赖。
- 玩具窗口铺满光标所在的整个屏幕(跨多屏自动跟随),竹蝉画在光标位置,怎么甩都不会出界。
- 玩耍时隐藏系统光标、点击会被玩具捕获;右键退出后一切恢复正常。
- 感谢开源项目:https://github.com/imsai-sh/zhuzhiliao

## 打个广告
- 作者软件下载站:[工具灯塔](https://gongjudengta.top):https://gongjudengta.top
- 手机壳定制,有需要的欢迎扫码查看
- ![手机壳定制](https://origin.picgo.net/2026/07/22/gh_0d44d93f5082_258-15d0e28c721266ee0.jpg)
Binary file added plugins/zhu-zhi-liao-toy/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions plugins/zhu-zhi-liao-toy/plugin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "zhu-zhi-liao-toy",
"title": "竹知了桌宠",
"description": "鼠标指针变成竹知了,长按左键晃动就哇哇叫,右键退出",
"author": "Cozy",
"version": "1.1.0",
"preload": "preload.js",
"logo": "logo.png",
"features": [
{
"code": "start-toy",
"explain": "启动竹知了桌面玩具",
"cmds": [ "知了"],
"mainHide": true
}
],
"platform": ["win32", "darwin", "linux"]
}
80 changes: 80 additions & 0 deletions plugins/zhu-zhi-liao-toy/preload.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/* 竹知了桌宠 —— ZTools 插件主进程入口
注意:本文件是插件的 preload 脚本,运行在渲染进程里。preload 中 require('electron')
只能拿到 ipcRenderer 等渲染端模块,ipcMain / screen 是主进程模块,在这里是 undefined。
因此这里一律使用 ztools 提供的屏幕 API(getCursorScreenPoint / getDisplayNearestPoint /
getPrimaryDisplay),它们经主进程转发,macOS / Windows 上都安全。注意 macOS 上不要调用
ztools.screenToDipPoint / dipToScreenPoint,那两个在 macOS 上会触发主进程崩溃。 */
var toyWindow = null;
var IS_MAC = typeof process !== 'undefined' && process.platform === 'darwin';

function displayBoundsAtCursor() {
try {
var p = ztools.getCursorScreenPoint();
var d = ztools.getDisplayNearestPoint(p);
if (d && d.bounds) return d.bounds;
} catch (e) {}
try {
var d = ztools.getPrimaryDisplay();
if (d && d.bounds) return d.bounds;
} catch (e) {}
return null;
}

window.exports = {
"start-toy": {
mode: "none",
args: {
enter: function () {
if (toyWindow && !toyWindow.isDestroyed()) {
ztools.outPlugin();
return;
}
ztools.hideMainWindow();

var w = 380;
var h = 380;
var x = 0;
var y = 0;
var b = displayBoundsAtCursor();
if (b) {
x = b.x;
y = b.y;
w = b.width;
h = b.height;
}

toyWindow = ztools.createBrowserWindow("toy/index.html", {
x: x,
y: y,
width: w,
height: h,
frame: false,
transparent: true,
alwaysOnTop: true,
skipTaskbar: true,
resizable: false, // 透明窗口在部分平台(尤其 mac)设 resizable:true 会失效
focusable: true, // 确保窗口能接收鼠标事件(否则 mac 上无法点击/拖动)
hasShadow: false,
backgroundColor: "#00000000",
webPreferences: {
nodeIntegration: true,
contextIsolation: false,
backgroundThrottling: false,
},
}, function () {
// mac 上必须先 show 再 focus 窗口才能拿到焦点/鼠标事件(参见 ZTools 修复)
if (IS_MAC && toyWindow && !toyWindow.isDestroyed()) {
try { toyWindow.show(); } catch (e) {}
try { toyWindow.focus(); } catch (e) {}
}
});

/* 确保不忽略鼠标事件、可聚焦(若 ztools 内部默认置了 focusable:false 会在此被纠正) */
try { toyWindow.setIgnoreMouseEvents(false); } catch (e) {}
try { toyWindow.setFocusable(true); } catch (e) {}

ztools.outPlugin();
},
},
},
};
30 changes: 30 additions & 0 deletions plugins/zhu-zhi-liao-toy/toy/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>竹知了</title>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
width: 100%;
height: 100%;
background: transparent;
overflow: hidden;
user-select: none;
-webkit-user-select: none;
-webkit-tap-highlight-color: transparent;
cursor: none;
}
canvas#cv {
display: block;
width: 100%;
height: 100%;
touch-action: none;
}
</style>
</head>
<body>
<canvas id="cv"></canvas>
<script src="toy.js"></script>
</body>
</html>
Loading
Loading