-
-
Notifications
You must be signed in to change notification settings - Fork 286
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
Saving of extended state to file on exit is not done in default config? #484
Comments
It seems unwise to me to save the state across "real" exits. If something is really supposed to be that persistent, it should probably not only live in extensible state.
Are you sure about this? It seems like the current line was changed from
in 2022, but that one has its roots in 2007! |
Hm. ExtensibleState provides very nice interface for contrib developers to store things. Does it have some drawbacks because of which it is not recommended to store it "across real exits"?
I was talking about "restart" part. Mod-q used to call |
The only drawback I can think of right now is that there might be some contrib modules that don't garbage collect its state, so you may end up with stored data for windows that were closed a year ago. I've been trying to remedy this whenever I came across it, but I'm sure there are modules that still suffer from this. And then obviously if a data type stored in ExtensibleState gets renamed or deleted, there's no mechanism to garbage collect that either, so it'll persist in your state file for eternity. Other than that, I think it's just a matter of "we've always done it this way". Some xmonad users prefer to configure things statically in their xmonad.hs (workspace names, managehooks, etc.), and thus naturally expect quitting xmonad to reset the state. Other users (me included) rearrange workspaces and layouts and so on dynamically and then spend considerable effort keeping the X session alive for months to not lose this state, or, perhaps, use I don't quite think it's worth changing the default as long as both groups are able to configure xmonad to suit their needs. Note that I do carry some extra patches and modules to facilitate my workflow:
Together, they move the state to /run/user/…, store it atomically, don't remove it on start, use separate filename for each X session and write it every 60 seconds. This way, my xmonad can recover from a crash, but since it's stored in /run, it doesn't restore the state after a shutdown, kernel panic or when the battery runs out. And I don't really mind, I consider it a feature that every couple months I have to start from a clean slate. |
@liskin provided some thoughts why changing defaults in current state of xmonad-contrib may be not very wise.
Any thoughts? |
|
I'd just like to note that when we moved to storing state in a file instead of passing it directly on the command line, we initially had a bug where the state file wasn't being unlinked so the state was persisting across sessions. This led to a lot of complaints. |
Ok, so persisting state across sessions shouldn't be by default. As far as I see, it's not hard to implement something like XMonad.Util.PersistentState (in xmonad-contrib), which would
For 1 and 5, it would provide functions which the user will have to explicitly call in |
Here are my thoughts:
After sleeping on this, I'm skeptical I'm a bit concerned about the details if the UX. How should we handle window identifiers? How can we even know that the data we're reading is indeed a window, without knowing the module? |
Well, I don't think we can invent universal garbage collector here. Most what we can do is provide provide API for contrib writers. For example, |
Problem Description
It seems that with current default config, persistent state is not saved to file on exit.
Steps to Reproduce
Configuration File
https://github.com/xmonad/xmonad/blob/master/src/XMonad/Config.hs; especially the part
Questions
Maybe this should be done by default?
and
restart
by itself contains a call ofwriteStateToFile
. I have an old config, which calledrestart
, so that line remained, and for me mod-q retained the state, while mod-shift-q lost it.Why the new default config does not call
restart
? Isrestart
deprecated now? should explicit call towriteStateToFile
be added to default config?Checklist
I've read CONTRIBUTING.md
I tested my configuration
xmonad
0.17.1xmonad-contrib
masterThe text was updated successfully, but these errors were encountered: