-
Notifications
You must be signed in to change notification settings - Fork 2
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
Handle process prioritisation internally #1
Comments
That is very interesting, having the whole process handled by Rust is certainly tempting and would greatly simplify the setup. From what I can see, the current obstacles to making
I know for a fact that 2 can be solved, I can probably recycle dyn-wall-rs or use it as a library. 3 could be addressed with magick_rust, or image-convert. Both require imagemagick itself to be installed, but that is acceptable. If 4 is the only remaining obstacle, I can do without it. Although I said that actually setting the image as a wallpaper was not a priority of the project, if your library can solve 1 then I will certainly look deeper into how to deal with 2 and 3. About the API, all I need is the ability to make a process lower priority than other processes completely external to the program.
Both of these questions come down to this : I want |
Yes, there'd be no problem doing that with the API as it is now: let base = Process::current().priority().unwrap();
// This is a tad clunky. That's half-intentional to discourage blindly lowering priority, but
// needs some more design work too ^^
let lowest_priority_available = Priority::normal().lower().last().unwrap_or(Priority::normal());
// I'd lead towards this:
let background_priority = base.lower().next().expect("no lower priority available");
// ...which would pop `wallrnd` in the background relative to the script it was executed from,
// but give room for other programs to have an even lower priority (at the user's choice).
// To be clear: This prioritization level is still relative to all processes on the system, and would have the
// same effect since *most* programs don't mess with their priority level
Process::current().set_priority(background_priority).unwrap();
// ... idle work Raising the priority is a little trickier, since normal processes don't have permission to raise their own priority - you need to be |
Looks good. For high priority, I can just leave it as-is and do the whole This morning I essentially solved issue #3 (convert to PNG), I expect to be working on priority 2-3 days from now, and after that |
Thank you for your work, integrating the call to |
I still plan to leave this issue open until |
For sure! I'm in the middle of some exams right now, but I should be able to push the windows support later this week. I'm trying to pin down Windows' permission system around user processes, and it doesn't look like it'll be a problem |
No worries, I also had exams a few weeks ago, and I'm not in a hurry. |
After seeing how you were using
nice
to treatwallrnd
like a background process, I put togetherscrummage
to do the same thing from Rust.I think you could use it to simplify the UX, and avoid needing to call
wallrnd
from the script. It'd also work from Windows...which I'm planning to implement tomorrow. Is there anything else you'd need from the API?
The text was updated successfully, but these errors were encountered: