applybar complete
@@ -1,3 +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
|
||||
|
||||
@@ -1,27 +1,24 @@
|
||||
[package]
|
||||
name = "app"
|
||||
name = "wallitor-gui"
|
||||
version = "0.1.0"
|
||||
description = "A Tauri App"
|
||||
authors = ["you"]
|
||||
license = ""
|
||||
repository = ""
|
||||
default-run = "app"
|
||||
edition = "2021"
|
||||
rust-version = "1.60"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[lib]
|
||||
name = "wallitor_gui_lib"
|
||||
crate-type = ["staticlib", "cdylib", "rlib"]
|
||||
|
||||
[build-dependencies]
|
||||
tauri-build = { version = "2.0.0-rc", features = [] }
|
||||
|
||||
[dependencies]
|
||||
serde_json = "1.0"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
tauri = { version = "2.0.0-rc", features = [] }
|
||||
tauri-plugin-shell = "2.0.0-rc"
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
serde_json = "1"
|
||||
window-vibrancy = "0.5.2"
|
||||
tauri-plugin-fs = "2.0.0-rc"
|
||||
|
||||
[features]
|
||||
# this feature is used for production builds or when `devPath` points to the filesystem and the built-in dev server is disabled.
|
||||
# If you use cargo directly instead of tauri's cli you can use this feature flag to switch between tauri's `dev` and `build` modes.
|
||||
# DO NOT REMOVE!!
|
||||
custom-protocol = [ "tauri/custom-protocol" ]
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
fn main() {
|
||||
tauri_build::build()
|
||||
tauri_build::build()
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"$schema": "../gen/schemas/desktop-schema.json",
|
||||
"identifier": "default",
|
||||
"description": "Capability for the main window",
|
||||
"windows": ["main"],
|
||||
"permissions": [
|
||||
"core:default",
|
||||
"shell:allow-open"
|
||||
]
|
||||
}
|
||||
@@ -1 +1 @@
|
||||
{"migrated":{"identifier":"migrated","description":"permissions that were migrated from v1","local":true,"windows":["main"],"permissions":["core:default","core:window:allow-maximize","core:window:allow-unmaximize","core:window:allow-toggle-maximize","core:window:allow-minimize","core:window:allow-unminimize","core:window:allow-show","core:window:allow-hide","core:window:allow-close","core:window:allow-start-dragging"]}}
|
||||
{"default":{"identifier":"default","description":"Capability for the main window","local":true,"windows":["main"],"permissions":["core:default","shell:allow-open"]},"migrated":{"identifier":"migrated","description":"permissions that were migrated from v1","local":true,"windows":["main"],"permissions":["core:default","core:window:allow-maximize","core:window:allow-unmaximize","core:window:allow-toggle-maximize","core:window:allow-minimize","core:window:allow-unminimize","core:window:allow-show","core:window:allow-hide","core:window:allow-close","core:window:allow-start-dragging"]}}
|
||||
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 6.8 KiB |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 974 B |
|
Before Width: | Height: | Size: 9.0 KiB After Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 3.9 KiB |
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 7.6 KiB |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 903 B |
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 8.4 KiB |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 7.4 KiB After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 85 KiB |
|
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 14 KiB |
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "test1",
|
||||
"info": {
|
||||
"type": "",
|
||||
"description": "test wallpaper 1",
|
||||
"created": 0
|
||||
},
|
||||
"option": {
|
||||
"mute": true
|
||||
}
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 386 KiB |
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "test2",
|
||||
"info": {
|
||||
"type": "",
|
||||
"description": "test wallpaper 2",
|
||||
"created": 0
|
||||
},
|
||||
"option": {
|
||||
"mute": true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
mod setup;
|
||||
mod reader;
|
||||
|
||||
use std::{fs, path};
|
||||
use serde_json;
|
||||
use std::path::Path;
|
||||
use tauri::ipc::Response;
|
||||
|
||||
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
||||
pub fn run() {
|
||||
tauri::Builder::default()
|
||||
.setup(setup::init)
|
||||
.plugin(tauri_plugin_fs::init())
|
||||
.invoke_handler(tauri::generate_handler![read_resource_dir,get_file])
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
async fn read_resource_dir() -> String {
|
||||
let mut file_map = reader::FileMap::new();
|
||||
let path = Path::new("./resource");
|
||||
if let Ok(false) = fs::exists(path){
|
||||
fs::create_dir(path).expect("Can't create dir");
|
||||
}
|
||||
file_map.read_resourse_directory(path).expect("Can't read dir");
|
||||
serde_json::to_string(&file_map).unwrap()
|
||||
}
|
||||
|
||||
// remember to call `.manage(MyState::default())`
|
||||
#[tauri::command]
|
||||
async fn get_file(path:String) -> Response{
|
||||
let p = path::Path::new(&path);
|
||||
if let Ok(true) = fs::exists(p){
|
||||
let data: Vec<u8> = fs::read(p).unwrap();
|
||||
return tauri::ipc::Response::new(data);
|
||||
}
|
||||
tauri::ipc::Response::new(String::from(""))
|
||||
}
|
||||
@@ -1,34 +1,6 @@
|
||||
// Prevents additional console window on Windows in release, DO NOT REMOVE!!
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
||||
|
||||
mod setup;
|
||||
mod reader;
|
||||
|
||||
use std::fs;
|
||||
use serde_json;
|
||||
use std::path::Path;
|
||||
|
||||
fn main() {
|
||||
tauri::Builder::default()
|
||||
.setup(setup::init)
|
||||
.invoke_handler(tauri::generate_handler![test_command])
|
||||
.invoke_handler(tauri::generate_handler![read_resource_dir])
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
wallitor_gui_lib::run()
|
||||
}
|
||||
|
||||
|
||||
#[tauri::command]
|
||||
async fn test_command() -> String {
|
||||
return String::from("Hello World");
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
async fn read_resource_dir() -> String {
|
||||
let file_map = reader::FileMap::new();
|
||||
let path = Path::new("./resource");
|
||||
if let Ok(false) = fs::exists(path){
|
||||
fs::create_dir(path).expect("Can't create dir");
|
||||
}
|
||||
serde_json::to_string(&file_map).unwrap()
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
use std::fs;
|
||||
use std::path::Path;
|
||||
use serde::{ Serialize,Serializer};
|
||||
use serde_json;
|
||||
use std::collections::HashMap;
|
||||
|
||||
enum FileType {
|
||||
@@ -45,7 +44,7 @@ impl FileMap {
|
||||
Ok(files)
|
||||
}
|
||||
|
||||
fn read_resourse_directory(&mut self,p:&Path)->std::io::Result<()>{
|
||||
pub fn read_resourse_directory(&mut self,p:&Path)->std::io::Result<()>{
|
||||
for entry in fs::read_dir(p)?{
|
||||
let dir = entry?;
|
||||
let path = dir.path();
|
||||
|
||||
@@ -1,15 +1,11 @@
|
||||
use tauri::{App, Manager};
|
||||
use window_vibrancy::{self, NSVisualEffectMaterial};
|
||||
#[cfg(target_os = "windows")]
|
||||
use window_vibrancy;
|
||||
|
||||
|
||||
/// setup
|
||||
pub fn init(app: &mut App) -> std::result::Result<(), Box<dyn std::error::Error>> {
|
||||
let win = app.get_webview_window("main").unwrap();
|
||||
// 仅在 macOS 下执行
|
||||
#[cfg(target_os = "macos")]
|
||||
window_vibrancy::apply_vibrancy(&win, NSVisualEffectMaterial::FullScreenUI)
|
||||
.expect("Unsupported platform! 'apply_vibrancy' is only supported on macOS");
|
||||
|
||||
// 仅在 windows 下执行
|
||||
#[cfg(target_os = "windows")]
|
||||
if let Err(_) = window_vibrancy::apply_mica(&win, None){
|
||||
|
||||
@@ -1,64 +1,37 @@
|
||||
{
|
||||
"$schema": "../node_modules/@tauri-apps/cli/schema.json",
|
||||
"build": {
|
||||
"beforeBuildCommand": "npm run build",
|
||||
"beforeDevCommand": "npm run dev",
|
||||
"frontendDist": "../dist",
|
||||
"devUrl": "http://localhost:5173"
|
||||
},
|
||||
"bundle": {
|
||||
"active": true,
|
||||
"category": "DeveloperTool",
|
||||
"copyright": "",
|
||||
"targets": "all",
|
||||
"externalBin": [],
|
||||
"icon": [
|
||||
"icons/32x32.png",
|
||||
"icons/128x128.png",
|
||||
"icons/128x128@2x.png",
|
||||
"icons/icon.icns",
|
||||
"icons/icon.ico"
|
||||
],
|
||||
"windows": {
|
||||
"certificateThumbprint": null,
|
||||
"digestAlgorithm": "sha256",
|
||||
"timestampUrl": ""
|
||||
},
|
||||
"longDescription": "",
|
||||
"macOS": {
|
||||
"entitlements": null,
|
||||
"exceptionDomain": "",
|
||||
"frameworks": [],
|
||||
"providerShortName": null,
|
||||
"signingIdentity": null
|
||||
},
|
||||
"resources": [],
|
||||
"shortDescription": "",
|
||||
"linux": {
|
||||
"deb": {
|
||||
"depends": []
|
||||
}
|
||||
}
|
||||
},
|
||||
"$schema": "https://schema.tauri.app/config/2.0.0-rc",
|
||||
"productName": "wallitor-gui",
|
||||
"mainBinaryName": "wallitor-gui",
|
||||
"version": "0.1.0",
|
||||
"identifier": "com.tauri.dev",
|
||||
"plugins": {},
|
||||
"identifier": "com.wallitor-gui.app",
|
||||
"build": {
|
||||
"beforeDevCommand": "pnpm dev",
|
||||
"devUrl": "http://localhost:5173",
|
||||
"beforeBuildCommand": "pnpm build",
|
||||
"frontendDist": "../dist"
|
||||
},
|
||||
"app": {
|
||||
"windows": [
|
||||
{
|
||||
"fullscreen": false,
|
||||
"resizable": true,
|
||||
"title": "wallitor-gui",
|
||||
"width": 800,
|
||||
"height": 600,
|
||||
"transparent": true,
|
||||
"width": 950,
|
||||
"height": 750,
|
||||
"decorations": false
|
||||
}
|
||||
],
|
||||
"security": {
|
||||
"csp": null
|
||||
}
|
||||
},
|
||||
"bundle": {
|
||||
"active": true,
|
||||
"targets": "all",
|
||||
"icon": [
|
||||
"icons/32x32.png",
|
||||
"icons/128x128.png",
|
||||
"icons/128x128@2x.png",
|
||||
"icons/icon.icns",
|
||||
"icons/icon.ico"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||