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

Commit

Permalink
Focus search event
Browse files Browse the repository at this point in the history
  • Loading branch information
Levminer committed Sep 3, 2022
1 parent efc9377 commit e6792b7
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 126 deletions.
1 change: 1 addition & 0 deletions .github/workflows/alpha-artifact.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ jobs:
run: |
rm -rf core/target/release/build
rm -rf core/target/release/deps
rm -rf /core/target/release/bundle/appimage/authme.AppDir
shell: bash
- name: Upload artifacts
uses: actions/upload-artifact@v2
Expand Down
14 changes: 0 additions & 14 deletions core/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,20 +148,6 @@ fn main() {
menu_item.set_title("Hide Authme").unwrap();
}
}

tauri::WindowEvent::Focused(focused) => {
let app = event.window().app_handle();

if *focused {
app.emit_all(
"focusSearch",
Payload {
message: "Focus search bar".into(),
},
)
.unwrap()
}
}
_ => {}
})
.run(context)
Expand Down
13 changes: 8 additions & 5 deletions interface/layout/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { navigate } from "../libraries/navigate"

const settings = getSettings()

// Set background color if vibrancy not supported
const setBackground = async () => {
const system = await os.type()
const build = await os.version()
Expand All @@ -21,17 +22,19 @@ const setBackground = async () => {

setBackground()

// Tray event handler
// Tray settings open handler
event.listen("openSettings", () => {
navigate("settings")
})

// Tray event handler
event.listen("focusSearch", () => {
// Listen for focus changes
window.appWindow.onFocusChanged((focused) => {
const path = location.pathname

if (path === "/codes") {
document.querySelector<HTMLInputElement>(".search").focus()
if (focused.payload === true) {
if (path === "/codes") {
document.querySelector<HTMLInputElement>(".search").focus()
}
}
})

Expand Down
107 changes: 0 additions & 107 deletions interface/libraries/auth.ts

This file was deleted.

0 comments on commit e6792b7

Please sign in to comment.