-
-
Notifications
You must be signed in to change notification settings - Fork 49
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
load and save preferences from preferences dialog to file #133
Comments
I think a simple mechanism which covers most use cases would be:
What do you think ? |
@jecaro Sorry for taking a while to get back to you about this! I think the strategy you have proposed is a good solution. If you want to send a PR implementing this, I would accept it! |
Great, I'll start working on this very soon. |
This has mostly been implemented in #140. This is implemented as described in #133 (comment). At some point, it might be nice to figure out a way for an end-user to use both preferences from the preferences file in But for now, I think forcing the user to use one or the other should be fine. |
PR #130 (for issue #82) implemented a preferences dialog that allows the user to modify Termonad settings at runtime.
Here's what the preferences dialog currently looks like:
However, as you can see from the warning, these settings are lost when you exit out of Termonad.
It would be nice if these settings could be serialized to a file, and loaded when Termonad starts.
There are a couple tricky parts about implementing something like this:
~/.config/termonad/termonad.hs
file, which setting should be used?~/.config/termonad/termonad.hs
. However, what if the user decides that they don't want to use the setting from the preferences serialization file anymore, but instead to use the value of the setting from~/.config/termonad/termonad.hs
. There should be a way to only set some settings in the preferences serialization file, without having to set all settings in the preferences serialization file. For instance, maybe you want the "Scrollback Length" setting to be managed in the preferences serialization file, but you want to set the "Cursor Blink Mode" in~/.config/termonad/termonad.hs
. Termonad should be flexible enough to handle this.Although note that all of these problems don't necessarily have to be solved in the first PR implementing this.
If you're interested in implementing this, here's the places in the code you'd need to look at:
The
defaultMain
function is the one that interacts withdyre
to dynamically reload the~/.config/termonad/termonad.hs
file:termonad/src/Termonad/App.hs
Lines 889 to 909 in 10f30d2
This function might have to be modified to try to load settings from the serialized preferences file. Or maybe the
start
function would be a better candidate.termonad/src/Termonad/App.hs
Lines 824 to 831 in 10f30d2
This is the function that shows the preferences dialog and actually sets the preferences:
termonad/src/Termonad/App.hs
Line 710 in 10f30d2
This function will have to be modified to possibly serialize the preferences to a file.
You might want to create a separate datatype to represent the preferences we are serializing.
The layout of the actual preferences dialog is in
glade/preferences.glade
. You probably want to use Glade to add new buttons to this dialog.The text was updated successfully, but these errors were encountered: