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

bugfix: fix show/hide on macos so clicking on the dock icon works again #398

Merged
merged 3 commits into from
Mar 23, 2023
Merged
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
6 changes: 3 additions & 3 deletions crates/tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
all(not(debug_assertions), target_os = "windows"),
windows_subsystem = "windows"
)]
#[allow(unused_imports)]
use std::borrow::Cow;
use std::collections::HashMap;
use std::io;
use std::path::PathBuf;
Expand Down Expand Up @@ -76,7 +74,9 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
Some(sentry::init((
"https://13d7d51a8293459abd0aba88f99f4c18@o1334159.ingest.sentry.io/6600471",
sentry::ClientOptions {
release: Some(Cow::from(ctx.package_info().version.to_string())),
release: Some(std::borrow::Cow::from(
ctx.package_info().version.to_string(),
)),
traces_sample_rate: 0.1,
..Default::default()
},
Expand Down
7 changes: 3 additions & 4 deletions crates/tauri/src/platform/mac.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
use shared::event::ClientEvent;
use tauri::Window;
use tauri::{Manager, Window};
use url::Url;

use crate::window;

pub fn show_search_bar(window: &Window) {
let _ = window.show();
let _ = tauri::AppHandle::show(&window.app_handle());
window::center_search_bar(window);
let _ = window.set_always_on_top(true);
let _ = window.set_focus();
}

pub fn hide_search_bar(window: &Window) {
let _ = window.hide();
let _ = tauri::AppHandle::hide(&window.app_handle());
let _ = window.emit(ClientEvent::ClearSearch.as_ref(), true);
}

Expand Down
5 changes: 4 additions & 1 deletion crates/tauri/src/plugins/startup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ use tokio::sync::{broadcast, Mutex};
use migration::Migrator;
use shared::config::Config;

use crate::rpc::SpyglassServerClient;
use crate::window::show_wizard_window;
use crate::{rpc::SpyglassServerClient, window::get_searchbar};

use crate::{rpc::RpcMutex, window, AppEvent};
pub struct StartupProgressText(std::sync::Mutex<String>);
Expand Down Expand Up @@ -117,5 +117,8 @@ async fn run_and_check_backend(app_handle: AppHandle) {
// Run wizard on first run
if !config.user_settings.run_wizard {
show_wizard_window(&window.app_handle());
} else {
let sbar = get_searchbar(&app_handle);
let _ = sbar.show();
}
}