mirror of
https://github.com/house-of-vanity/khm.git
synced 2025-08-21 14:27:14 +00:00
Fixed tray icon on linux
This commit is contained in:
2
.github/workflows/main.yml
vendored
2
.github/workflows/main.yml
vendored
@@ -76,7 +76,7 @@ jobs:
|
||||
if: matrix.os == 'ubuntu-latest' && matrix.build_type == 'dynamic' && matrix.build_target == 'x86_64-unknown-linux-gnu'
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y libssl-dev pkg-config libgtk-3-dev libglib2.0-dev libcairo2-dev libpango1.0-dev libatk1.0-dev libgdk-pixbuf2.0-dev libxdo-dev
|
||||
sudo apt-get install -y libssl-dev pkg-config libgtk-3-dev libglib2.0-dev libcairo2-dev libpango1.0-dev libatk1.0-dev libgdk-pixbuf2.0-dev libxdo-dev libayatana-appindicator3-dev
|
||||
|
||||
- name: Install Linux ARM64 cross-compilation dependencies
|
||||
if: matrix.os == 'ubuntu-latest' && matrix.build_type == 'dynamic' && matrix.build_target == 'aarch64-unknown-linux-gnu'
|
||||
|
28
Cargo.lock
generated
28
Cargo.lock
generated
@@ -2687,6 +2687,7 @@ dependencies = [
|
||||
"log",
|
||||
"notify",
|
||||
"notify-debouncer-mini",
|
||||
"openssl",
|
||||
"regex",
|
||||
"reqwest",
|
||||
"rust-embed",
|
||||
@@ -2993,21 +2994,22 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "muda"
|
||||
version = "0.15.3"
|
||||
version = "0.17.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fdae9c00e61cc0579bcac625e8ad22104c60548a025bfc972dc83868a28e1484"
|
||||
checksum = "58b89bf91c19bf036347f1ab85a81c560f08c0667c8601bece664d860a600988"
|
||||
dependencies = [
|
||||
"crossbeam-channel",
|
||||
"dpi",
|
||||
"gtk",
|
||||
"keyboard-types",
|
||||
"libxdo",
|
||||
"objc2 0.5.2",
|
||||
"objc2-app-kit 0.2.2",
|
||||
"objc2-foundation 0.2.2",
|
||||
"objc2 0.6.1",
|
||||
"objc2-app-kit 0.3.1",
|
||||
"objc2-core-foundation",
|
||||
"objc2-foundation 0.3.1",
|
||||
"once_cell",
|
||||
"png",
|
||||
"thiserror 1.0.69",
|
||||
"thiserror 2.0.12",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
@@ -3512,6 +3514,15 @@ version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
|
||||
|
||||
[[package]]
|
||||
name = "openssl-src"
|
||||
version = "300.5.1+3.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "735230c832b28c000e3bc117119e6466a663ec73506bc0a9907ea4187508e42a"
|
||||
dependencies = [
|
||||
"cc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "openssl-sys"
|
||||
version = "0.9.102"
|
||||
@@ -3520,6 +3531,7 @@ checksum = "c597637d56fbc83893a35eb0dd04b2b8e7a50c91e64e9493e398b5df4fb45fa2"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"libc",
|
||||
"openssl-src",
|
||||
"pkg-config",
|
||||
"vcpkg",
|
||||
]
|
||||
@@ -4895,9 +4907,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tray-icon"
|
||||
version = "0.19.3"
|
||||
version = "0.21.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eadd75f5002e2513eaa19b2365f533090cc3e93abd38788452d9ea85cff7b48a"
|
||||
checksum = "2da75ec677957aa21f6e0b361df0daab972f13a5bee3606de0638fd4ee1c666a"
|
||||
dependencies = [
|
||||
"crossbeam-channel",
|
||||
"dirs 6.0.0",
|
||||
|
@@ -36,7 +36,7 @@ trust-dns-resolver = "0.23"
|
||||
futures = "0.3"
|
||||
hostname = "0.3"
|
||||
rust-embed = "8.0"
|
||||
tray-icon = { version = "0.19", optional = true }
|
||||
tray-icon = { version = "0.21", optional = true }
|
||||
notify = { version = "6.1", optional = true }
|
||||
notify-debouncer-mini = { version = "0.4", optional = true }
|
||||
dirs = "5.0"
|
||||
|
@@ -98,6 +98,7 @@ Download the latest binary from the [Releases](https://github.com/house-of-vanit
|
||||
### System Dependencies
|
||||
For GUI features on Linux:
|
||||
```bash
|
||||
# Build dependencies
|
||||
sudo apt-get install libgtk-3-dev libglib2.0-dev libcairo2-dev libpango1.0-dev libatk1.0-dev libgdk-pixbuf2.0-dev
|
||||
```
|
||||
|
||||
|
@@ -225,7 +225,9 @@ impl ApplicationHandler<crate::gui::UserEvent> for TrayApplication {
|
||||
info!("Creating tray icon");
|
||||
let settings = self.settings.lock().unwrap();
|
||||
let sync_status = self.sync_status.lock().unwrap();
|
||||
let (tray_icon, menu_ids) = create_tray_icon(&settings, &sync_status);
|
||||
|
||||
match std::panic::catch_unwind(|| create_tray_icon(&settings, &sync_status)) {
|
||||
Ok((tray_icon, menu_ids)) => {
|
||||
drop(settings);
|
||||
drop(sync_status);
|
||||
|
||||
@@ -236,6 +238,19 @@ impl ApplicationHandler<crate::gui::UserEvent> for TrayApplication {
|
||||
self.start_auto_sync();
|
||||
info!("KHM tray application ready");
|
||||
}
|
||||
Err(_) => {
|
||||
drop(settings);
|
||||
drop(sync_status);
|
||||
error!("Failed to create tray icon. This usually means the required system libraries are not installed.");
|
||||
error!("On Ubuntu/Debian, try installing: sudo apt install libayatana-appindicator3-1");
|
||||
error!("Alternative: sudo apt install libappindicator3-1");
|
||||
error!("KHM will continue running but without system tray integration.");
|
||||
error!("You can still use --settings-ui to access the settings window.");
|
||||
|
||||
// Don't exit, just continue without tray icon
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn user_event(
|
||||
|
Reference in New Issue
Block a user