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

Use XDG_RUNTIME_DIR in powerapplet_tray and run as spot in dpup #2531

Merged
merged 2 commits into from Oct 1, 2021

Conversation

dimkr
Copy link
Contributor

@dimkr dimkr commented Sep 30, 2021

No description provided.

@01micko
Copy link
Contributor

01micko commented Oct 1, 2021

The reason I chose /tmp for the icon is that it doesn't write to disk being mounted on a tmpfs. I have no qualms with writing a tiny file to disk periodically but some users, especially if using flash media, don't like extra drive writes.

That's why I gave /tmp/powerapplet dir 01777 permissions. If user can't write to it then I can fully can support this PR.

@dimkr
Copy link
Contributor Author

dimkr commented Oct 1, 2021

The reason I chose /tmp for the icon is that it doesn't write to disk being mounted on a tmpfs.

It's still under /tmp:

~$ echo $XDG_RUNTIME_DIR
/tmp/runtime-root
~$ run-as-spot sh -c 'echo $XDG_RUNTIME_DIR'
/tmp/runtime-spot

In other distros, XDG_RUNTIME_DIR is a tmpfs too (under /var/run or /run).

@01micko 01micko merged commit a82b038 into puppylinux-woof-CE:testing Oct 1, 2021
@dimkr dimkr deleted the cleanup/tray-icon-files branch October 1, 2021 07:26
@01micko
Copy link
Contributor

01micko commented Oct 2, 2021

Ok, I'm going to use the glib misc utility functions in pmcputemp but a query about g_build_filename()

From the docs:

Returns : a newly-allocated string that must be freed with g_free().

I see no g_free() call in the code for powerapplet_tray.c

@dimkr
Copy link
Contributor Author

dimkr commented Oct 2, 2021

If it's only one call, it's OK to leak that memory: powerapplet_tray.c doesn't free everything explicitly. It is a problem if you call g_build_filename() periodically, and RAM usage increases over time.

@01micko
Copy link
Contributor

01micko commented Oct 2, 2021

If it's only one call, it's OK to leak that memory: powerapplet_tray.c doesn't free everything explicitly. It is a problem if you call g_build_filename() periodically, and RAM usage increases over time.

Fair enough.

I did already rewrite pmcputemp, not committed yet, but here is my main() - well the relevant part.

        temp_icon = g_build_filename(g_get_user_runtime_dir(), ICON, NULL);
	configdir = g_build_filename(g_get_user_config_dir(), CONFDIR, NULL);
	mkdir(configdir, 0755);
	conf = g_build_filename(g_get_user_config_dir(), CONFDIR, CONF, NULL);
	
	paint_icon(style); /* needed to kick it off */
	gtk_init(&argc, &argv);
	create_tray_icon();
	Update(NULL); /* needed to kick it off */
	g_timeout_add(interval, Update, NULL); /*update after 'interval' secs (default 5)*/
	gtk_main();
	
	g_free(temp_icon);
	g_free(configdir);
	g_free(conf);
	
	return 0;

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.

None yet

2 participants