Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [Feature Request]: Globally updated Variables for all zsh instances for same user - just like fish shell



On Mon, Jul 13, 2015 at 12:42 AM, Bart Schaefer
<schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Jul 12,  6:42pm, Zaxebo Yaxebo wrote:
> }
> } *"Fish Shell" has a feature known as universal variables, which allow a
> } user to permanently assign a value to a variable across all the running
> } fish shells of that user. The variable value is remembered across logouts
> } and reboots, and updates in value are immediately propagated to all running
> } shells.*
>
> This was previously discussed in the thread starting here:
>
> http://www.zsh.org/cgi-bin/mla/redirect?USERNUMBER=19431
>
> The thread branches a bit but nobody suggested anything better than this:
>
> http://unix.stackexchange.com/questions/137077/serialize-shell-variable-in-bash-or-zsh
>
> We're almost certainly not going to implement the fish model of having a
> background server process that all other shells can contact to receive
> environment variable updates.

One half of it is fairly easy, you can just install a zle -F handler
(possibly coupled with the zsh/socket module) that updates parameters
that another process sends it. The other half, hooking into an
assignment of an arbitrary parameter to send it out again, I can't
think of any way of doing. Maybe you could have a set of functions
that maintains an array of parameter names, and check in zle-line-init
or something if any of them changed. I don't think we would want to
add "parameter assignment hooks"? eg, analogous to typeset -T you
would do typeset -P myfunction someparameter, and then myfunction is
called with someparameter as an argument (and the new value? and you
could assign to someparameter inside that function without causing a
recursive thing maybe). Anyway, I don't think we want that ;).

-- 
Mikael Magnusson



Messages sorted by: Reverse Date, Date, Thread, Author