Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/itseeleeya/tauri-plugin-trafficlights-positioner
Helps insetting the window traffic lights on macOS.
https://github.com/itseeleeya/tauri-plugin-trafficlights-positioner
macos rust tauri tauri-plugin
Last synced: 3 months ago
JSON representation
Helps insetting the window traffic lights on macOS.
- Host: GitHub
- URL: https://github.com/itseeleeya/tauri-plugin-trafficlights-positioner
- Owner: ItsEeleeya
- License: mit
- Created: 2024-08-02T19:27:20.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-08-02T20:48:26.000Z (6 months ago)
- Last Synced: 2024-10-01T05:04:23.494Z (4 months ago)
- Topics: macos, rust, tauri, tauri-plugin
- Language: Rust
- Homepage:
- Size: 398 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Tauri Plugin Traffic Lights Positioner
This plugin helps you set a custom inset for the window controls on macOS. Currently only for Tauri v1.*_This is done without any visible artifacts on resize._
## Get the plugin
Using the command line from crates.io:
```
$ cargo add tauri-plugin-trafficlights-positioner
```Or add it manually to `Cargo.toml`:
```toml
[target.'cfg(target_os = "macos")'.dependencies]
tauri-plugin-trafficlights-positioner = "1.0.0"
```Or get the latest using git:
```toml
[target.'cfg(target_os = "macos")'.dependencies]
tauri-plugin-trafficlights-positioner = { git = "https://github.com/ItsEeleeya/tauri-plugin-trafficlights-positioner/" }
```## Usage
```rs
fn main() {
tauri::Builder::default()
.setup(move |app| {
if let Some(window) = app.get_window("main") {
#[cfg(target_os = "macos")]
// NOTE: Make sure you only call this ONCE per window.
let _ = window.setup_traffic_lights_inset(LogicalPosition::new(20.0, 24.0));
};Ok(())
})
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
```If you need extra customization (especially for Windows) use [clearlysid/tauri-plugin-decorum](https://github.com/clearlysid/tauri-plugin-decorum/)
## Credits
Almost all credits for `positioner.rs` goes to [@haasal](https://github.com/haasal), [@charrondev](https://gist.github.com/charrondev) and [Hoppscotch](https://github.com/hoppscotch/hoppscotch)
This is also similar to how it is implemented in the Zed editor.
Original Tauri Issue: https://github.com/tauri-apps/tauri/issues/4789(Gist) https://gist.github.com/charrondev/43150e940bd2771b1ea88256d491c7a9
(Hoppscotch) https://github.com/hoppscotch/hoppscotch/blob/286fcd2bb08a84f027b10308d1e18da368f95ebf/packages/hoppscotch-selfhost-desktop/src-tauri/src/mac/window.rs