Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
agmmnn committed Jul 27, 2023
1 parent 26cb55c commit 695f31a
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
![](https://img.shields.io/bundlephobia/minzip/tauri-controls)
![](https://img.shields.io/npm/dt/tauri-controls) -->

**Tauri Controls** is a library that provides native-looking **window controls** for Tauri 2 applications. You can enhance the user experience of your Tauri 2 applications with window controls that mimic the identical native controls on the current system.
**Tauri Controls** is a library that provides native-looking **window controls** for [Tauri](https://github.com/tauri-apps/tauri) 2 applications. You can enhance the user experience of your Tauri 2 applications with window controls that mimic the identical native controls on the current system.

`tauri-controls` uses Tauri's [js/ts APIs](https://next--tauri.netlify.app/next/api/js) to handle window events and just provides native-looking (designed according to official system design prototypes) html/react elements, not native, _it does not rely on the system's native APIs_.

The following designs are taken as reference:

Expand Down Expand Up @@ -54,15 +56,14 @@ import { WindowControls } from "tauri-controls"
function MyTitlebar() {
return <WindowControls />
}

// if no platform is specified, the current system will be detected
// and the matching element will be returned.
```

> _tauri-controls_ uses Tauri's [`window` API](https://next--tauri.netlify.app/next/api/js/window) to handle window events and just provides a **React element**, _it does not rely on the system's native APIs_.
When no platform is specified, the current system will be detected and the matching element will be returned. A good method for cross-platfrom releases.

[![](.github/statics/Frame.png)](https://www.figma.com/file/ms2vbZx5lEGxHqHR8fAfQm/Desktop-Native-Window-Controls?type=design&node-id=4%3A6020&mode=design&t=PIbVTsr8zWmIFsNr-1)

> _If you get the message "Not allowed by scope" in the terminal after a production build (like me), try [this](https://github.com/agmmnn/tauri-controls/issues/1#issuecomment-1653557673)._
### Options

```ts
Expand Down Expand Up @@ -90,10 +91,11 @@ You can also pass additional `props` to elements like `data-tauri-drag-region` f

If the library gets some interest, I can gradually add the following features:

- [ ] Add declaration file.
- [ ] Detect disabled window controls (is_maximizable, ...) and disable the buttons accordingly.
- [ ] Disable icons option for macOs.
- [ ] 'Hide icons' option for macOS.
- [ ] Svelte/SvelteKit implementation.
- [ ] Next.js support.
- [ ] When no platform is specified, also automatically determine the side of the controls. (e.g. macOS left, others right)

## Figma

Expand All @@ -106,6 +108,13 @@ These sources were utilized:
- [macOS Monterey UI Kit for Figma](https://www.figma.com/community/file/1034539431656086181/macOS-Monterey-UI-Kit-for-Figma) @joey
- [Spotify Desktop App Clone](https://www.figma.com/community/file/1028665514709480268/Spotify-Desktop-App-Clone) @uidesignguide

## Further Reading

- [Feature request: Add setting for titlebar style with native window controls support - tauri-apps/tauri#2663](https://github.com/tauri-apps/tauri/issues/2663)
- [Window Controls Overlay for Installed Desktop Web Apps - WICG](https://github.com/WICG/window-controls-overlay/blob/main/explainer.md)
- [Window Controls Overlay - Electron](https://www.electronjs.org/docs/latest/tutorial/window-customization#window-controls-overlay-macos-windows)
- [Window Controls Overlay API - MDN](https://developer.mozilla.org/en-US/docs/Web/API/Window_Controls_Overlay_API)

## License

MIT

0 comments on commit 695f31a

Please sign in to comment.