-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#215 icons, tray icon, menu #215 make atomic-server also a library #215 tauri menu refactor #251 WIP
- Loading branch information
Showing
35 changed files
with
2,654 additions
and
277 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
[workspace] | ||
members = [ | ||
"server", | ||
"cli", | ||
"lib", | ||
"server", | ||
"cli", | ||
"lib", | ||
"src-tauri", | ||
] |
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
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
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
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,20 @@ | ||
mod actor_messages; | ||
mod appstate; | ||
mod commit_monitor; | ||
pub mod config; | ||
mod content_types; | ||
mod errors; | ||
mod handlers; | ||
mod helpers; | ||
#[cfg(feature = "https")] | ||
mod https; | ||
mod jsonerrors; | ||
mod process; | ||
mod routes; | ||
pub mod serve; | ||
// #[cfg(feature = "search")] | ||
mod search; | ||
#[cfg(test)] | ||
mod tests; | ||
#[cfg(feature = "desktop")] | ||
mod tray_icon; |
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
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,27 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="utf-8"> | ||
<meta content="width=device-width,initial-scale=1" name="viewport"> | ||
<meta content="The easiest way to create, share and model Linked Atomic Data." name="description"> | ||
<link href="https://joepio.github.io/atomic-data-browser/icon.png" rel="icon" type="image/png"> | ||
<link href="https://joepio.github.io/atomic-data-browser/apple-touch-icon.png" rel="apple-touch-icon" sizes="180x180"> | ||
<link href="https://joepio.github.io/atomic-data-browser/favicon-32x32.png" rel="icon" sizes="32x32" type="image/png"> | ||
<link href="https://joepio.github.io/atomic-data-browser/favicon-16x16.png" rel="icon" sizes="16x16" type="image/png"> | ||
<link href="https://joepio.github.io/atomic-data-browser/site.webmanifest" rel="manifest"> | ||
<link color="#1e43a3" href="https://joepio.github.io/atomic-data-browser/safari-pinned-tab.svg" rel="mask-icon"> | ||
<meta content="#ffffff" name="msapplication-TileColor"> | ||
<meta content="#ffffff" name="theme-color"> | ||
<meta content="yes" name="apple-mobile-web-app-capable"> | ||
<meta content="yes" name="mobile-web-app-capable"> | ||
<title>Atomic Data Browser</title> | ||
</head> | ||
|
||
<body> | ||
<div id="root"></div> | ||
<script src="https://joepio.github.io/atomic-data-browser/dist/index.js" type="module"></script> | ||
<script>{ script }</script> | ||
</body> | ||
|
||
</html> |
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,4 @@ | ||
# Generated by Cargo | ||
# will have compiled files and executables | ||
/target/ | ||
WixTools |
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,34 @@ | ||
[package] | ||
authors = ["you"] | ||
build = "src/build.rs" | ||
default-run = "atomic-server-tauri" | ||
description = "Atomic Server" | ||
edition = "2018" | ||
license = "" | ||
name = "atomic-server-tauri" | ||
repository = "" | ||
version = "0.28.3" | ||
|
||
[build-dependencies] | ||
[build-dependencies.tauri-build] | ||
version = "1.0.0-beta.4" | ||
|
||
[dependencies] | ||
actix-rt = "1.1.1" | ||
serde_json = "1.0" | ||
|
||
[dependencies.atomic-server] | ||
path = "../server" | ||
version = "0.28.2" | ||
|
||
[dependencies.serde] | ||
features = ["derive"] | ||
version = "1.0" | ||
|
||
[dependencies.tauri] | ||
features = ["api-all", "system-tray"] | ||
version = "1.0.0-beta.8" | ||
|
||
[features] | ||
custom-protocol = ["tauri/custom-protocol"] | ||
default = ["custom-protocol"] |
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,8 @@ | ||
# Atomic-server Tauri | ||
|
||
```sh | ||
# install tauri | ||
yarn global add @tauri/tauri-cli | ||
# run dev server | ||
tauri dev | ||
``` |
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.
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,14 @@ | ||
max_width = 100 | ||
hard_tabs = false | ||
tab_spaces = 2 | ||
newline_style = "Auto" | ||
use_small_heuristics = "Default" | ||
reorder_imports = true | ||
reorder_modules = true | ||
remove_nested_parens = true | ||
edition = "2018" | ||
merge_derives = true | ||
use_try_shorthand = false | ||
use_field_init_shorthand = false | ||
force_explicit_abi = true | ||
imports_granularity = "Crate" |
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() | ||
} |
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 @@ | ||
mod menu; | ||
mod system_tray; | ||
|
||
pub async fn test() { | ||
println!("test local"); | ||
} | ||
|
||
fn main() { | ||
let ctx = tauri::generate_context!(); | ||
|
||
let config: atomic_server_lib::config::Config = atomic_server_lib::config::init() | ||
.map_err(|e| format!("Initialization failed: {}", e)) | ||
.expect("failed init config"); | ||
|
||
// Find a way to combine actix and tauri runtimes... | ||
{ | ||
// let config_clone = config.clone(); | ||
// atomic_server_lib::serve::serve(&config_clone); | ||
} | ||
tauri::Builder::default() | ||
.menu(crate::menu::build(&ctx)) | ||
.on_menu_event(crate::menu::handle) | ||
.system_tray(crate::system_tray::build()) | ||
.on_system_tray_event(move |e, h| { | ||
let cfg = config.clone(); | ||
crate::system_tray::handle(e, h, &cfg) | ||
}) | ||
.run(ctx) | ||
.expect("Tauri Error."); | ||
} |
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,103 @@ | ||
use tauri::{ | ||
api::shell, utils::assets::EmbeddedAssets, Context, CustomMenuItem, Menu, MenuItem, Submenu, | ||
WindowMenuEvent, | ||
}; | ||
|
||
/// Handle events on menu items | ||
pub fn handle(event: WindowMenuEvent) { | ||
let event_name = event.menu_item_id(); | ||
event.window().emit("menu", event_name).unwrap(); | ||
match event_name { | ||
"Learn More" => { | ||
shell::open( | ||
"https://github.com/joepio/atomic-data-rust".to_string(), | ||
None, | ||
) | ||
.unwrap(); | ||
} | ||
_ => {} | ||
} | ||
} | ||
|
||
/// Create the task bar menu items | ||
pub fn build(ctx: &Context<EmbeddedAssets>) -> Menu { | ||
let menu = Menu::new() | ||
.add_default_app_submenu(&ctx.package_info().name) | ||
.add_default_edit_submenu() | ||
.add_default_view_submenu() | ||
.add_default_window_submenu() | ||
.add_submenu(Submenu::new( | ||
"Help", | ||
Menu::new().add_item(CustomMenuItem::new("github", "GitHub")), | ||
)); | ||
menu | ||
} | ||
|
||
trait AddDefaultSubmenus { | ||
fn add_default_app_submenu(self, app_name: &str) -> Self; | ||
fn add_default_file_submenu(self) -> Self; | ||
fn add_default_edit_submenu(self) -> Self; | ||
fn add_default_view_submenu(self) -> Self; | ||
fn add_default_window_submenu(self) -> Self; | ||
} | ||
|
||
impl AddDefaultSubmenus for Menu { | ||
fn add_default_app_submenu(self, app_name: &str) -> Menu { | ||
#[cfg(target_os = "macos")] | ||
return self.add_submenu(Submenu::new( | ||
app_name.to_string(), | ||
Menu::new() | ||
.add_native_item(MenuItem::About(app_name.to_string())) | ||
.add_native_item(MenuItem::Separator) | ||
.add_native_item(MenuItem::Hide) | ||
.add_native_item(MenuItem::HideOthers) | ||
.add_native_item(MenuItem::ShowAll) | ||
.add_native_item(MenuItem::Separator) | ||
.add_native_item(MenuItem::Quit), | ||
)); | ||
#[cfg(not(target_os = "macos"))] | ||
return self; | ||
} | ||
fn add_default_file_submenu(self) -> Menu { | ||
self.add_submenu(Submenu::new( | ||
"File", | ||
Menu::new().add_native_item(MenuItem::CloseWindow), | ||
)) | ||
} | ||
|
||
fn add_default_edit_submenu(self) -> Menu { | ||
self.add_submenu(Submenu::new("Edit", { | ||
let mut menu = Menu::new() | ||
.add_native_item(MenuItem::Undo) | ||
.add_native_item(MenuItem::Redo) | ||
.add_native_item(MenuItem::Separator) | ||
.add_native_item(MenuItem::Cut) | ||
.add_native_item(MenuItem::Copy) | ||
.add_native_item(MenuItem::Paste); | ||
#[cfg(not(target_os = "macos"))] | ||
{ | ||
menu = menu.add_native_item(MenuItem::Separator); | ||
} | ||
menu = menu.add_native_item(MenuItem::SelectAll); | ||
// macOS automatically adds "Start Dictation" and "Emoji & Symbols" to | ||
// the bottom of the Edit menu | ||
menu | ||
})) | ||
} | ||
|
||
fn add_default_view_submenu(self) -> Menu { | ||
self.add_submenu(Submenu::new( | ||
"View", | ||
Menu::new().add_native_item(MenuItem::EnterFullScreen), | ||
)) | ||
} | ||
|
||
fn add_default_window_submenu(self) -> Menu { | ||
self.add_submenu(Submenu::new( | ||
"Window", | ||
Menu::new() | ||
.add_native_item(MenuItem::Minimize) | ||
.add_native_item(MenuItem::Zoom), | ||
)) | ||
} | ||
} |
Oops, something went wrong.