Skip to content

Commit

Permalink
Set focus wip
Browse files Browse the repository at this point in the history
  • Loading branch information
JohannesMerkt committed Mar 24, 2023
1 parent ec2c3ea commit 830cd7e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ fn main() {
window.set_focus().ok();
window.request_user_attention(Some(tauri::UserAttentionType::Informational)).ok();

println!("{}, {argv:?}, {cwd}", app.package_info().name);
//println!("{}, {argv:?}, {cwd}", app.package_info().name);

app.emit_all("single-instance", Payload { args: argv, cwd }).unwrap();
}))
Expand Down
5 changes: 5 additions & 0 deletions src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@
},
"clipboard": {
"writeText": true
},
"window": {
"setFocus": true,
"show": true,
"requestUserAttention": true
}
},
"bundle": {
Expand Down
7 changes: 7 additions & 0 deletions src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { Providers } from "./Providers"
import { Router } from "./Router"
import { renderStreamerHTML } from "./streamer-overlay/renderStreamerOverlay"
import events from "./mixpanel/mixpanel"
import { listen } from "@tauri-apps/api/event"
import { appWindow } from "@tauri-apps/api/window"

events.init()

Expand All @@ -27,6 +29,11 @@ renderStreamerHTML({
language_code: "",
})

listen("single-instance", () => {
//appWindow.requestUserAttention(2)
//appWindow.setFocus()
})

ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
<React.StrictMode>
<Providers>
Expand Down

0 comments on commit 830cd7e

Please sign in to comment.