Skip to content
This repository has been archived by the owner on Oct 19, 2022. It is now read-only.

Commit

Permalink
Navigation fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Levminer committed Sep 29, 2022
1 parent dccc473 commit 5bd8dae
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
10 changes: 5 additions & 5 deletions core/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ use window_vibrancy::{apply_mica, apply_vibrancy, NSVisualEffectMaterial};

mod auto_launch;
mod encryption;
mod utils;
mod system_info;
mod utils;

#[derive(Clone, serde::Serialize)]
struct Payload {
Expand Down Expand Up @@ -123,18 +123,18 @@ fn main() {
.system_tray(make_tray())
.on_system_tray_event(handle_tray_event)
.setup(|app| {
let win = app.get_window("main").unwrap();
let window = app.get_window("main").unwrap();

// Transparent effects
#[cfg(target_os = "macos")]
apply_vibrancy(&win, NSVisualEffectMaterial::AppearanceBased)
apply_vibrancy(&window, NSVisualEffectMaterial::HudWindow, None, None)
.expect("Unsupported platform! 'apply_vibrancy' is only supported on macOS");

#[cfg(target_os = "windows")]
apply_mica(&win)
apply_mica(&window)
.expect("Unsupported platform! 'apply_blur' is only supported on Windows");

let window = win.get_window("main").unwrap();
// Launch args
let args: Vec<String> = env::args().collect();

// Show window if auto launch argument not detected
Expand Down
6 changes: 2 additions & 4 deletions interface/layout/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,15 @@ event.listen("openSettings", () => {

// Tray navigate to codes handler
event.listen("openCodes", () => {
if (state.authenticated === true) {
if (state.authenticated === true && location.pathname === "/idle") {
navigate("codes")
}
})

// Listen for focus changes
window.appWindow.onFocusChanged((focused) => {
const path = location.pathname

if (focused.payload === true && state.authenticated === true) {
if (path === "/codes") {
if (location.pathname === "/codes") {
document.querySelector<HTMLInputElement>(".search").focus()
}
}
Expand Down
2 changes: 1 addition & 1 deletion interface/utils/shortcuts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export const registerShortcuts = () => {
await window.appWindow.setFocus()
}

if (state.authenticated === true) {
if (state.authenticated === true && location.pathname === "idle") {
navigate("codes")
}
})
Expand Down

0 comments on commit 5bd8dae

Please sign in to comment.