Skip to content

feat: better tray support on Linux - #100

Open
christophehenry wants to merge 1 commit into
tchapgouv:masterfrom
christophehenry:better-linux-tray-support
Open

christophehenry wants to merge 1 commit into
tchapgouv:masterfrom
christophehenry:better-linux-tray-support

Conversation

@christophehenry

@christophehenry christophehenry commented Aug 30, 2025 •

Copy link
Copy Markdown
Contributor

This is an effort to solve #99 by using ksni as the tray icon implementation on Linux. This currently work under KDE Fedora and should not break behavior for Windows and macOS. Can someone confirm this works under GTK too?

Please excuse the potential mess in the code, I'm still learning Rust.

@christophehenry
christophehenry force-pushed the better-linux-tray-support branch 5 times, most recently from d92977d to b2d9c61 Compare August 30, 2025 17:20
Comment thread src-tauri/src/tray.rs
Comment on lines +26 to +38
let icon = self.app_handle.default_window_icon().unwrap();
let rgba = icon.rgba().to_vec();

// convert from rgba to argb
let mut bytes = rgba;
for i in 0..(bytes.len() / 4) {
let j = i * 4;
let a = bytes[j + 3];
bytes[j + 3] = bytes[j + 2];
bytes[j + 2] = bytes[j + 1];
bytes[j + 1] = bytes[j];
bytes[j] = a;
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread src-tauri/src/tray.rs Outdated
Comment on lines +51 to +55
if tauri_plugin_os::platform() == "linux" {
linux(app)
} else {
all(app)
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this correct or there's a better way?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you could use rust’s #[cfg] attribute for conditional compilation. (for example#[cfg(all(desktop, not(target_os = "macos")))] )

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, done.

@christophehenry
christophehenry force-pushed the better-linux-tray-support branch 6 times, most recently from 9b5483a to 45bc258 Compare September 6, 2025 12:08
@christophehenry
christophehenry force-pushed the better-linux-tray-support branch from 45bc258 to 7f5f24c Compare September 10, 2025 07:55
@christophehenry

Copy link
Copy Markdown
Contributor Author

Hi! Can I have another review?

@MarcWadai

Copy link
Copy Markdown
Collaborator

Hi @christophehenry ! Thanks again for the PR. For now we won't be able to merge your PR since there is already a work on going on tauri side.
Moreover the linux version is only experimental and not on our roadmap for now, so we dont want to merge and mix the code later on :/
If the PR on tauri sides dont make it for X reasons and that the linux version needs to go to prod, we will of course be able to merge it !

@christophehenry

christophehenry commented Sep 25, 2025 •

Copy link
Copy Markdown
Contributor Author

I'm sorry to hear that. I'm really missing this and the code is safe. There's no alternative?

@christophehenry

Copy link
Copy Markdown
Contributor Author

So… With the announcement of securix do you have more bandwidth to talk about a Linux version of Tchap desktop?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants