-
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.
enable click through overlay available on all platform, change github…
… build action to build all os platform.
- Loading branch information
Showing
9 changed files
with
53 additions
and
73 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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,49 +1,29 @@ | ||
use tauri::{AppHandle, Window}; | ||
|
||
// click through window | ||
// credit: https://github.com/4t145/tauri-windows-clickthrough-example | ||
pub fn allow_window_click_through(window: Window, allow_click_through_window: bool) { | ||
let hwnd = window.hwnd().unwrap().0; | ||
let _pre_val; | ||
let hwnd = windows::Win32::Foundation::HWND(hwnd); | ||
unsafe { | ||
use windows::Win32::UI::WindowsAndMessaging::*; | ||
let nindex = GWL_EXSTYLE; | ||
let style = | ||
WS_EX_APPWINDOW | WS_EX_COMPOSITED | WS_EX_LAYERED | WS_EX_TRANSPARENT | WS_EX_TOPMOST; | ||
|
||
if allow_click_through_window { | ||
_pre_val = SetWindowLongA(hwnd, nindex, style.0 as i32); | ||
} else { | ||
_pre_val = SetWindowLongA(hwnd, nindex, !style.0 as i32); | ||
} | ||
}; | ||
} | ||
use tauri::AppHandle; | ||
|
||
pub fn reopen_main_window(app: &AppHandle) { | ||
let window = tauri::WindowBuilder::new(app, "main", tauri::WindowUrl::App("/".into())) | ||
.fullscreen(true) | ||
.resizable(false) | ||
.transparent(true) | ||
.decorations(false) | ||
.always_on_top(true) | ||
.title("WindowPet") | ||
.skip_taskbar(true) | ||
.build() | ||
.unwrap(); | ||
|
||
allow_window_click_through(window, true); | ||
|
||
// allow click through window | ||
window | ||
.set_ignore_cursor_events(true) | ||
.unwrap_or_else(|err| println!("{:?}", err)); | ||
|
||
} | ||
|
||
pub fn open_setting_window(app: &AppHandle) { | ||
let _window = tauri::WindowBuilder::new( | ||
app, | ||
"setting", | ||
tauri::WindowUrl::App("/setting".into()), | ||
) | ||
.title("WindowPet Setting") | ||
.inner_size(800.0, 620.0) | ||
.build() | ||
.unwrap(); | ||
let _window = | ||
tauri::WindowBuilder::new(app, "setting", tauri::WindowUrl::App("/setting".into())) | ||
.title("WindowPet Setting") | ||
.inner_size(800.0, 620.0) | ||
.build() | ||
.unwrap(); | ||
return; | ||
} | ||
} |
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
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,15 @@ | ||
import { enable, isEnabled, disable } from "tauri-plugin-autostart-api"; | ||
|
||
export async function toggleAutoStartUp(isAutoStartUp: boolean) { | ||
const hasEnabledStartUp = await isEnabled(); | ||
|
||
if (isAutoStartUp) { | ||
if (hasEnabledStartUp) return; | ||
await enable(); | ||
return; | ||
} | ||
|
||
if (hasEnabledStartUp) { | ||
await disable(); | ||
} | ||
}; |