Try not to focus it first. It doesn't quite work though.
This commit is contained in:
parent
8731881837
commit
d5f23cdfa5
5 changed files with 59 additions and 48 deletions
|
|
@ -1,8 +1,8 @@
|
||||||
{
|
{
|
||||||
"$schema": "../gen/schemas/desktop-schema.json",
|
"$schema": "../gen/schemas/desktop-schema.json",
|
||||||
"identifier": "default",
|
"identifier": "default",
|
||||||
"description": "Capability for the main window",
|
"description": "Capabilities for the app",
|
||||||
"windows": ["main"],
|
"windows": ["main", "recording_overlay"],
|
||||||
"permissions": [
|
"permissions": [
|
||||||
"core:default",
|
"core:default",
|
||||||
"opener:default",
|
"opener:default",
|
||||||
|
|
|
||||||
|
|
@ -268,7 +268,6 @@ impl AudioRecordingManager {
|
||||||
fn show_overlay(&self) {
|
fn show_overlay(&self) {
|
||||||
if let Some(overlay_window) = self.app_handle.get_webview_window("recording_overlay") {
|
if let Some(overlay_window) = self.app_handle.get_webview_window("recording_overlay") {
|
||||||
let _ = overlay_window.show();
|
let _ = overlay_window.show();
|
||||||
let _ = overlay_window.set_focus();
|
|
||||||
} else {
|
} else {
|
||||||
// Get screen dimensions for positioning
|
// Get screen dimensions for positioning
|
||||||
if let Ok(monitors) = self.app_handle.primary_monitor() {
|
if let Ok(monitors) = self.app_handle.primary_monitor() {
|
||||||
|
|
@ -280,22 +279,27 @@ impl AudioRecordingManager {
|
||||||
|
|
||||||
// Position at bottom center, 30px from bottom
|
// Position at bottom center, 30px from bottom
|
||||||
let x = (screen_width - 150) / 2;
|
let x = (screen_width - 150) / 2;
|
||||||
let y = screen_height - 50 - 30;
|
let y = screen_height - 30 - 30;
|
||||||
|
|
||||||
match WebviewWindowBuilder::new(&self.app_handle, "recording_overlay")
|
match WebviewWindowBuilder::new(
|
||||||
.title("Recording")
|
&self.app_handle,
|
||||||
.position(x as f64, y as f64)
|
"recording_overlay",
|
||||||
.resizable(false)
|
tauri::WebviewUrl::App("src/overlay/index.html".into()),
|
||||||
.maximizable(false)
|
)
|
||||||
.minimizable(false)
|
.title("Recording")
|
||||||
.closable(false)
|
.position(x as f64, y as f64)
|
||||||
.decorations(false)
|
.resizable(false)
|
||||||
.always_on_top(true)
|
.maximizable(false)
|
||||||
.skip_taskbar(true)
|
.minimizable(false)
|
||||||
.transparent(true)
|
.closable(false)
|
||||||
.build()
|
.decorations(false)
|
||||||
|
.always_on_top(true)
|
||||||
|
.skip_taskbar(true)
|
||||||
|
.transparent(true)
|
||||||
|
.focused(false)
|
||||||
|
.build()
|
||||||
{
|
{
|
||||||
Ok(window) => {
|
Ok(_window) => {
|
||||||
debug!("Recording overlay window created successfully");
|
debug!("Recording overlay window created successfully");
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
|
|
|
||||||
|
|
@ -1,38 +1,39 @@
|
||||||
.recording-overlay {
|
.recording-overlay {
|
||||||
width: 150px;
|
width: 128px;
|
||||||
height: 50px;
|
height: 32px;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
background: rgba(0, 0, 0, 0.7);
|
background: rgba(0, 0, 0, 0.7);
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
backdrop-filter: blur(10px);
|
backdrop-filter: blur(10px);
|
||||||
-webkit-backdrop-filter: blur(10px);
|
-webkit-backdrop-filter: blur(10px);
|
||||||
}
|
}
|
||||||
|
|
||||||
.bars-container {
|
.bars-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: end;
|
align-items: end;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
gap: 3px;
|
gap: 3px;
|
||||||
height: 30px;
|
height: 30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bar {
|
.bar {
|
||||||
width: 4px;
|
width: 4px;
|
||||||
background: linear-gradient(to top, #FAA2CA, #F28CBB);
|
background: linear-gradient(to top, #faa2ca, #f28cbb);
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
animation: pulse infinite ease-in-out;
|
animation: pulse infinite ease-in-out;
|
||||||
min-height: 4px;
|
min-height: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes pulse {
|
@keyframes pulse {
|
||||||
0%, 100% {
|
0%,
|
||||||
height: 4px;
|
100% {
|
||||||
opacity: 0.6;
|
height: 4px;
|
||||||
}
|
opacity: 0.6;
|
||||||
50% {
|
}
|
||||||
height: 30px;
|
50% {
|
||||||
opacity: 1;
|
height: 30px;
|
||||||
}
|
opacity: 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,14 @@
|
||||||
import React from 'react';
|
import React, { useEffect } from "react";
|
||||||
import './RecordingOverlay.css';
|
import "./RecordingOverlay.css";
|
||||||
|
import { resolveResource } from "@tauri-apps/api/path";
|
||||||
|
|
||||||
const RecordingOverlay: React.FC = () => {
|
const RecordingOverlay: React.FC = () => {
|
||||||
|
useEffect(() => {
|
||||||
|
resolveResource("tray_idle.png").then((r) => {
|
||||||
|
console.log("res", r);
|
||||||
|
});
|
||||||
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="recording-overlay">
|
<div className="recording-overlay">
|
||||||
<div className="bars-container">
|
<div className="bars-container">
|
||||||
|
|
@ -11,7 +18,7 @@ const RecordingOverlay: React.FC = () => {
|
||||||
className="bar"
|
className="bar"
|
||||||
style={{
|
style={{
|
||||||
animationDelay: `${i * 100}ms`,
|
animationDelay: `${i * 100}ms`,
|
||||||
animationDuration: `${800 + Math.random() * 400}ms`
|
animationDuration: `${800 + Math.random() * 400}ms`,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ import react from "@vitejs/plugin-react";
|
||||||
import tailwindcss from "@tailwindcss/vite";
|
import tailwindcss from "@tailwindcss/vite";
|
||||||
import { resolve } from "path";
|
import { resolve } from "path";
|
||||||
|
|
||||||
// @ts-expect-error process is a nodejs global
|
|
||||||
const host = process.env.TAURI_DEV_HOST;
|
const host = process.env.TAURI_DEV_HOST;
|
||||||
|
|
||||||
// https://vitejs.dev/config/
|
// https://vitejs.dev/config/
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue