Skip to content

Commit 215ff5c

Browse files
add usr ico and toggle background-color
1 parent e228d2b commit 215ff5c

File tree

16 files changed

+128
-54
lines changed

16 files changed

+128
-54
lines changed

guide.txt

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,16 @@ src-tauri:
1313
} -> Done!
1414

1515

16-
setting: use py to change file and check content of file
16+
setting: use py to change file and check content of file
17+
18+
setup-tree:
19+
20+
Tzcode
21+
├── setup.ini
22+
├── Tiks
23+
│   ├── bin
24+
│   │  └──tiks.exe
25+
│   ├── error.log
26+
│   └── user
27+
├── .Tzocde
28+
│   └── ...

sh/mac_linux/Tzcode.sh

Lines changed: 0 additions & 13 deletions
This file was deleted.

sh/mac_linux/setup.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
#!/bin/bash
22

33
# 获取用户主目录路径
4-
HOME_DIR="$HOME"
4+
HOME_DIR="$HOME"/Tzcode
55

66
# 创建 Tiks 文件夹
7-
APP_DIR="$HOME_DIR/Tiks"
8-
mkdir -p "$APP_DIR"
7+
COMMAND_DIR="$HOME_DIR/.Tiks"
8+
mkdir -p "$COMMAND_DIR"
99

10+
# 创建 Tiks 文件夹
11+
APP_DIR="$HOME_DIR/tzcode"
12+
mkdir -p "$APP_DIR"
1013

1114
# create your user_pd
1215
# write in tiks_command-> root
13-
USER_FILE="$APP_DIR/user"
16+
USER_FILE="$COMMAND_DIR/user.ini"
1417
touch "$USER_FILE"
1518

1619
APP_DIR_BIN="$HOME_DIR/Tiks/bin"

sh/window/Tzcode.bat

Lines changed: 0 additions & 5 deletions
This file was deleted.

sh/window/setup.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
setlocal
33

44
@rem 获取用户主目录路径
5-
set "HOME_DIR=%USERPROFILE%"
5+
set "HOME_DIR=%USERPROFILE%\Tzcode"
66

77
@rem 设置 .Tiks 文件夹路径
88
set "TIKS_DIR=%HOME_DIR%\.Tiks"

space/space.json

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,23 @@
11
{
22
"workspace": {
3-
"back-color": "black",
4-
"font-family": "Arial, sans-serif",
5-
"file_dir":{
6-
"width":"20%",
7-
"background-color":"#1e1e1e"
8-
},
9-
"main-content":{
10-
"editor":{
11-
"height-flex":"9",
12-
"background-color":"#1e1e1e",
13-
"font-size":"unset",
14-
"top-tab":{
15-
"background-color":"#gray"
16-
}
3+
"background":{
4+
"menu":{
5+
".titlebar":"#8f9092"
6+
},
7+
"footer":{
8+
".footer":"#8f9092"
179
},
1810
"terimal":{
19-
"height-flex":"0.95",
20-
"background-color":"#1e1e1e",
21-
"font-size":"samller",
22-
"font-weight":"normal",
23-
"font-family":" "
11+
"['.bottom-section','input']":""
12+
},
13+
"code-editor":{
14+
".CodeMirror":""
15+
},
16+
"left-file":{
17+
".left-file":""
18+
},
19+
"right":{
20+
"['.right-file','.sidebar']":""
2421
}
2522
}
2623
}

src-tauri/src/main.rs

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
33

44
use tauri::api::dialog::message;
5-
use tauri::{generate_context, generate_handler};
5+
use tauri::{generate_context, generate_handler, WindowEvent};
66

77
mod page;
88
mod tests;
@@ -12,6 +12,8 @@ mod splashscreen;
1212

1313
use std::process::Command;
1414
use tauri::Manager;
15+
use std::sync::Arc;
16+
use std::sync::Mutex;
1517
use splashscreen::close_init;
1618
use page::file::*;
1719
use page::terimal::{pwd_tauri,whoami_tauri,run_command};
@@ -29,24 +31,31 @@ fn main() {
2931
Command::new("../target/release/tiks").status().expect("Failed run");
3032
}
3133

32-
let _python_server = Command::new("python")
34+
let python_server = Command::new("python")
3335
.arg("../py/server.py")
3436
.spawn()
3537
.expect("Failed to start Python server");
3638

39+
let python_server = Arc::new(Mutex::new(python_server));
3740

3841
tauri::Builder::default()
3942
.setup({
4043
move |app| {
4144
let main_window = app.get_window("main").unwrap();
4245

4346
// 添加更新检查逻辑
47+
let main_window_clone = main_window.clone();
48+
let main_window_clone_2 = main_window_clone.clone();
49+
4450
let app_handle = app.handle().clone();
51+
52+
let app_handle_2 = app_handle.clone();
53+
4554
tauri::async_runtime::spawn(async move {
4655
match app_handle.updater().check().await {
4756
Ok(update) => {
4857
if update.is_update_available() {
49-
message(Some(&main_window), "Update Available", "A new version is available. It will be installed when you restart the application.");
58+
message(Some(&main_window_clone), "Update Available", "A new version is available. It will be installed when you restart the application.");
5059
update.download_and_install().await.unwrap();
5160
}
5261
},
@@ -55,6 +64,35 @@ fn main() {
5564
}
5665
}
5766
});
67+
68+
69+
main_window.on_window_event({
70+
move |event| {
71+
let app_handle = app_handle_2.clone();
72+
if let WindowEvent::CloseRequested { api, .. } = event {
73+
let mut server = python_server.lock().unwrap();
74+
server.kill().expect("Failed to kill Python server");
75+
api.prevent_close();
76+
77+
// 提示用户是否要更新并关闭应用
78+
tauri::api::dialog::ask(
79+
Some(&main_window_clone_2),
80+
"Confirm Exit",
81+
"Do you want to update and close the application?",
82+
move |response| {
83+
if response {
84+
tauri::async_runtime::spawn(async move {
85+
app_handle.updater().should_install(|_current, _latest| true);
86+
});
87+
} else {
88+
// 仅关闭应用而不更新
89+
app_handle.exit(0);
90+
}
91+
},
92+
);
93+
}
94+
}
95+
});
5896
Ok(())
5997
}
6098
})

src-tauri/src/page/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ pub mod new_window{
3030
)
3131
.title("setting")
3232
.fullscreen(false)
33-
.resizable(true)
33+
.resizable(false)
3434
.decorations(false)
3535
.inner_size(300.0, 250.0)
3636
.visible(true)

src-tauri/tauri.conf.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
"providerShortName": null,
6161
"signingIdentity": null
6262
},
63-
"resources": [],
63+
"resources": ["../py","../sh","../space"],
6464
"shortDescription": "",
6565
"targets": "all",
6666
"windows": {

ui/css/dir.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@
5151

5252
.left-button {
5353
cursor: pointer;
54+
height: 4%;
55+
margin-bottom: 100%;
5456
}
5557

5658
.left-button:hover {

0 commit comments

Comments
 (0)