Skip to content

Commit

Permalink
fix compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
tk04 committed Mar 12, 2024
1 parent 44fc1ad commit 290c6bd
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 21 deletions.
26 changes: 13 additions & 13 deletions src-tauri/Cargo.lock

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

12 changes: 7 additions & 5 deletions src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[package]
name = "app"
version = "0.1.0"
description = "A Tauri App"
authors = ["you"]
name = "marker"
version = "1.0.0"
description = "A Secure Visual Markdown Editor"
authors = ["tk"]
license = ""
repository = ""
default-run = "app"
default-run = "marker"
edition = "2021"
rust-version = "1.60"

Expand All @@ -19,6 +19,8 @@ serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] }
tauri = { version = "1.6.0", features = [ "updater", "window-unmaximize", "window-maximize", "window-start-dragging", "shell-open", "protocol-asset", "shell-execute", "dialog-all", "fs-all", "path-all"] }
tauri-plugin-store = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v1" }

[target.'cfg(target_os = "macos")'.dependencies]
objc = "0.2.7"
cocoa = "0.25.0"

Expand Down
8 changes: 5 additions & 3 deletions src-tauri/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Prevents additional console window on Windows in release, DO NOT REMOVE!!
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
use objc::{class, msg_send, sel, sel_impl};
use std::fs::File;
use std::io::{BufRead, BufReader};
use tauri::{Manager, Window};
Expand All @@ -18,6 +17,7 @@ pub trait WindowExt {
impl WindowExt for Window {
fn set_transparent_titlebar(&self) {
use cocoa::appkit::{NSWindow, NSWindowTitleVisibility};
use objc::{class, msg_send, sel, sel_impl};

unsafe {
let id = self.ns_window().unwrap() as cocoa::base::id;
Expand Down Expand Up @@ -78,8 +78,10 @@ fn get_file_metadata(file_path: String) -> Result<String, String> {
fn main() {
tauri::Builder::default()
.setup(|app| {
let win = app.get_window("main").unwrap();
win.set_transparent_titlebar();
if cfg!(target_os = "macos") {
let win = app.get_window("main").unwrap();
win.set_transparent_titlebar();
}
Ok(())
})
.plugin(tauri_plugin_store::Builder::default().build())
Expand Down

0 comments on commit 290c6bd

Please sign in to comment.