-
-
Notifications
You must be signed in to change notification settings - Fork 13
Reinstall driver button and save file directory change #63
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
base: master
Are you sure you want to change the base?
Conversation
|
@AndyFilter FYI, took a bit of time to maybe improve UX with persistent config and export based on idea that came to me from thread #26 |
|
Hey, the commit looks great I've wanted to improve the export functionality for some time now. When it comes to the reinstall button there are a couple of things I'd like to point out.
I'll test the changes and think about the possible options this week. |
|
Valid points for distros. Maybe it's doable to put distro detection into scripts so that them become more universal? I myself have even less knowledge with different distros and used only Ubuntu. Or even reversely, put all installation logic in GUI with OS detection (/etc/os-release and parsing ID/ID_LIKE) and make install path of "build gui -> press button ; for reinstall reuse logic" For button - I assumed that would be least impactful version, and File submenu didn't sound like good place, though it's not hard to move there. For saving/reinstalling on apply we'd need some UX to have checkbox or something or third button like "Apply and make default" or something so that save+reinstall is controlled by user and transparent. When trying out settings constant building doesn't make sense. And finally for complexity - I agree, just a repeated note that I have negative experience with C++ and that was coded with Codex GPT in 30 mins with a bit of review, there could be better ways to handle this code, or maybe even better way to detect CWD instead of search. |
|
Ctrl+click may be better then to avoid accidental reinstalls. |
|
Btw, I tinkered a bit with AI about codebase, maybe we could persist changes with modprobe/depmod? Saving with Apply into conf file and presumably dkms will pick up on reboot? I did this so far, will test in a bit with reboot 1 - created /etc/modprobe.d/yeetmouse.conf file with exported params like so: 2 - ran 3 commands: and on GUI restart it's updated, and, presumably, will work on reboot. So if it does, we can change reinstall to calling these and maybe add option to persistently update conf on apply. Afaik depmod and modprobe is very well supported on all distros, but I may be wrong as maybe not all isntallation methods even use DKMS UPD: Yep, it works. Changing .conf and running 3 commands, then log-off and log-in works. I will alter double-check full reboot in case log off is not enough |
|
This looks interesting, I think it should work across reboots. And it does provide more flexibility across multiple distros, because I know for sure that Arch and Ubuntu use DKMS, unsure about Nix tho.
I don't know, that might be unintuitive for some. To prevent miss-clicks both approaches I presented can be combined, so that when hovered a note is presented and then after right clicking a menu is presented with an option to reinstall. |
I failed to edit, but on reboot my installation broke - i had to install yeetmouse again for some reason (with message that driver is not installed) and it took defaults from config.h as expected. I will try to research why it had happened. UPD: tried a bit more and seems to be working. No idea what happened that time, but I placed config in modprobe.d folder and edited it a bunch of times and used those three commands and it works fine on restarts and applies new values. I guess next step would be to create functionality to create/edit this file with sudo and apply with those three commands, and later use your idea for elevated apply to do it with better UX. Since this file uses params from driver I guess there is already mapping present (as current apply does similar call to driver). I didn't yet test fully, but so far the only concern is that file needs to be without new lines with \ etc. |
|
Alright, this change looks promising. I've wrote some code to export the config to that The code I referenced earlier (but I'm sure a clanker could write it in a safer manner): std::string ExportModprobeConfig(Parameters params, bool save_to_file) {
std::stringstream res_ss;
res_ss << "options yeetmouse";
try {
res_ss << " Sensitivity=" << params.sens;
res_ss << " SensitivityY=" << (params.use_anisotropy ? params.sensY : params.sens);
res_ss << " OutputCap=" << params.outCap;
res_ss << " InputCap=" << params.inCap;
res_ss << " Offset=" << params.offset;
res_ss << " Acceleration=" << params.accel;
res_ss << " Exponent=" << params.exponent;
res_ss << " Midpoint=" << params.midpoint;
res_ss << " Motivity=" << params.motivity;
res_ss << " PreScale=" << params.preScale;
res_ss << " AccelerationMode=" << params.accelMode;
res_ss << " UseSmoothing=" << params.useSmoothing;
res_ss << " RotationAngle=" << params.rotation;
res_ss << " AngleSnap_Threshold=" << params.as_threshold;
res_ss << " AngleSnap_Angle=" << params.as_angle;
res_ss << " LutSize=" << params.LUT_size;
res_ss << " LutDataBuf=" << (params.LUT_size > 1
? DriverHelper::EncodeLutData(
params.LUT_data_x, params.LUT_data_y, params.LUT_size)
: "\"\"");
if (save_to_file) {
std::ofstream out_file("/etc/modprobe.d/yeetmouse.conf");
if (!out_file.good())
return "";
out_file << res_ss.str();
out_file.close();
}
return res_ss.str();
} catch (std::exception &ex) {
printf("Failed Export: %s\n", ex.what());
}
return "";
}(it's the same as the other export functions, just with changed param names and constant out file name) |


Added two things
To do this I've added LocateProjectRoot and storing it for reuse. It searches down 6 levels to find scripts.
Maybe it's not ideal solution, done with Codex, but if it's good or close to it - happy to help
Testing - tried it a couple of times, save works and reinstall also works (change something - apply - save config to config.h - reinstall - restart GUI and it's using new config).