Skip to content

Commit 67b6c7c

Browse files
committed
fix: tray-icon static data
1 parent 0327f59 commit 67b6c7c

File tree

6 files changed

+43
-16
lines changed

6 files changed

+43
-16
lines changed

.SRCINFO

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
pkgbase = elgato-keylight
22
pkgdesc = An Elgato Key Light Controller GUI
3-
pkgver = 0.4.0
3+
pkgver = 0.5.0
44
pkgrel = 1
55
url = https://github.com/monadplus/elgato-keylight
66
arch = x86_64
@@ -17,7 +17,7 @@ pkgbase = elgato-keylight
1717
depends = gdk-pixbuf2
1818
depends = xdotool
1919
depends = libappindicator-gtk3
20-
source = elgato-keylight-0.4.0.tar.gz::https://github.com/monadplus/elgato-keylight/archive/0.4.0.tar.gz
20+
source = elgato-keylight-0.5.0.tar.gz::https://github.com/monadplus/elgato-keylight/archive/0.5.0.tar.gz
2121
sha512sums = b821f2e1b1436cc7de6124d5a8408ad94c880a9c36fe04461f8ab31126578979cb8cdfd3124326be136686b041863cde16ce2683f6d88af7961a376b2349a400
2222

2323
pkgname = elgato-keylight

CHANGELOG.md

+19-3
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,40 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [0.5.0] - 2024-08-13
6+
7+
### 🚀 Features
8+
9+
- Conditional compilation
10+
- PKGBUILD
11+
12+
### 🐛 Bug Fixes
13+
14+
- Tray-icon static data
15+
16+
### 📚 Documentation
17+
18+
- Update with tray icon
19+
20+
### ⚙️ Miscellaneous Tasks
21+
22+
- Reduce transitive dependencies
23+
524
## [0.4.0] - 2024-08-12
625

726
### 🚀 Features
827

928
- Tray icon
10-
- Conditional compilation
1129

1230
### 📚 Documentation
1331

1432
- Update README screenshot
1533
- Add gifs
1634
- Tested on Ubuntu
17-
- Update with tray icon
1835

1936
### ⚙️ Miscellaneous Tasks
2037

2138
- Add script to update CHANGELOG
22-
- Update CHANGELOG
2339

2440
## [0.3.0] - 2024-08-04
2541

Cargo.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "elgato-keylight"
3-
version = "0.4.0"
3+
version = "0.5.0"
44
description = "Elgato Key Light controller for Linux"
55
authors = ["Arnau Abella Gassol <[email protected]>"]
66
license = "MIT"

PKGBUILD

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Maintainer: Arnau Abella <[email protected]>
22

33
pkgname=elgato-keylight
4-
pkgver=0.4.0
4+
pkgver=0.5.0
55
pkgrel=1
66
pkgdesc="An Elgato Key Light Controller GUI"
77
arch=('x86_64')

src/bin/gui.rs

+19-8
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,7 @@ fn main() -> eframe::Result {
6363
)
6464
.unwrap();
6565

66-
let tray_icon_icon = load_icon(std::path::Path::new(concat!(
67-
env!("CARGO_MANIFEST_DIR"),
68-
"/assets/elgato_icon.png"
69-
)));
66+
let tray_icon_icon = load_icon();
7067

7168
let _tray_icon = tray_icon::TrayIconBuilder::new()
7269
.with_menu(Box::new(tray_menu))
@@ -472,14 +469,28 @@ fn get_available_devices(rt: &Runtime) -> anyhow::Result<Vec<Device>> {
472469
}
473470

474471
#[cfg(feature = "tray-icon")]
475-
fn load_icon(path: &std::path::Path) -> tray_icon::Icon {
472+
fn load_icon() -> tray_icon::Icon {
473+
use std::io::Cursor;
474+
475+
use image::{ImageFormat, ImageReader};
476+
use tray_icon::Icon;
477+
476478
let (icon_rgba, icon_width, icon_height) = {
477-
let image = image::open(path)
478-
.expect("Failed to open icon path")
479+
let reader = ImageReader::with_format(
480+
Cursor::new(include_bytes!(concat!(
481+
env!("CARGO_MANIFEST_DIR"),
482+
"/assets/elgato_icon.png"
483+
))),
484+
ImageFormat::Png,
485+
);
486+
let image = reader
487+
.decode()
488+
.expect("decode tray icon failed")
479489
.into_rgba8();
480490
let (width, height) = image.dimensions();
481491
let rgba = image.into_raw();
482492
(rgba, width, height)
483493
};
484-
tray_icon::Icon::from_rgba(icon_rgba, icon_width, icon_height).expect("Failed to open icon")
494+
495+
Icon::from_rgba(icon_rgba, icon_width, icon_height).expect("Failed to open icon")
485496
}

0 commit comments

Comments
 (0)