-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
35 changed files
with
522 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/dist/ | ||
/target/ | ||
/Cargo.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/src | ||
/assets | ||
/Cargo.toml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"recommendations": [ | ||
"tauri-apps.tauri-vscode", | ||
"rust-lang.rust-analyzer", | ||
"DioxusLabs.dioxus" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
[package] | ||
name = "hello-tauri-ui" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
[dependencies] | ||
dioxus = { version = "0.6", features = ["web"] } | ||
dioxus-logger = "0.6" | ||
wasm-bindgen = "0.2" | ||
wasm-bindgen-futures = "0.4" | ||
web-sys = "0.3" | ||
js-sys = "0.3" | ||
serde = { version = "1", features = ["derive"] } | ||
serde-wasm-bindgen = "0.6" | ||
|
||
[workspace] | ||
members = ["src-tauri"] | ||
|
||
[profile] | ||
|
||
[profile.wasm-dev] | ||
inherits = "dev" | ||
opt-level = 1 | ||
|
||
[profile.server-dev] | ||
inherits = "dev" | ||
|
||
[profile.android-dev] | ||
inherits = "dev" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[application] | ||
name = "hello-tauri-ui" | ||
default_platform = "web" | ||
out_dir = "dist" | ||
asset_dir = "assets" | ||
|
||
[web.app] | ||
title = "Tauri + Dioxus App" | ||
|
||
[web.watcher] | ||
reload_html = true | ||
watch_path = ["src", "assets"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
## Broken | ||
|
||
This is an example from official but it's stuck at build page forever. | ||
|
||
``` | ||
"build": { | ||
"beforeDevCommand": "dx serve --port 1420", | ||
"devUrl": "http://localhost:1420", | ||
"beforeBuildCommand": "dx build --release", | ||
"frontendDist": "../dist" | ||
}, | ||
``` | ||
|
||
## Workaround | ||
|
||
Delete `beforeDevCommand` and run `dx serve --port 1420` ourself | ||
|
||
``` | ||
"build": { | ||
"devUrl": "http://localhost:1420", | ||
"beforeBuildCommand": "dx build --release", | ||
"frontendDist": "../dist" | ||
}, | ||
``` | ||
|
||
## Dev | ||
|
||
``` | ||
dx serve --port 1420 | ||
cargo tauri dev | ||
``` |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
.logo.dioxus:hover { | ||
filter: drop-shadow(0 0 2em #2076a8); | ||
} | ||
:root { | ||
font-family: Inter, Avenir, Helvetica, Arial, sans-serif; | ||
font-size: 16px; | ||
line-height: 24px; | ||
font-weight: 400; | ||
|
||
color: #0f0f0f; | ||
background-color: #f6f6f6; | ||
|
||
font-synthesis: none; | ||
text-rendering: optimizeLegibility; | ||
-webkit-font-smoothing: antialiased; | ||
-moz-osx-font-smoothing: grayscale; | ||
-webkit-text-size-adjust: 100%; | ||
} | ||
|
||
.container { | ||
margin: 0; | ||
padding-top: 10vh; | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
text-align: center; | ||
} | ||
|
||
.logo { | ||
height: 6em; | ||
padding: 1.5em; | ||
will-change: filter; | ||
transition: 0.75s; | ||
} | ||
|
||
.logo.tauri:hover { | ||
filter: drop-shadow(0 0 2em #24c8db); | ||
} | ||
|
||
.row { | ||
display: flex; | ||
justify-content: center; | ||
} | ||
|
||
a { | ||
font-weight: 500; | ||
color: #646cff; | ||
text-decoration: inherit; | ||
} | ||
|
||
a:hover { | ||
color: #535bf2; | ||
} | ||
|
||
h1 { | ||
text-align: center; | ||
} | ||
|
||
input, | ||
button { | ||
border-radius: 8px; | ||
border: 1px solid transparent; | ||
padding: 0.6em 1.2em; | ||
font-size: 1em; | ||
font-weight: 500; | ||
font-family: inherit; | ||
color: #0f0f0f; | ||
background-color: #ffffff; | ||
transition: border-color 0.25s; | ||
box-shadow: 0 2px 2px rgba(0, 0, 0, 0.2); | ||
} | ||
|
||
button { | ||
cursor: pointer; | ||
} | ||
|
||
button:hover { | ||
border-color: #396cd8; | ||
} | ||
button:active { | ||
border-color: #396cd8; | ||
background-color: #e8e8e8; | ||
} | ||
|
||
input, | ||
button { | ||
outline: none; | ||
} | ||
|
||
#greet-input { | ||
margin-right: 5px; | ||
} | ||
|
||
@media (prefers-color-scheme: dark) { | ||
:root { | ||
color: #f6f6f6; | ||
background-color: #2f2f2f; | ||
} | ||
|
||
a:hover { | ||
color: #24c8db; | ||
} | ||
|
||
input, | ||
button { | ||
color: #ffffff; | ||
background-color: #0f0f0f98; | ||
} | ||
button:active { | ||
background-color: #0f0f0f69; | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Generated by Cargo | ||
# will have compiled files and executables | ||
/target/ | ||
|
||
# Generated by Tauri | ||
# will have schema files for capabilities auto-completion | ||
/gen/schemas |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
[package] | ||
name = "hello-tauri" | ||
version = "0.1.0" | ||
description = "A Tauri App" | ||
authors = ["you"] | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[lib] | ||
# The `_lib` suffix may seem redundant but it is necessary | ||
# to make the lib name unique and wouldn't conflict with the bin name. | ||
# This seems to be only an issue on Windows, see https://github.com/rust-lang/cargo/issues/8519 | ||
name = "hello_tauri_lib" | ||
crate-type = ["staticlib", "cdylib", "rlib"] | ||
|
||
[build-dependencies] | ||
tauri-build = { version = "2", features = [] } | ||
|
||
[dependencies] | ||
tauri = { version = "2", features = ["tray-icon"] } | ||
tauri-plugin-opener = "2" | ||
serde = { version = "1", features = ["derive"] } | ||
serde_json = "1" | ||
reqwest = "0.12.12" | ||
anyhow = "1.0.95" | ||
|
||
[dev-dependencies] | ||
tokio = { version = "1.43.0", features = ["full"] } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
fn main() { | ||
tauri_build::build() | ||
} |
10 changes: 10 additions & 0 deletions
10
examples/r1/hello-tauri/src-tauri/capabilities/default.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"$schema": "../gen/schemas/desktop-schema.json", | ||
"identifier": "default", | ||
"description": "Capability for the main window", | ||
"windows": ["main"], | ||
"permissions": [ | ||
"core:default", | ||
"opener:default" | ||
] | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
pub mod ray; | ||
|
||
use tauri::{ | ||
menu::{Menu, MenuItem}, | ||
tray::TrayIconBuilder, | ||
}; | ||
|
||
#[tauri::command] | ||
fn greet(name: &str) -> String { | ||
format!("Hello, {}! You've been greeted from Rust!", name) | ||
} | ||
|
||
#[cfg_attr(mobile, tauri::mobile_entry_point)] | ||
pub fn run() { | ||
tauri::Builder::default() | ||
.plugin(tauri_plugin_opener::init()) | ||
.setup(|app| { | ||
let quit_i = MenuItem::with_id(app, "quit", "Quit", true, None::<&str>)?; | ||
let menu = Menu::with_items(app, &[&quit_i])?; | ||
|
||
let tray = TrayIconBuilder::new() | ||
.icon(app.default_window_icon().unwrap().clone()) | ||
.menu(&menu) | ||
.show_menu_on_left_click(true) | ||
.build(app)?; | ||
|
||
tray.set_title(Some("Hello World")) | ||
.expect("set_title call failed"); | ||
|
||
Ok(()) | ||
}) | ||
.invoke_handler(tauri::generate_handler![greet]) | ||
.run(tauri::generate_context!()) | ||
.expect("error while running tauri application"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// Prevents additional console window on Windows in release, DO NOT REMOVE!! | ||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] | ||
|
||
fn main() { | ||
hello_tauri_lib::run() | ||
} |
Oops, something went wrong.