redhog / InfiniteGlass

Window manager with infinite desktop, infinite zoom and infinite window resolution
https://redhog.github.io/InfiniteGlass/
GNU General Public License v3.0
35 stars 5 forks source link

Upgrading InfiniteGlass and user configuration #55

Open IanTrudel opened 4 years ago

IanTrudel commented 4 years ago

Each time there are changes that affect ~/.config/glass files, I'm ending up having to reedit all the previous customization. Would there be a way to easily migrate configuration files when changes are made?

redhog commented 4 years ago

Hm, this is a tough one, as it requires some kind of merge script... As a hack you could make ~/.config/glass a git repo, commit all the original files, then commit your changes. To upgrade, you'd check out the previous original version as a new branch, remove the files so that new ones appear, commit, change back to master and merge your new branch... a bit clumsy, but should work fine...

IanTrudel commented 4 years ago

Does Python have anything to do json schema migration? By the way, this is not a priority. Just filling issues as they come.

redhog commented 4 years ago

No idea. Also, I haven't written a json schema for any of the files... and... technically they're yaml. I only use the json subset of yaml, except for comments (json doesn't have comments, and I wanted the config files to have doc comments)...

IanTrudel commented 4 years ago

The next big idea would be to use SQLite (already used in InfiniteGlass, right?) to handle all configuration files.

This will allow to retain user customization between updates. The migration will know what to do with the existing data. We could also integrate default templates (Scandinavian, Canadian and Russian for example) where it will be possible to define themes, button ordering, default settings, etc.

IanTrudel commented 4 years ago

Perhaps some template system + a migration directory with Python scripts. Each YAML would have a version and the scripts would start from there and update one after another version up to the last version.

https://stackoverflow.com/questions/28557626/how-to-update-yaml-file-using-python

IanTrudel commented 4 years ago

JSON Patch https://pypi.org/project/jsonpatch/ https://tools.ietf.org/html/draft-ietf-appsawg-json-patch-02

JSON Diff https://github.com/fzumstein/jsondiff https://pypi.org/project/deepdiff/ https://pypi.org/project/json-diff/

redhog commented 4 years ago

So none of the patching libs above does diff, and none of the diff libs above does patching, and none of the first group understands a format generated by the second group :(

IanTrudel commented 4 years ago

Most unfortunately. I copy relevant information from our conversations for references. We at least made some progress as far as the appropriate approach.