Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: configure window zoom #775

Draft
wants to merge 1 commit into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ discord-rich-presence = "0.2.3"
chrono = "0.4.23"
window-shadows = "0.2.0"
tokio = { version = "1.23", features = ["process", "io-util", "sync"] }
objc = "0.2.7"

[features]
# by default Tauri runs in production mode
Expand Down
25 changes: 25 additions & 0 deletions src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
windows_subsystem = "windows"
)]

// #[cfg(target_os = "macos")]
// #[macro_use]
// extern crate objc;

use discord_rich_presence::{activity, DiscordIpc, DiscordIpcClient};
use tauri::{Manager, Menu};
use terminal::AllTerminals;
Expand All @@ -22,6 +26,27 @@ fn main() {
.setup(|app| {
// `main` here is the window label; it is defined under `tauri.conf.json`
let main_window = app.get_window("main").unwrap();
// TODO: Implement zoom events
// main_window.with_webview(|webview| {
// #[cfg(target_os = "linux")]
// {
// // see https://docs.rs/webkit2gtk/latest/webkit2gtk/struct.WebView.html
// // and https://docs.rs/webkit2gtk/latest/webkit2gtk/trait.WebViewExt.html
// use webkit2gtk::traits::WebViewExt;
// webview.inner().set_zoom_level(1);
// }

// #[cfg(windows)]
// unsafe {
// // see https://docs.rs/webview2-com/0.17.0/webview2_com/Microsoft/Web/WebView2/Win32/struct.ICoreWebView2Controller.html
// webview.controller().SetZoomFactor(1).unwrap();
// }

// #[cfg(target_os = "macos")]
// unsafe {
// let _: () = msg_send![webview.inner(), setPageZoom: 1];
// }
// });

if cfg!(target_os = "windows") {
set_shadow(&main_window, true).expect("Unable to set window shadow");
Expand Down