Skip to content

Commit 5ff399d

Browse files
Desktop: Display taskbar icon on Windows (#3376)
* task bar icon * limit cef render processes to 1 * disable more chrome features
1 parent 96c5e3e commit 5ff399d

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

desktop/src/cef/internal/browser_process_app.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,16 @@ impl<H: CefEventHandler> ImplApp for BrowserProcessAppImpl<H> {
3333

3434
fn on_before_command_line_processing(&self, _process_type: Option<&cef::CefString>, command_line: Option<&mut cef::CommandLine>) {
3535
if let Some(cmd) = command_line {
36+
cmd.append_switch_with_value(Some(&CefString::from("renderer-process-limit")), Some(&CefString::from("1")));
37+
cmd.append_switch_with_value(Some(&CefString::from("disk-cache-size")), Some(&CefString::from("0")));
38+
cmd.append_switch(Some(&CefString::from("incognito")));
39+
cmd.append_switch(Some(&CefString::from("no-first-run")));
40+
cmd.append_switch(Some(&CefString::from("disable-file-system")));
41+
cmd.append_switch(Some(&CefString::from("disable-local-storage")));
42+
cmd.append_switch(Some(&CefString::from("disable-background-networking")));
43+
cmd.append_switch(Some(&CefString::from("disable-audio-input")));
44+
cmd.append_switch(Some(&CefString::from("disable-audio-output")));
45+
3646
#[cfg(not(feature = "accelerated_paint"))]
3747
{
3848
// Disable GPU acceleration when accelerated_paint feature is not enabled

desktop/src/window/win.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
use winit::dpi::PhysicalSize;
12
use winit::event_loop::ActiveEventLoop;
23
use winit::icon::Icon;
3-
use winit::platform::windows::WinIcon;
4+
use winit::platform::windows::{WinIcon, WindowAttributesWindows};
45
use winit::window::{Window, WindowAttributes};
56

67
use crate::event::AppEventScheduler;
@@ -11,12 +12,10 @@ pub(super) struct NativeWindowImpl {
1112

1213
impl super::NativeWindow for NativeWindowImpl {
1314
fn configure(attributes: WindowAttributes, _event_loop: &dyn ActiveEventLoop) -> WindowAttributes {
14-
if let Ok(win_icon) = WinIcon::from_resource(1, None) {
15-
let icon = Icon(std::sync::Arc::new(win_icon));
16-
attributes.with_window_icon(Some(icon))
17-
} else {
18-
attributes
19-
}
15+
let icon = WinIcon::from_resource(1, Some(PhysicalSize::new(256, 256))).ok().map(|icon| Icon(std::sync::Arc::new(icon)));
16+
let win_window = WindowAttributesWindows::default().with_taskbar_icon(icon);
17+
let icon = WinIcon::from_resource(1, None).ok().map(|icon| Icon(std::sync::Arc::new(icon)));
18+
attributes.with_window_icon(icon).with_platform_attributes(Box::new(win_window))
2019
}
2120

2221
fn new(window: &dyn Window, _app_event_scheduler: AppEventScheduler) -> Self {

0 commit comments

Comments
 (0)