This commit is contained in:
2026-01-12 20:23:27 +08:00
commit d00de71819
4 changed files with 1246 additions and 0 deletions

37
.gitignore vendored Normal file
View File

@@ -0,0 +1,37 @@
# Dependencies
node_modules/
# Build output
dist/
build/
# Environment files (may contain secrets)
.env
.env.local
.env.*.local
# OS files
.DS_Store
Thumbs.db
# Logs
*.log
pnpm-debug.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Coverage
coverage/
.nyc_output/
# Cache
.cache/
.parcel-cache/
.turbo/
# IDE
.idea/
.vscode/
*.swp
*.swo

17
package.json Normal file
View File

@@ -0,0 +1,17 @@
{
"name": "window-titles-test",
"version": "0.0.1",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "abearxiong <xiongxiao@xiongxiao.me> (https://www.xiongxiao.me)",
"license": "MIT",
"packageManager": "pnpm@10.14.0",
"type": "module",
"dependencies": {
"get-windows": "^9.2.3"
}
}

1175
pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load Diff

17
src/index.ts Normal file
View File

@@ -0,0 +1,17 @@
import { activeWindow, openWindowsSync } from 'get-windows';
async function main() {
try {
const window = await activeWindow();
if (window) {
console.log(`Active window}`, window);
}
const windows = openWindowsSync();
console.log(`All open windows:`, windows);
} catch (error) {
console.error("Error getting windows:", error);
}
}
main();