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-dialog = "2"
|
||||||
tauri-plugin-global-shortcut = "2"
|
tauri-plugin-global-shortcut = "2"
|
||||||
windows-capture = "2.0"
|
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"] }
|
tokio = { version = "1.47", features = ["rt-multi-thread", "macros"] }
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ use std::path::PathBuf;
|
|||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
println!("cargo:rerun-if-changed=icons/icon.ico");
|
||||||
tauri_build::build();
|
tauri_build::build();
|
||||||
compile_shaders();
|
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
|
||||||
///
|
///
|
||||||
/// Panics if the executable's own directory cannot be resolved or if
|
/// Panics if the executable's own directory cannot be resolved or if
|
||||||
@@ -2464,6 +2481,9 @@ pub fn run() {
|
|||||||
)
|
)
|
||||||
.manage(state)
|
.manage(state)
|
||||||
.setup(|app| {
|
.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 Some(overlay) = app.get_webview_window("overlay") {
|
||||||
if let Err(error) = overlay_chrome::configure(&overlay) {
|
if let Err(error) = overlay_chrome::configure(&overlay) {
|
||||||
tracing::warn!(%error, "could not configure the capture frame's native styles");
|
tracing::warn!(%error, "could not configure the capture frame's native styles");
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
import { onMount } from "svelte"
|
import { onMount } from "svelte"
|
||||||
import { isTauri } from "@tauri-apps/api/core"
|
import { isTauri } from "@tauri-apps/api/core"
|
||||||
import { getCurrentWindow } from "@tauri-apps/api/window"
|
import { getCurrentWindow } from "@tauri-apps/api/window"
|
||||||
|
import brandMark from "./bytesize-mark.svg"
|
||||||
import { IconAdjustmentsHorizontal, IconCopy, IconMinus, IconPencil, IconScan, IconSquare, IconX } from "./icons"
|
import { IconAdjustmentsHorizontal, IconCopy, IconMinus, IconPencil, IconScan, IconSquare, IconX } from "./icons"
|
||||||
let { current, onCapture, onEditor, onSettings, disabled = false }: {
|
let { current, onCapture, onEditor, onSettings, disabled = false }: {
|
||||||
current?: "capture" | "editor" | "settings"; onCapture?: () => void; onEditor?: () => void
|
current?: "capture" | "editor" | "settings"; onCapture?: () => void; onEditor?: () => void
|
||||||
@@ -49,7 +50,7 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<header class="app-bar" data-tauri-drag-region>
|
<header class="app-bar" data-tauri-drag-region>
|
||||||
<div class="row brand" data-tauri-drag-region><span class="brand-mark"><IconScan size={16} /></span><strong>ByteSize</strong></div>
|
<div class="row brand" data-tauri-drag-region><img class="brand-mark" src={brandMark} alt="" draggable="false" /><strong>ByteSize</strong></div>
|
||||||
{#if current}
|
{#if current}
|
||||||
<nav class="row" aria-label="ByteSize workspace">
|
<nav class="row" aria-label="ByteSize workspace">
|
||||||
<button type="button" class="button ghost" aria-current={current === "capture" ? "page" : undefined} disabled={!onCapture} onclick={onCapture}>
|
<button type="button" class="button ghost" aria-current={current === "capture" ? "page" : undefined} disabled={!onCapture} onclick={onCapture}>
|
||||||
@@ -101,7 +102,7 @@
|
|||||||
}
|
}
|
||||||
.brand { align-self: stretch; font: 600 13px "Segoe UI", sans-serif; }
|
.brand { align-self: stretch; font: 600 13px "Segoe UI", sans-serif; }
|
||||||
.brand > * { pointer-events: none; }
|
.brand > * { pointer-events: none; }
|
||||||
.brand-mark { width: 27px; height: 27px; display: grid; place-items: center; border-radius: var(--control-radius); background: var(--signal); color: var(--signal-ink); }
|
.brand-mark { display:block; width:27px; height:27px; }
|
||||||
.button { min-height: 35px; font-size: 13px; }
|
.button { min-height: 35px; font-size: 13px; }
|
||||||
.button[aria-current="page"] { background: var(--input); color: var(--ink); }
|
.button[aria-current="page"] { background: var(--input); color: var(--ink); }
|
||||||
.button[aria-current="page"] :global(svg) { color: var(--signal); }
|
.button[aria-current="page"] :global(svg) { color: var(--signal); }
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 27 27">
|
||||||
|
<rect width="27" height="27" rx="8" fill="#d8f578"/>
|
||||||
|
<!-- Tabler Scan -->
|
||||||
|
<g transform="translate(5.5 5.5) scale(.6666667)" fill="none" stroke="#202814" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||||||
|
<path d="M5 12h14"/>
|
||||||
|
<path d="M3 7v-2a2 2 0 0 1 2 -2h2"/>
|
||||||
|
<path d="M3 17v2a2 2 0 0 0 2 2h2"/>
|
||||||
|
<path d="M17 3h2a2 2 0 0 1 2 2v2"/>
|
||||||
|
<path d="M17 21h2a2 2 0 0 0 2 -2v-2"/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 488 B |
Reference in New Issue
Block a user