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

Stop changing the safeeyes.json file #548

Open
DamienCassou opened this issue Nov 15, 2023 · 4 comments
Open

Stop changing the safeeyes.json file #548

DamienCassou opened this issue Nov 15, 2023 · 4 comments
Labels

Comments

@DamienCassou
Copy link

Describe the bug

I think this is a bug but feel free to consider that as "feature request" if you prefer.

For me, files in ~/.config are my own: no application should modify them unless explicitly requested. This makes it possible to keep these files as small as possible, containing only what is different from the default. I would also like to order the attributes in the configuration file as I want and indent the file as I like it.

Currently, safeeyes:

  1. reindents the file systematically,
  2. replaces the whole content with some defaults if the "meta" attribute is not present or if the JSON is invalid
  3. reorders the attributes alphabetically

This behavior makes it impossible to use configuration-generation tools such as home-manager. These tool must keep the control of configuration files and shouldn't be responsible for writing default values for every existing configuration option.

To Reproduce
Steps to reproduce the behavior:

  1. Change the order of options in safeeyes.json so it is not alphabetical (or change indentation)
  2. Restart safeeyes
  3. Your file has changed

Expected behavior

  • if the configuration file is invalid, safeeyes should crash with a clear error message (e.g., "safeeyes.json is not a valid JSON document" or "the 'meta' attribute is mandatory and must have the value {"config_version": "6.0.3"}")
  • if the configuration file is valid, safeeyes shouldn't change it

Desktop (please complete the following information):

  • OS: Fedora 38
  • Window manager: i3wm
  • Version: 2.1.6
@AdamPS AdamPS added feature and removed bug labels Nov 29, 2023
@AdamPS
Copy link
Collaborator

AdamPS commented Nov 29, 2023

I understand your request thanks, and it makes sense. I now have a short time to work on this project, and would like to focus on 'serious' bugs that prevent SafeEyes being used at all.

@DamienCassou
Copy link
Author

Thank you for your response. Do you completely agree with the "Expected behavior" part? If you don't, it would be nice if you could find some time to explain your vision. This way, someone could do the job and open a PR.

@AdamPS
Copy link
Collaborator

AdamPS commented Nov 30, 2023

I'm not the original developer I'm just an occasional developer trying to keep the project alive. I can offer an opinion, but that's just my personal one.

I understand your objective, and I partly agree. However:

  1. SafeEyes needs to write to the file when you save the settings or for a new config version. In this case it seems entirely reasonable that it would use a standard order and indentation.
  2. We don't need to be obsessive about config errors. If we can reasonably correct an error then we should. This is important to help a novice user who accidentally messed up their config.

I would agree that if the config file is valid (including the mandatory meta attribute), then SafeEyes shouldn't alter it on start-up.

@AdamPS
Copy link
Collaborator

AdamPS commented Nov 30, 2023

NB Fixing the major bugs is the top priority. If you can help with that then great. Only after that would I start to look at feature requests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants