zb3 / gnome-gamma-tool

A command-line tool that lets you change gamma in GNOME and Cinnamon (with Wayland). You can also adjust contrast and brightness. It works by creating a color profile with the VCGT table, so that changes are persistent and don't interfere with other settings like night light.
115 stars 11 forks source link

error after --delete #5

Closed rubaboo closed 12 months ago

rubaboo commented 2 years ago

I used the --delete option, and now every call shows this. How to fix?

Current profile is /home/username/.local/share/icc/gnome-gamma-tool-5cf2d86e-60d7-4dc3-8b00-42493ccaf1c2
Traceback (most recent call last):
  File "/home/username/.local/share/src/gnome-gamma-tool/gnome-gamma-tool.py", line 350, in <module>
    main()
  File "/home/username/.local/share/src/gnome-gamma-tool/gnome-gamma-tool.py", line 315, in main
    profile_data = mgr.clone_profile_data(base_profile)
  File "/home/username/.local/share/src/gnome-gamma-tool/gnome-gamma-tool.py", line 239, in clone_profile_data
    return profile.load_icc(0)
gi.repository.GLib.GError: cd_icc_error: failed to load file: Error opening file /home/username/.local/share/icc/gnome-gamma-tool-5cf2d86e-60d7-4dc3-8b00-42493ccaf1c2: No such file or directory (0)
rubaboo commented 2 years ago

Sorry for multiple updates. A reboot fixed the problem, but I confirmed the error: after removing a profile using --remove option, any subsequent call of the script produces the above error. Also, removing the profile does not revert the settings to what they were prior to using the tool.

zb3 commented 2 years ago

When you manually remove the profile file, colord still reports that it's used (because it is) even though the file doesn't exist. In this case ggt should default to sRGB. EDIT: I'm not sure this should happen, shouldn't colord change the profile automatically? ggt relies on this. What OS are you using?

However I'm not able to reproduce this error after using the --remove option alone. Could you please post the output (needs to include the missing filename) of ggt after using --remove but without manually deleting the file?

After fixing this, I might think about creating some backup file so it could be restored, but I don't know when I'll have the time to implement it.

zb3 commented 2 years ago

To clarify the question... does the --remove option even change the gamma in your case? If it does, it means the colord reacts to file deletion.

rubaboo commented 2 years ago

I did not play with gamma, only brightness. --remove does not change it back. Debian bookworm with Gnome 42 (Wayland).

Use case: I did not play with color either. I am using Night Light for that, and just need your script to lower brightness, since Night Light does not do that.

Just realized, I did provide the full output, missing file name included.

BinaryGenius commented 2 years ago

Did I hear wayland this might be up your ally if extensions are okay with you. https://github.com/F-i-f/soft-brightness

rubaboo commented 2 years ago

Not that I'm a pro or anything, but here's what I googled:

I'm guessing using icc profile means "color transform approach"?

BinaryGenius commented 2 years ago

I think soft brightness is the only promising approach and actually has a chance to be merged into native gnome a lot of features start off as extensions. The extension gives you a little bar under the volume that you can slide to change the brightness. The only reason I use this script is because I have an nvidia card and soft brightness has issues with xorg. If you can use wayland just fine soft brightness is a great choice.

zb3 commented 2 years ago

@rubaboo, since I can't reproduce this locally, could you please test whether the https://github.com/zb3/gnome-gamma-tool/tree/fix-remove branch works? It looks like in your case colord doesn't react to file deletion, so in that commit I first remove the profile via colord, then I delete the file. That should work, but I can't test it.

zb3 commented 1 year ago

Should be fixed by https://github.com/zb3/gnome-gamma-tool/commit/70114a9505182416e0c6c0d004eb9b11a1ccc8a7