{"_id":"@cloudworxx/tauri-plugin-mac-rounded-corners","_rev":"2-776ecd23eacc5a84c4c62e9bff01530c","name":"@cloudworxx/tauri-plugin-mac-rounded-corners","dist-tags":{"latest":"1.1.1"},"versions":{"1.1.0":{"name":"@cloudworxx/tauri-plugin-mac-rounded-corners","version":"1.1.0","keywords":["tauri","tauri-plugin","tauri-v2","macos","rounded-corners","traffic-lights","frameless-window","window-decorations","app-store","cocoa","fullscreen","auto-reposition"],"author":{"url":"https://cloudworxx.us","name":"Sascha Klein","email":"hello@cloudworxx.us"},"license":"MIT","_id":"@cloudworxx/tauri-plugin-mac-rounded-corners@1.1.0","maintainers":[{"name":"cloudworxx","email":"cloudworxx@gmail.com"}],"homepage":"https://github.com/cloudworxx/tauri-plugin-mac-rounded-corners#readme","bugs":{"url":"https://github.com/cloudworxx/tauri-plugin-mac-rounded-corners/issues"},"dist":{"shasum":"dcd20b51cbef8bff9418c96b6466e78180932179","tarball":"https://registry.npmjs.org/@cloudworxx/tauri-plugin-mac-rounded-corners/-/tauri-plugin-mac-rounded-corners-1.1.0.tgz","fileCount":7,"integrity":"sha512-XW23grav4r0SptlH/C4wG8D4QNCACQQWoBC8IAn+fAENCgYrMQEb0dcAwiM7Pz7oNUhJ2SdqzhNzClwxdmH0yA==","signatures":[{"sig":"MEUCIQDSE3rFp/Id8REtsbx4GEy5YZzeCt5YJg6dsGBQg4SdbwIgKXswZ9kJfFF/9CS1nxIEJ1Ss+HpI0o+SBNE1W9aI8a8=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":31151},"main":"index.ts","types":"index.ts","engines":{"node":">=18.0.0"},"gitHead":"248fb57b38590eb67abf6591ca4fd3d08c0a6d25","_npmUser":{"name":"cloudworxx","email":"cloudworxx@gmail.com"},"repository":{"url":"git+https://github.com/cloudworxx/tauri-plugin-mac-rounded-corners.git","type":"git"},"_npmVersion":"11.5.2","description":"Tauri v2 plugin for native macOS rounded corners with customizable Traffic Lights positioning. Auto-repositions after fullscreen. App Store compatible.","directories":{},"_nodeVersion":"24.1.0","_hasShrinkwrap":false,"peerDependencies":{"@tauri-apps/api":"^2"},"_npmOperationalInternal":{"tmp":"tmp/tauri-plugin-mac-rounded-corners_1.1.0_1759395134353_0.806116740022764","host":"s3://npm-registry-packages-npm-production"}},"1.1.1":{"name":"@cloudworxx/tauri-plugin-mac-rounded-corners","version":"1.1.1","description":"Tauri v2 plugin for native macOS rounded corners with customizable Traffic Lights positioning. Auto-repositions after fullscreen. App Store compatible.","main":"index.ts","types":"index.ts","bin":{"tauri-plugin-mac-rounded-corners":"scripts/install.js"},"scripts":{"postinstall":"node scripts/install.js || true"},"keywords":["tauri","tauri-plugin","tauri-v2","macos","rounded-corners","traffic-lights","frameless-window","window-decorations","app-store","cocoa","fullscreen","auto-reposition"],"author":{"name":"Sascha Klein","email":"hello@cloudworxx.us","url":"https://cloudworxx.us"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/cloudworxx/tauri-plugin-mac-rounded-corners.git"},"bugs":{"url":"https://github.com/cloudworxx/tauri-plugin-mac-rounded-corners/issues"},"homepage":"https://github.com/cloudworxx/tauri-plugin-mac-rounded-corners#readme","peerDependencies":{"@tauri-apps/api":"^2"},"engines":{"node":">=18.0.0"},"_id":"@cloudworxx/tauri-plugin-mac-rounded-corners@1.1.1","gitHead":"37811545be5ff242536ed82c2b68941b37513716","_nodeVersion":"24.1.0","_npmVersion":"11.5.2","dist":{"integrity":"sha512-oF75CsaetpvqzMlbULMqGjpg4Y3GqdIIqU4+gbjtPEuLb2AYWGGprjL3UQfIm6Ew75pDFFgVxnL7rJBr5uttgg==","shasum":"89ee86c41dcd8f16deb8d6c9890ced9776d6b201","tarball":"https://registry.npmjs.org/@cloudworxx/tauri-plugin-mac-rounded-corners/-/tauri-plugin-mac-rounded-corners-1.1.1.tgz","fileCount":8,"unpackedSize":38485,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIGCgKI1qD+vxQsPOkrh0vQ16ehbvMfuW2ib31nVubvbSAiEAne6D/981MN/SxJw/27CTJF+2Z508BfJIvKE8xR+Tk3A="}]},"_npmUser":{"name":"cloudworxx","email":"cloudworxx@gmail.com"},"directories":{},"maintainers":[{"name":"cloudworxx","email":"cloudworxx@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/tauri-plugin-mac-rounded-corners_1.1.1_1759396493286_0.8597454639148392"},"_hasShrinkwrap":false}},"time":{"created":"2025-10-02T08:52:14.252Z","modified":"2025-10-02T09:14:54.046Z","1.1.0":"2025-10-02T08:52:14.517Z","1.1.1":"2025-10-02T09:14:53.506Z"},"bugs":{"url":"https://github.com/cloudworxx/tauri-plugin-mac-rounded-corners/issues"},"author":{"name":"Sascha Klein","email":"hello@cloudworxx.us","url":"https://cloudworxx.us"},"license":"MIT","homepage":"https://github.com/cloudworxx/tauri-plugin-mac-rounded-corners#readme","keywords":["tauri","tauri-plugin","tauri-v2","macos","rounded-corners","traffic-lights","frameless-window","window-decorations","app-store","cocoa","fullscreen","auto-reposition"],"repository":{"type":"git","url":"git+https://github.com/cloudworxx/tauri-plugin-mac-rounded-corners.git"},"description":"Tauri v2 plugin for native macOS rounded corners with customizable Traffic Lights positioning. Auto-repositions after fullscreen. App Store compatible.","maintainers":[{"name":"cloudworxx","email":"cloudworxx@gmail.com"}],"readme":"# macOS Rounded Corners Plugin for Tauri v2\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Tauri](https://img.shields.io/badge/Tauri-v2-blue)](https://tauri.app/)\n[![macOS](https://img.shields.io/badge/macOS-compatible-green)](https://www.apple.com/macos/)\n[![Version](https://img.shields.io/badge/version-1.1.1-blue)](https://github.com/cloudworxx/tauri-plugin-mac-rounded-corners)\n\nA reusable Tauri plugin that enables native macOS rounded corners with customizable Traffic Lights positioning for frameless windows.\n\n## Author\n\n**Sascha Klein**  \nWebsite: [cloudworxx.us](https://cloudworxx.us)  \nEmail: [hello@cloudworxx.us](mailto:hello@cloudworxx.us)\n\n## Features\n\n- ✅ **Rounded corners** (12px default, customizable)\n- ✅ **Traffic Lights positioning** (Close, Minimize, Maximize buttons)\n- ✅ **Auto-reposition after fullscreen** (NEW in v1.1.0)\n- ✅ **App Store compatible** - Uses only public macOS APIs\n- ✅ **Custom titlebar support** - Full-size content view\n- ✅ **Native shadows** - Optional shadow effects\n- ✅ **TypeScript support** - Full type definitions\n- ✅ **Works with `decorations: false`**\n- ✅ **Zero runtime dependencies**\n- ✅ **MIT Licensed** - Free for personal and commercial use\n\n## What's New in v1.1.0\n\n- **Auto-reposition**: Traffic Lights automatically reposition after fullscreen exit\n- **New command**: `reposition_traffic_lights()` for manual control\n- **Event-based**: Uses `onResized` listener for instant repositioning\n- **Bug fixes**: Close button now works correctly, fullscreen positioning fixed\n\n## Installation\n\nThere are two ways to install this plugin: **automatic** (recommended) or **manual**.\n\n### Option A: Automatic Installation (Recommended)\n\nThe plugin includes an automatic installer that copies files and updates your project configuration.\n\n#### 1. Install the package\n\n```bash\nnpm install @cloudworxx/tauri-plugin-mac-rounded-corners\n```\n\nThe `postinstall` script automatically:\n- ✅ Copies `mod.rs` to `src-tauri/src/plugins/mac_rounded_corners.rs`\n- ✅ Creates/updates `src-tauri/src/plugins/mod.rs`\n\n#### 2. Complete the setup\n\nYou still need to manually add:\n\n**a) Dependencies to `src-tauri/Cargo.toml`:**\n```toml\n[target.'cfg(target_os = \"macos\")'.dependencies]\ncocoa = \"0.26\"\nobjc = \"0.2.7\"\n```\n\n**b) Commands in `src-tauri/src/lib.rs`:**\n```rust\nmod plugins;\nuse plugins::mac_rounded_corners;\n\npub fn run() {\n    tauri::Builder::default()\n        .invoke_handler(tauri::generate_handler![\n            mac_rounded_corners::enable_rounded_corners,\n            mac_rounded_corners::enable_modern_window_style,\n            mac_rounded_corners::reposition_traffic_lights\n        ])\n        .run(tauri::generate_context!())\n        .expect(\"error while running tauri application\");\n}\n```\n\n**c) Permissions to `tauri.conf.json`:**\n```json\n{\n  \"app\": {\n    \"security\": {\n      \"capabilities\": [\n        {\n          \"identifier\": \"main-capability\",\n          \"windows\": [\"*\"],\n          \"permissions\": [\n            \"core:window:allow-start-dragging\",\n            \"core:window:allow-is-fullscreen\",\n            \"core:window:allow-is-maximized\",\n            \"core:event:allow-listen\"\n          ]\n        }\n      ]\n    }\n  }\n}\n```\n\n### Option B: Manual Installation\n\n#### 1. Copy Rust Code\n\n```bash\nmkdir -p src-tauri/src/plugins\ncp mod.rs src-tauri/src/plugins/mac_rounded_corners.rs\n```\n\n#### 2. Add Dependencies\n\nAdd to `src-tauri/Cargo.toml`:\n\n```toml\n[target.'cfg(target_os = \"macos\")'.dependencies]\ncocoa = \"0.26\"\nobjc = \"0.2.7\"\n```\n\n#### 3. Register Commands\n\nIn `src-tauri/src/lib.rs`:\n\n```rust\nmod plugins;\nuse plugins::mac_rounded_corners;\n\npub fn run() {\n    tauri::Builder::default()\n        .invoke_handler(tauri::generate_handler![\n            mac_rounded_corners::enable_rounded_corners,\n            mac_rounded_corners::enable_modern_window_style,\n            mac_rounded_corners::reposition_traffic_lights  // NEW in v1.1.0\n        ])\n        .run(tauri::generate_context!())\n        .expect(\"error while running tauri application\");\n}\n```\n\nCreate `src-tauri/src/plugins/mod.rs`:\n\n```rust\npub mod mac_rounded_corners;\n```\n\n#### 4. Add Required Permissions\n\n**IMPORTANT**: Add these permissions to `tauri.conf.json`:\n\n```json\n{\n  \"app\": {\n    \"security\": {\n      \"capabilities\": [\n        {\n          \"identifier\": \"main-capability\",\n          \"windows\": [\"*\"],\n          \"permissions\": [\n            \"core:window:allow-start-dragging\",\n            \"core:window:allow-is-fullscreen\",\n            \"core:window:allow-is-maximized\",\n            \"core:event:allow-listen\"\n          ]\n        }\n      ]\n    }\n  }\n}\n```\n\n#### 5. Import TypeScript Functions\n\n**Option 1: Use from npm package (recommended)**\n```typescript\nimport { enableModernWindowStyle } from '@cloudworxx/tauri-plugin-mac-rounded-corners';\n```\n\n**Option 2: Copy TypeScript file locally**\n```bash\nmkdir -p src/lib\ncp node_modules/@cloudworxx/tauri-plugin-mac-rounded-corners/index.ts src/lib/mac-rounded-corners.ts\n```\n\nThen import from local file:\n```typescript\nimport { enableModernWindowStyle } from './lib/mac-rounded-corners';\n```\n\n## Usage\n\n### Basic Usage\n\n**After npm installation:**\n\n```typescript\nimport { useEffect } from 'react';\nimport { enableModernWindowStyle } from '@cloudworxx/tauri-plugin-mac-rounded-corners';\n\nfunction App() {\n  useEffect(() => {\n    // Enable rounded corners on mount\n    // Auto-repositioning after fullscreen is enabled automatically\n    enableModernWindowStyle();\n  }, []);\n\n  return <div>Your App</div>;\n}\n```\n\n### With Custom Configuration\n\n```typescript\nimport { enableModernWindowStyle } from '@cloudworxx/tauri-plugin-mac-rounded-corners';\n\n// Custom corner radius and Traffic Lights position\nawait enableModernWindowStyle({\n  cornerRadius: 16,      // Default: 12\n  offsetX: 5,            // Move Traffic Lights 5px right\n  offsetY: 10,           // Move Traffic Lights 10px down\n});\n```\n\n### Manual Repositioning\n\n```typescript\nimport { repositionTrafficLights } from '@cloudworxx/tauri-plugin-mac-rounded-corners';\n\n// Manually reposition Traffic Lights (useful after window state changes)\nawait repositionTrafficLights();\n```\n\n### Simple Mode (No Shadow)\n\n```typescript\nimport { enableRoundedCorners } from '@cloudworxx/tauri-plugin-mac-rounded-corners';\n\n// Simpler version without shadow and layer-based clipping\nawait enableRoundedCorners({\n  offsetX: 0,\n  offsetY: 0,\n});\n```\n\n## CSS Setup\n\nAdd to your CSS to ensure clean rounded corners:\n\n```css\nhtml, body, #root {\n  margin: 0;\n  padding: 0;\n  background-color: transparent;\n  overflow: hidden;\n}\n\n.App {\n  width: 100%;\n  height: 100vh;\n  background-color: #f6f6f6; /* Your app background */\n}\n```\n\n## Traffic Lights Positioning\n\nThe Traffic Lights (Close, Minimize, Maximize) can be positioned using offset values:\n\n- **offsetX**: Horizontal offset in pixels\n  - Positive = move right\n  - Negative = move left\n  - Default: `0.0`\n\n- **offsetY**: Vertical offset in pixels\n  - Positive = move down\n  - Negative = move up\n  - Default: `0.0`\n\n### Examples\n\n```typescript\n// Standard macOS position (top-left)\nenableModernWindowStyle({ offsetX: 0, offsetY: 0 });\n\n// Move right and down\nenableModernWindowStyle({ offsetX: 10, offsetY: 15 });\n\n// Move left (careful with negative values!)\nenableModernWindowStyle({ offsetX: -5, offsetY: 5 });\n```\n\n**⚠️ Warning:** Avoid extreme offset values (< -5px or very large positive values) as they may cause Traffic Lights to become unclickable.\n\n## API Reference\n\n### `enableRoundedCorners(config?)`\n\nEnables basic rounded corners with transparent titlebar.\n\n**Parameters:**\n- `config.offsetX` (optional): Horizontal Traffic Lights offset (default: 0)\n- `config.offsetY` (optional): Vertical Traffic Lights offset (default: 0)\n\n**Returns:** `Promise<void>`\n\n### `enableModernWindowStyle(config?)`\n\nEnables modern window style with rounded corners, shadow, and layer-based clipping. **Recommended.**\n\n**Parameters:**\n- `config.cornerRadius` (optional): Corner radius in pixels (default: 12)\n- `config.offsetX` (optional): Horizontal Traffic Lights offset (default: 0)\n- `config.offsetY` (optional): Vertical Traffic Lights offset (default: 0)\n\n**Returns:** `Promise<void>`\n\n### `repositionTrafficLights()` ✨ NEW\n\nManually repositions Traffic Lights to their configured position. Useful if you need to manually trigger repositioning.\n\n**Returns:** `Promise<void>`\n\n### `cleanupRoundedCorners()` ✨ NEW\n\nCleanup function to remove event listeners. Call when component unmounts.\n\n**Returns:** `void`\n\n## Tauri Configuration\n\nEnsure your `tauri.conf.json` has decorations disabled:\n\n```json\n{\n  \"tauri\": {\n    \"windows\": [\n      {\n        \"decorations\": false\n      }\n    ]\n  }\n}\n```\n\n**Important:** Do NOT set `transparent: true` - this plugin provides rounded corners without requiring the transparency API, making it more reliable and App Store compatible.\n\n## Platform Support\n\n| Feature | macOS | Windows | Linux |\n|---------|-------|---------|-------|\n| Rounded Corners | ✅ | ❌ | ❌ |\n| Traffic Lights | ✅ (native) | N/A | N/A |\n| Shadow | ✅ (native) | ✅ | ✅ |\n| Auto-reposition | ✅ | N/A | N/A |\n\nOn non-macOS platforms, the plugin commands are no-ops and won't throw errors.\n\n## Troubleshooting\n\n### Traffic Lights not repositioning after fullscreen\n\n**Solution:** Ensure you have the required permissions in `tauri.conf.json`:\n```json\n\"core:window:allow-is-fullscreen\",\n\"core:event:allow-listen\"\n```\n\n### Traffic Lights not clickable\n\n- Check your offset values - they may be too extreme\n- Ensure all window style masks are set (the plugin handles this)\n- Safe ranges: `offsetX: -5 to 20`, `offsetY: 0 to 20`\n\n### White flicker in corners\n\n- Ensure `html`, `body`, `#root` have `background-color: transparent`\n- Remove `border-radius` from these elements\n- Let the Rust layer handle the clipping\n\n### Close button disabled\n\n- This is fixed in v1.1.0 (adds `NSClosableWindowMask`)\n- Make sure you're using the latest version\n\n### Permission errors in console\n\nAdd all required permissions to `tauri.conf.json` (see Installation step 4)\n\n## Technical Details\n\n### Used macOS APIs (all public)\n\n- `NSWindow.styleMask`\n- `NSFullSizeContentViewWindowMask`\n- `setTitlebarAppearsTransparent`\n- `setTitleVisibility`\n- `setHasShadow`\n- `CALayer.setCornerRadius`\n- `setMasksToBounds`\n- `standardWindowButton` (for repositioning)\n\n**No private APIs** are used - fully App Store compliant.\n\n### How Auto-Reposition Works\n\nThe plugin uses Tauri's `onResized` event listener to detect when the window exits fullscreen mode. When this event fires, it immediately calls `repositionTrafficLights()` to restore the custom position. This is event-based and instant (~0-50ms), not polling-based.\n\n### Why this works\n\n1. `NSFullSizeContentViewWindowMask` allows content in titlebar region\n2. Transparent titlebar removes default chrome\n3. Layer-based corner radius clips the content\n4. Style masks enable Traffic Light functionality\n5. Frame manipulation positions the buttons\n6. Event listener repositions after state changes\n\n## Requirements\n\n- Tauri v2.x\n- macOS 10.15 or later\n- Rust stable toolchain\n- Node.js 18+\n\n## Changelog\n\nSee [CHANGELOG.md](CHANGELOG.md) for detailed version history.\n\n### Recent Changes\n\n**v1.1.0** (2025-01-02)\n- Added auto-reposition feature for Traffic Lights after fullscreen\n- New `reposition_traffic_lights()` command\n- Event-based resize listener\n- Fixed Close button not working\n- Added required permissions documentation\n\n**v1.0.0** (2025-01-02)\n- Initial release\n\n## FAQ\n\n**Q: Does this work with Tauri v1?**  \nA: No, this plugin is designed for Tauri v2. For Tauri v1, you would need to adapt the code.\n\n**Q: Can I use this in production?**  \nA: Yes! The plugin uses only public APIs and is App Store compatible.\n\n**Q: Will this work on Windows/Linux?**  \nA: The commands are no-ops on non-macOS platforms, so your app won't crash, but rounded corners are macOS-only.\n\n**Q: Can I customize the corner radius?**  \nA: Yes! Use the `cornerRadius` parameter in `enableModernWindowStyle()`.\n\n**Q: Do I need `transparent: true` in tauri.conf.json?**  \nA: No! This plugin works without the transparency API, which makes it more reliable and avoids potential App Store issues.\n\n**Q: Why do Traffic Lights reset position after fullscreen?**  \nA: macOS resets custom button positions during fullscreen transitions. v1.1.0 automatically fixes this with event-based repositioning.\n\n**Q: Is this free?**  \nA: Yes! MIT licensed - free for personal and commercial use.\n\n## Support\n\n- 📧 Email: [hello@cloudworxx.us](mailto:hello@cloudworxx.us)\n- 🐛 Issues: [GitHub Issues](https://github.com/cloudworxx/tauri-plugin-mac-rounded-corners/issues)\n- 💬 Discussions: [GitHub Discussions](https://github.com/cloudworxx/tauri-plugin-mac-rounded-corners/discussions)\n\n## License\n\nMIT License - see [LICENSE](LICENSE) file for details.\n\nCopyright (c) 2025 Sascha Klein (cloudworxx.us)\n\n## Credits\n\nCreated for [PromptDeck](https://getpromptdeck.com)\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature/amazing-feature`)\n3. Commit your changes (`git commit -m 'Add some amazing feature'`)\n4. Push to the branch (`git push origin feature/amazing-feature`)\n5. Open a Pull Request\n\n## Star History\n\nIf you find this plugin useful, please consider giving it a ⭐ on GitHub!\n\n---\n\nMade with ❤️ by Sascha Klein (cloudworxx.us)\n","readmeFilename":"README.md"}