Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System tray menu items should show checkmark when "Always on top" or "Clickthrough" is enabled #26

Closed
false-spring opened this issue Mar 7, 2024 · 0 comments · Fixed by #30
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@false-spring
Copy link
Owner

false-spring commented Mar 7, 2024

This would be helpful to see at a glance what options are enabled or not.

struct AlwaysOnTop(AtomicBool);
#[tauri::command]
fn toggle_always_on_top(window: tauri::Window, state: State<AlwaysOnTop>) {
let always_on_top = &state.0;
let new_state = !always_on_top.load(Ordering::Acquire);
always_on_top.store(new_state, Ordering::Release);
window.set_always_on_top(new_state).unwrap();
}
struct ClickThrough(AtomicBool);
#[tauri::command]
fn toggle_clickthrough(window: tauri::Window, state: State<ClickThrough>) {
let click_through = &state.0;
let new_state = !click_through.load(Ordering::Acquire);
click_through.store(new_state, Ordering::Release);
window.set_ignore_cursor_events(new_state).unwrap();
}

Should be able to get the system tray through window.app_handle().tray_handle(), tray_handle.get_item(id), and then item.set_title

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant