Skip to content

Commit

Permalink
fix: initialize gtk for linux
Browse files Browse the repository at this point in the history
  • Loading branch information
decipher3114 committed Sep 25, 2024
1 parent 75d878b commit 2ff7183
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions Cargo.lock

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

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ toml = "0.8"
tray-icon = "0.17"
xcap = "0.0"

[target.'cfg( target_os = "linux" )'.dependencies]
gtk = "0.18"

[target.'cfg( target_os = "windows" )'.build-dependencies]
winresource = "0.1"

Expand Down
3 changes: 2 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ impl App {
},
#[cfg(target_os = "linux")]
platform_specific: PlatformSpecific {
application_id: String::from("Capter")
application_id: String::from("Capter"),
override_redirect: true
},
..Default::default()
});
Expand Down
3 changes: 3 additions & 0 deletions src/utils/tray_icon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ pub fn tray_icon() -> TrayIcon {

let icon = Icon::from_rgba(icon_image.into_bytes(), width, height).unwrap();

#[cfg(target_os = "linux")]
gtk::init().unwrap();

let menu = Menu::new();
menu.append_items(
&[
Expand Down

0 comments on commit 2ff7183

Please sign in to comment.