Skip to content
Snippets Groups Projects
Unverified Commit 3425458f authored by meskio's avatar meskio :tent:
Browse files

[feat] store temporary icons in /var/tmp

- Resolves: #26
parent c9751aa9
No related branches found
No related tags found
No related merge requests found
......@@ -48,6 +48,7 @@ type gatewayTray struct {
}
func run(bm bitmask.Bitmask, conf *systrayConfig, notify *notificator, as autostart) {
os.Setenv("TMPDIR", "/var/tmp")
bt := bmTray{bm: bm, conf: conf, notify: notify, autostart: as}
systray.Run(bt.onReady, bt.onExit)
}
......
......@@ -48,9 +48,16 @@ void _unlink_temp_file() {
// runs in main thread, should always return FALSE to prevent gtk to execute it again
gboolean do_set_icon(gpointer data) {
GBytes* bytes = (GBytes*)data;
_unlink_temp_file();
strcpy(temp_file_name, "/tmp/systray_XXXXXX");
char *tmpdir = getenv("TMPDIR");
if (NULL == tmpdir) {
tmpdir = "/tmp";
}
strncpy(temp_file_name, tmpdir, PATH_MAX-1);
strncat(temp_file_name, "/systray_XXXXXX", PATH_MAX-1);
temp_file_name[PATH_MAX-1] = '\0';
GBytes* bytes = (GBytes*)data;
int fd = mkstemp(temp_file_name);
if (fd == -1) {
printf("failed to create temp icon file %s: %s\n", temp_file_name, strerror(errno));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment