Skip to content

Commit

Permalink
feat: begin feature flags
Browse files Browse the repository at this point in the history
  • Loading branch information
SpikeHD committed Sep 5, 2024
1 parent e08c5f6 commit fc0866d
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,17 @@ tauri-plugin-autostart = "2.0.0-rc"
tauri-plugin-notification = { version = "2.0.0-rc", features = ["win7-notifications", "windows7-compat"] }
tauri-plugin-http = "2.0.0-rc"
# window blur
window-vibrancy = "0.5.0"
window-vibrancy = { version = "0.5.0", optional = true }

reqwest = { version = "0.12.5", features = ["blocking"] }
phf = "0.11.2"
sysinfo = "0.30"
chrono = { version = "0.4", default-features = false }
chrono = { version = "0.4", default-features = false, features = ["clock"] }
device_query = "2.1.0"
regex = "1.10"

# rpc server
rsrpc = { git = "https://www.github.com/SpikeHD/rsRPC", tag = "v0.16.1" }
rsrpc = { git = "https://www.github.com/SpikeHD/rsRPC", tag = "v0.16.1", optional = true }
window_titles = { git = "https://github.com/SpikeHD/window_titles", branch = "master" }

[target."cfg(any(target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\"))".dependencies]
Expand Down Expand Up @@ -88,8 +88,9 @@ linker = "aarch64-linux-gnu-gcc"
[features]
# by default Tauri runs in production mode
# when `tauri dev` runs it is executed with `cargo run --no-default-features` if `devPath` is an URL
default = ["custom-protocol"]
custom-protocol = ["tauri/custom-protocol"]
default = ["rpc", "blur"]
rpc = ["rsrpc"]
blur = ["window-vibrancy"]

[target.x86_64-unknown-linux-gnu]
rustflags = [
Expand Down
3 changes: 3 additions & 0 deletions src-tauri/src/functionality/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ pub mod cache;
pub mod extension;
pub mod hotkeys;
pub mod keyboard;

#[cfg(feature = "rpc")]
pub mod rpc;

pub mod streamer_mode;
pub mod tray;
pub mod window;
3 changes: 3 additions & 0 deletions src-tauri/src/functionality/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ use tauri_plugin_window_state::{AppHandleExt, StateFlags};
use crate::config::get_config;
use crate::log;
use crate::util::window_helpers::window_zoom_level;

#[cfg(feature = "blur")]
use crate::window::blur::apply_effect;

use super::extension::add_extension;
Expand Down Expand Up @@ -76,6 +78,7 @@ pub fn after_build(window: &tauri::WebviewWindow) {
window.maximize().unwrap_or_default();
}

#[cfg(feature = "blur")]
apply_effect(
window.clone(),
config.blur.unwrap_or("none".to_string()).as_str(),
Expand Down
5 changes: 5 additions & 0 deletions src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,9 @@ fn main() {
profiles::delete_profile,
release::do_update,
release::update_check,
#[cfg(feature = "rpc")]
functionality::rpc::get_windows,
#[cfg(feature = "rpc")]
functionality::rpc::get_local_detectables,
functionality::hotkeys::get_keybinds,
functionality::hotkeys::set_keybinds,
Expand All @@ -159,7 +161,9 @@ fn main() {
helpers::open_themes,
helpers::open_plugins,
helpers::fetch_image,
#[cfg(feature = "blur")]
window::blur::available_blurs,
#[cfg(feature = "blur")]
window::blur::apply_effect,
// window::blur::remove_effect,
window_helpers::remove_top_bar,
Expand Down Expand Up @@ -258,6 +262,7 @@ fn main() {
plugin::load_plugins(win.clone(), Some(true));

// begin the RPC server if needed
#[cfg(feature = "rpc")]
if get_config().rpc_server.unwrap_or(false) {
let win_cln = win.clone();
std::thread::spawn(|| {
Expand Down
1 change: 1 addition & 0 deletions src-tauri/src/window/mod.rs
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#[cfg(feature = "blur")]
pub mod blur;

0 comments on commit fc0866d

Please sign in to comment.