use the scan mark in the taskbar
This commit is contained in:
@@ -52,7 +52,7 @@ tauri = { version = "2.11", features = ["protocol-asset"] }
|
||||
tauri-plugin-dialog = "2"
|
||||
tauri-plugin-global-shortcut = "2"
|
||||
windows-capture = "2.0"
|
||||
windows = { version = "0.62", features = ["Win32_UI_WindowsAndMessaging", "Win32_UI_Input_KeyboardAndMouse", "Win32_UI_Shell", "Win32_UI_HiDpi", "Win32_Foundation", "Win32_Graphics_Dwm", "Win32_Graphics_Gdi", "Win32_Graphics_Direct3D", "Win32_Graphics_Direct3D11", "Win32_Graphics_Dxgi", "Win32_Graphics_Dxgi_Common", "Win32_System_SystemInformation", "Win32_Media_Audio", "Win32_Media_Multimedia", "Win32_System_Com", "Win32_System_Com_StructuredStorage", "Win32_System_Threading", "Win32_System_Variant", "Win32_Storage_FileSystem"] }
|
||||
windows = { version = "0.62", features = ["Win32_UI_WindowsAndMessaging", "Win32_UI_Input_KeyboardAndMouse", "Win32_UI_Shell", "Win32_UI_HiDpi", "Win32_Foundation", "Win32_Graphics_Dwm", "Win32_Graphics_Gdi", "Win32_Graphics_Direct3D", "Win32_Graphics_Direct3D11", "Win32_Graphics_Dxgi", "Win32_Graphics_Dxgi_Common", "Win32_System_SystemInformation", "Win32_Media_Audio", "Win32_Media_Multimedia", "Win32_System_Com", "Win32_System_Com_StructuredStorage", "Win32_System_Threading", "Win32_System_LibraryLoader", "Win32_System_Variant", "Win32_Storage_FileSystem"] }
|
||||
tokio = { version = "1.47", features = ["rt-multi-thread", "macros"] }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
|
||||
@@ -2,6 +2,7 @@ use std::path::PathBuf;
|
||||
use std::process::Command;
|
||||
|
||||
fn main() {
|
||||
println!("cargo:rerun-if-changed=icons/icon.ico");
|
||||
tauri_build::build();
|
||||
compile_shaders();
|
||||
}
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 29 KiB |
@@ -2309,6 +2309,23 @@ fn show_startup_error(message: &str) {
|
||||
}
|
||||
}
|
||||
|
||||
fn set_taskbar_icon(window: &tauri::WebviewWindow) -> Result<()> {
|
||||
use windows::core::PCWSTR;
|
||||
use windows::Win32::Foundation::{HINSTANCE, HWND, LPARAM, WPARAM};
|
||||
use windows::Win32::System::LibraryLoader::GetModuleHandleW;
|
||||
use windows::Win32::UI::WindowsAndMessaging::{LoadIconW, SendMessageW, ICON_BIG, WM_SETICON};
|
||||
|
||||
let hwnd = HWND(window.hwnd()?.0);
|
||||
// SAFETY: 32512 is the shared executable icon resource from tauri-build.
|
||||
unsafe {
|
||||
let module = GetModuleHandleW(PCWSTR::null())?;
|
||||
let resource = PCWSTR(std::ptr::without_provenance(32512));
|
||||
let icon = LoadIconW(Some(HINSTANCE(module.0)), resource)?;
|
||||
SendMessageW(hwnd, WM_SETICON, Some(WPARAM(ICON_BIG as usize)), Some(LPARAM(icon.0 as isize)));
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// # Panics
|
||||
///
|
||||
/// Panics if the executable's own directory cannot be resolved or if
|
||||
@@ -2464,6 +2481,9 @@ pub fn run() {
|
||||
)
|
||||
.manage(state)
|
||||
.setup(|app| {
|
||||
if let Some(main) = app.get_webview_window("main") {
|
||||
set_taskbar_icon(&main)?;
|
||||
}
|
||||
if let Some(overlay) = app.get_webview_window("overlay") {
|
||||
if let Err(error) = overlay_chrome::configure(&overlay) {
|
||||
tracing::warn!(%error, "could not configure the capture frame's native styles");
|
||||
|
||||
Reference in New Issue
Block a user