Skip to content

Commit

Permalink
fix: updates and cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
SpikeHD committed Sep 21, 2024
1 parent 3427044 commit 9926d83
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 38 deletions.
20 changes: 10 additions & 10 deletions src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src-tauri/src/functionality/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ pub fn start_rpc_server(win: tauri::WebviewWindow) {
.append_detectables(get_local_detectables());

loop {
std::thread::sleep(std::time::Duration::from_millis(10));
std::thread::sleep(std::time::Duration::from_secs(1));
}
}

Expand Down
2 changes: 1 addition & 1 deletion src-tauri/src/processors/css_preprocess.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub async fn clear_css_cache() {
pub fn localize_imports(win: tauri::WebviewWindow, css: String, name: String) -> String {
use regex::Regex;
use tauri::Emitter;

use crate::config::get_config;

let reg = Regex::new(r#"(?m)^@import url\((?:"|'|)(?:|.+?)\/\/(.+?)(?:"|'|)\);"#).unwrap();
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/src/util/window_helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,4 +153,4 @@ pub fn ultrashow(win: &tauri::WebviewWindow) {
win.unminimize().unwrap_or_default();
win.show().unwrap_or_default();
win.set_focus().unwrap_or_default();
}
}
47 changes: 22 additions & 25 deletions src-tauri/src/window/blur.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,41 +17,38 @@ pub fn available_blurs() -> Vec<&'static str> {
}
}

#[cfg(target_os = "windows")]
#[tauri::command]
pub fn apply_effect(win: tauri::WebviewWindow, effect: &str) {
#[cfg(target_os = "windows")]
{
use window_vibrancy::{apply_acrylic, apply_blur, apply_mica};
use window_vibrancy::{apply_acrylic, apply_blur, apply_mica};

match effect {
"blur" => apply_blur(win, Some((18, 18, 18, 125))).unwrap_or_default(),
"acrylic" => apply_acrylic(win, Some((18, 18, 18, 125))).unwrap_or_default(),
"mica" => apply_mica(win, None).unwrap_or_default(),
_ => (),
}
match effect {
"blur" => apply_blur(win, Some((18, 18, 18, 125))).unwrap_or_default(),
"acrylic" => apply_acrylic(win, Some((18, 18, 18, 125))).unwrap_or_default(),
"mica" => apply_mica(win, None).unwrap_or_default(),
_ => (),
}
}

#[cfg(target_os = "macos")]
{
use window_vibrancy::{apply_vibrancy, NSVisualEffectMaterial};
#[cfg(target_os = "macos")]
#[tauri::command]
pub fn apply_effect(win: tauri::WebviewWindow, effect: &str) {
use window_vibrancy::{apply_vibrancy, NSVisualEffectMaterial};

#[allow(clippy::single_match)]
match effect {
"vibrancy" => {
apply_vibrancy(win, NSVisualEffectMaterial::HudWindow, None, None).unwrap_or_default()
}
_ => {}
#[allow(clippy::single_match)]
match effect {
"vibrancy" => {
apply_vibrancy(win, NSVisualEffectMaterial::HudWindow, None, None).unwrap_or_default()
}
}

#[cfg(target_os = "linux")]
{
// Sorry linux :/
let _ = win;
let _ = effect;
_ => {}
}
}

// Sorry linux :/
#[cfg(target_os = "linux")]
#[tauri::command]
pub fn apply_effect(_win: tauri::WebviewWindow, _effect: &str) {}

// Might use this one day, today is not that day
// #[tauri::command]
// pub fn remove_effect(win: tauri::WebviewWindow) {
Expand Down

0 comments on commit 9926d83

Please sign in to comment.