Skip to content

Commit

Permalink
glassy theme to only show up for windows and macos
Browse files Browse the repository at this point in the history
  • Loading branch information
Abdenasser committed Nov 10, 2024
1 parent 5460ad3 commit faa5b84
Show file tree
Hide file tree
Showing 7 changed files with 111 additions and 9 deletions.
14 changes: 12 additions & 2 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"@fortawesome/fontawesome-svg-core": "^6.6.0",
"@fortawesome/free-solid-svg-icons": "^6.6.0",
"@tauri-apps/api": "^2.0.3",
"@tauri-apps/plugin-os": "^2.0.0",
"@tauri-apps/plugin-shell": "^2.0.1",
"simple-icons": "^13.15.0",
"svelte-fa": "^4.0.3"
Expand Down
78 changes: 78 additions & 0 deletions src-tauri/Cargo.lock

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

1 change: 1 addition & 0 deletions src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ serde = { version = "1.0", features = ["derive"] }
tauri = { version = "2", features = ["macos-private-api"] }
sysinfo = "0.29.0"
tauri-plugin-shell = "2"
tauri-plugin-os = "2"
window-vibrancy = "0.5.2"

[features]
Expand Down
7 changes: 5 additions & 2 deletions src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ use sysinfo::{
SystemExt,
};
use tauri::{Manager, State};

use window_vibrancy::{apply_acrylic, apply_vibrancy, NSVisualEffectMaterial, NSVisualEffectState};
#[cfg(target_os = "windows")]
use window_vibrancy::apply_acrylic;
#[cfg(target_os = "macos")]
use window_vibrancy::{apply_vibrancy, NSVisualEffectMaterial, NSVisualEffectState};

struct AppState {
sys: Mutex<System>,
Expand Down Expand Up @@ -328,6 +330,7 @@ fn main() {
Ok(())
})
.plugin(tauri_plugin_shell::init())
.plugin(tauri_plugin_os::init())
.manage(AppState::new())
.invoke_handler(tauri::generate_handler![get_processes, kill_process])
.run(tauri::generate_context!())
Expand Down
6 changes: 5 additions & 1 deletion src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@
"mainBinaryName": "NeoHtop",
"version": "1.1.0",
"identifier": "com.neohtop.dev",
"plugins": {},
"plugins": {
"os": {
"all": true
}
},
"app": {
"macOSPrivateApi": true,
"windows": [
Expand Down
13 changes: 9 additions & 4 deletions src/lib/components/ThemeSwitcher.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
faChevronDown,
faChevronRight,
} from "@fortawesome/free-solid-svg-icons";
import { platform } from "@tauri-apps/plugin-os";
let showMenu = false;
Expand Down Expand Up @@ -45,10 +46,14 @@
label: "Accessibility",
themes: ["highContrast"],
},
{
label: "Glassy",
themes: ["glassy"],
},
...(platform() === "windows" || platform() === "macos"
? [
{
label: "Glassy",
themes: ["glassy"],
},
]
: []),
];
</script>

Expand Down

0 comments on commit faa5b84

Please sign in to comment.