Skip to content

Commit

Permalink
perf: shadows are only available for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
ayangweb committed Mar 23, 2023
1 parent 92c0c41 commit 3b30525
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

use tauri::Manager;
use tauri_plugin_autostart::MacosLauncher;
#[cfg(target_os = "windows")]
use window_shadows::set_shadow;

mod tray;
Expand All @@ -13,9 +14,8 @@ fn main() {
#[cfg(target_os = "macos")]
_app.set_activation_policy(tauri::ActivationPolicy::Accessory);

#[cfg(any(windows, target_os = "macos"))]
let window = _app.get_window("main").unwrap();
set_shadow(&window, true).expect("Unsupported platform!");
#[cfg(target_os = "windows")]
set_shadow(&_app.get_window("main").unwrap(), true).expect("Unsupported platform!");

Ok(())
})
Expand Down
14 changes: 8 additions & 6 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,14 @@ watch(
class="frosted flex h-screen flex-col overflow-hidden p-2"
:class="[windowClass]"
>
<div
class="z-999 transition-300 fixed top-2 left-1/2 h-3 w-80 -translate-x-1/2 cursor-move rounded-md opacity-0 hover:opacity-100"
:class="isFix ? 'bg-[rgb(var(--blue-6))]' : 'bg-gray/60'"
data-tauri-drag-region
@dblclick="handleDoubleClick"
></div>
<a-tooltip :content="isFix ? '双击取消固定' : '双击固定窗口'">
<div
class="z-999 transition-300 fixed top-2 left-1/2 h-3 w-80 -translate-x-1/2 cursor-move rounded-md opacity-0 hover:opacity-100"
:class="isFix ? 'bg-gray' : 'bg-gray/50'"
data-tauri-drag-region
@dblclick="handleDoubleClick"
></div>
</a-tooltip>

<div class="flex h-full items-center justify-center" v-if="isLoading">
<a-spin :size="50" :loading="true" />
Expand Down

0 comments on commit 3b30525

Please sign in to comment.