Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Clash Verge
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
many-archive
Clash Verge
Commits
41b19f69
There was an error fetching the commit references. Please try again later.
Unverified
Commit
41b19f69
authored
2 years ago
by
GyDi
Browse files
Options
Downloads
Patches
Plain Diff
fix: create window correctly
parent
f2bd6f1f
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src-tauri/src/main.rs
+6
-12
6 additions, 12 deletions
src-tauri/src/main.rs
src-tauri/src/utils/resolve.rs
+8
-37
8 additions, 37 deletions
src-tauri/src/utils/resolve.rs
src-tauri/tauri.conf.json
+5
-26
5 additions, 26 deletions
src-tauri/tauri.conf.json
with
19 additions
and
75 deletions
src-tauri/src/main.rs
+
6
−
12
View file @
41b19f69
...
...
@@ -19,18 +19,12 @@ use tauri::{
};
fn
main
()
->
std
::
io
::
Result
<
()
>
{
let
mut
context
=
tauri
::
generate_context!
();
let
verge
=
Verge
::
new
();
if
server
::
check_singleton
(
verge
.app_singleton_port
)
.is_err
()
{
println!
(
"app exists"
);
return
Ok
(());
}
{
let
verge
=
Verge
::
new
();
for
win
in
context
.config_mut
()
.tauri.windows
.iter_mut
()
{
if
verge
.enable_silent_start
.unwrap_or
(
false
)
{
win
.visible
=
false
;
if
server
::
check_singleton
(
verge
.app_singleton_port
)
.is_err
()
{
println!
(
"app exists"
);
return
Ok
(())
;
}
}
...
...
@@ -147,7 +141,7 @@ fn main() -> std::io::Result<()> {
#[allow(unused_mut)]
let
mut
app
=
builder
.build
(
context
)
.build
(
tauri
::
generate_
context
!
()
)
.expect
(
"error while running tauri application"
);
#[cfg(target_os
=
"macos"
)]
...
...
This diff is collapsed.
Click to expand it.
src-tauri/src/utils/resolve.rs
+
8
−
37
View file @
41b19f69
...
...
@@ -6,20 +6,24 @@ pub fn resolve_setup(app: &App) {
// init app config
init
::
init_app
(
app
.package_info
());
{
let
silent_start
=
{
let
global
=
Data
::
global
();
let
verge
=
global
.verge
.lock
();
let
singleton
=
verge
.app_singleton_port
.clone
();
// setup a simple http server for singleton
server
::
embed_server
(
&
app
.handle
(),
singleton
);
}
verge
.enable_silent_start
.clone
()
.unwrap_or
(
false
)
};
// core should be initialized after init_app fix #122
let
core
=
Core
::
global
();
core
.init
(
app
.app_handle
());
resolve_window
(
app
);
if
!
silent_start
||
cfg!
(
target_os
=
"macos"
)
{
create_window
(
&
app
.app_handle
());
}
}
/// reset system proxy
...
...
@@ -33,39 +37,6 @@ pub fn resolve_reset() {
crate
::
log_if_err!
(
service
.stop
());
}
/// customize the window theme
fn
resolve_window
(
app
:
&
App
)
{
let
window
=
app
.get_window
(
"main"
)
.unwrap
();
#[cfg(target_os
=
"windows"
)]
{
use
crate
::
utils
::
winhelp
;
use
window_shadows
::
set_shadow
;
use
window_vibrancy
::
apply_blur
;
let
_
=
window
.set_decorations
(
false
);
let
_
=
set_shadow
(
&
window
,
true
);
// todo
// win11 disable this feature temporarily due to lag
if
!
winhelp
::
is_win11
()
{
let
_
=
apply_blur
(
&
window
,
None
);
}
}
#[cfg(target_os
=
"macos"
)]
{
use
tauri
::
LogicalSize
;
use
tauri
::
Size
::
Logical
;
let
_
=
window
.set_decorations
(
true
);
let
_
=
window
.set_size
(
Logical
(
LogicalSize
{
width
:
800.0
,
height
:
620.0
,
}));
}
}
/// create main window
pub
fn
create_window
(
app_handle
:
&
AppHandle
)
{
if
let
Some
(
window
)
=
app_handle
.get_window
(
"main"
)
{
...
...
@@ -120,7 +91,7 @@ pub fn create_window(app_handle: &AppHandle) {
}
#[cfg(target_os
=
"macos"
)]
crate
::
log_if_err!
(
builder
.decorations
(
true
)
.inner_size
(
800.0
,
62
0
.0
)
.build
());
crate
::
log_if_err!
(
builder
.decorations
(
true
)
.inner_size
(
800.0
,
6
4
2.0
)
.build
());
#[cfg(target_os
=
"linux"
)]
crate
::
log_if_err!
(
builder
...
...
This diff is collapsed.
Click to expand it.
src-tauri/tauri.conf.json
+
5
−
26
View file @
41b19f69
...
...
@@ -25,13 +25,8 @@
"icons/icon-new.icns"
,
"icons/icon.ico"
],
"resources"
:
[
"resources"
],
"externalBin"
:
[
"sidecar/clash"
,
"sidecar/clash-meta"
],
"resources"
:
[
"resources"
],
"externalBin"
:
[
"sidecar/clash"
,
"sidecar/clash-meta"
],
"copyright"
:
"© 2022 zzzgydi All Rights Reserved"
,
"category"
:
"DeveloperTool"
,
"shortDescription"
:
"A Clash GUI based on tauri."
,
...
...
@@ -51,10 +46,7 @@
"digestAlgorithm"
:
"sha256"
,
"timestampUrl"
:
""
,
"wix"
:
{
"language"
:
[
"zh-CN"
,
"en-US"
]
"language"
:
[
"zh-CN"
,
"en-US"
]
}
}
},
...
...
@@ -81,22 +73,9 @@
"all"
:
true
}
},
"windows"
:
[
{
"title"
:
"Clash Verge"
,
"width"
:
800
,
"height"
:
636
,
"center"
:
true
,
"resizable"
:
true
,
"fullscreen"
:
false
,
"decorations"
:
false
,
"transparent"
:
true
,
"minWidth"
:
600
,
"minHeight"
:
520
}
],
"windows"
:
[],
"security"
:
{
"csp"
:
"script-src 'unsafe-eval' 'self'; default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self'; img-src data: 'self';"
}
}
}
\ No newline at end of file
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment