Skip to content

Commit

Permalink
fix: top bar
Browse files Browse the repository at this point in the history
  • Loading branch information
SpikeHD committed Sep 5, 2024
1 parent daed527 commit e08c5f6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src-tauri/injection/postinject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,16 @@ const observer = new MutationObserver(() => {

// Ensure top bar exists if we want it
if (window.__DORION_CONFIG__.use_native_titlebar)
window.__TAURI__.webviewWindow.getCurrentWebviewWindow().setDecorations(true)
window.__TAURI__.core.invoke('set_decorations', { enable: true })

// This needs to render after discord is loaded
if (
!window.__DORION_CONFIG__.use_native_titlebar &&
!document.querySelector('#dorion_topbar')
)
) {
window.__TAURI__.core.invoke('set_decorations', { enable: false })
createTopBar()
}

onClientLoad()

Expand Down
5 changes: 5 additions & 0 deletions src-tauri/src/functionality/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ pub fn toggle_maximize(win: tauri::WebviewWindow) {
}
}

#[tauri::command]
pub fn set_decorations(win: tauri::WebviewWindow, enable: bool) {
win.set_decorations(enable).unwrap_or_default();
}

// Close
#[tauri::command]
pub fn close(win: tauri::WebviewWindow) {
Expand Down
1 change: 1 addition & 0 deletions src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ fn main() {
should_disable_plugins,
functionality::window::minimize,
functionality::window::toggle_maximize,
functionality::window::set_decorations,
functionality::window::close,
css_preprocess::clear_css_cache,
css_preprocess::localize_imports,
Expand Down

0 comments on commit e08c5f6

Please sign in to comment.