Zsh Mailing List Archive
Messages sorted by:
Re: idea for new feature (was: Re: sticky-note and zle bindings)
- X-seq: zsh-users 12479
- From: "Richard Hartmann" <richih.mailinglist@xxxxxxxxx>
- To: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxx>
- Subject: Re: idea for new feature (was: Re: sticky-note and zle bindings)
- Date: Fri, 25 Jan 2008 10:49:46 +0100
- Cc: "Robert Knight" <robertknight@xxxxxxxxx>, zsh-users@xxxxxxxxxx, bastian@xxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=ZUGb6JQXiCvpchMv26YW/70hMcP1Kx4m2uGl1ujqK+I=; b=kdrcNrLCVfPidhtpoqWRcm144CQD23Ea8gZDtPG7de7iAdu/EsKPEvsUlIHLO/BIPpfwa4gN7kqGEGI37AEsGqgMP/RtdKBb+r2fpuSJpIYiy6siKB1AJeJlXVAMb4xVZ6B40x6wqnUGirrBTsy+Lu6vdVvkZYLk6wjYFR9CTKs=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=gSldF8flbKMJ8ZjwTJqzdVCeViZ1MuIPS96SiCMdyzeyMaAs7sG4iXO8nVH5ikAtJ3nqzbmPcZXGmoP+aDDbOEugZTWbBl/t7NBoU55j4U3ard7NUoV+vGOVNKCbmNabI5rQWrkgljIm5vNriZOrtluIKlpBlNv1xMKU4v/SuI8=
- In-reply-to: <080124215848.ZM19758@xxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <13ed09c00801241017x1cd7c454lcbf9156b6bccd9bb@xxxxxxxxxxxxxx> <080124215848.ZM19758@xxxxxxxxxxxxxxxxxxxxxx>
On Jan 25, 2008 6:58 AM, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> So in this scheme the terminal emulator creates the SHELL_SESSION_ID
> and places it in the environment when the shell is started? I.e.,
> Konsole would be responsible for telling the shell which session to
> resume (or to start a new one)?
> If that's not what you mean, can you be more specific?
That is exactly what I meant, yes. If ZSH already has information regarding
this ID, it can use it. If it does not, it would create a new set of whatever it
needs to keep all info.
> I'm not sure I follow the nuances here. If a single window closes
> before the user shuts his whole desktop session down, then the session
> for that window ends, doesn't it? Regardless of what application is
> the creator of that window?
> Is what you mean that the shell needs to find out when it can "garbage
> collect" whatever data it has stored for a session that's never going
> to be resumed?
Yes, the garbage collection is the issue, here.
> Certainly the shell can clean up when it believes the session is not
> going to be resumed. Even if a terminal emulator later re-uses the
> same session ID, the shell will just act as if a new session started.
Unless the shell is told explicitly by some mechanism that its session
is ending now, I do not think a shell should ever remove stuff from its
own session. Unless the session state's size goes over a certain
threshold, that is. That way, newer instances of the shell could
determine if a certain session state collection can be destroyed.
Another thing to keep in mind is that a way to tell, from the outside,
if a session state collection is currently in use would be needed.
> You'd have to do some kind of time limit rather than a number limit.
> I sometimes have more than 20 shell windows open at a time.
It would probably be best to let the user decide what garbage collection
method[s] he or she prefers. ZSH is famous for its fine-grained control
over pretty much everything, there is a reputation to uphold :p
> What does "escape code" mean here? What sends it, and to who?
I assume Robert meant a terminal would tell the shell it is OK to collect,
> Here's a slightly different suggestion: Instead of SHELL_SESSION_ID,
> how about SHELL_SESSION_FILE ? The terminal creates a file and puts
> the path to it in the environment. The shell can then choose to put
> its session data in that file, or put it somewhere else and use the
> file as a semaphore. If the emulator (or the desktop session, even)
> decides that the shell session has ended, it removes that file. If
> the shell stored its data in the file, the session is gone. If it
> used the file as a semaphore it can garbage-collect any session data
> for which the file no longer exists. (The file would have to be in a
> predictable location (SHELL_SESSION_DIR ?) for the latter to work.)
That idea is also quite neat. Perhaps a DIR and an ID? If all shells were
to always use the ID in every file related to a specific session, it could
keep an arbitary set of files with arbitary names, probably even
subdirectories, and the terminal would still know what to delete if it chose
to do so.
The more I think about this, the more I suspect this could be tied into the
XDG  specs. It follows a somwhat similar goal and one mechanism
could push the adoption of the other as the exposure of both would
increase. On a hunch, I am CC'ing Waldo Bastian, who seems to be
the main author of XDG.
Messages sorted by: