zsh-users
 help / color / mirror / code / Atom feed
* Re: passing a zsh option when opening an xterm
       [not found] <20141114122739.GA24113__32490.9376482994$1415968833$gmane$org@apartia.fr>
@ 2014-11-14 14:37 ` Stephane Chazelas
  2014-11-19 13:28   ` Louis-David Mitterrand
       [not found]   ` <20141119132834.GA27323__40854.0799552158$1416403898$gmane$org@apartia.fr>
  0 siblings, 2 replies; 7+ messages in thread
From: Stephane Chazelas @ 2014-11-14 14:37 UTC (permalink / raw)
  To: zsh-users

2014-11-14 13:27:39 +0100, Louis-David Mitterrand:
[...]
> When opening my fixed xterm's from my desktop startup file I'd like them
> to not quit when accidentaly pressing CTRL-D.
> 
> How can I pass zsh's ignoreeof to the xterm?
> 
> (I don't want that option in my .zshrc as I like to terminate temporary
> xterm's with CTRL-D)
> 
> I tried "xterm -e zsh -i -7" which works but wondering if there is
> another way?
[...]

You could set ignoreeof only when zsh is a session leader:

In ~/.zshrc:

(( $(ps -o sid= -p $$) == $$ )) && setopt ignoreeof

-- 
Stephane


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: passing a zsh option when opening an xterm
  2014-11-14 14:37 ` passing a zsh option when opening an xterm Stephane Chazelas
@ 2014-11-19 13:28   ` Louis-David Mitterrand
       [not found]   ` <20141119132834.GA27323__40854.0799552158$1416403898$gmane$org@apartia.fr>
  1 sibling, 0 replies; 7+ messages in thread
From: Louis-David Mitterrand @ 2014-11-19 13:28 UTC (permalink / raw)
  To: zsh-users

On Fri, Nov 14, 2014 at 02:37:45PM +0000, Stephane Chazelas wrote:
> 2014-11-14 13:27:39 +0100, Louis-David Mitterrand:
> [...]
> > When opening my fixed xterm's from my desktop startup file I'd like them
> > to not quit when accidentaly pressing CTRL-D.
> > 
> > How can I pass zsh's ignoreeof to the xterm?
> > 
> > (I don't want that option in my .zshrc as I like to terminate temporary
> > xterm's with CTRL-D)
> > 
> > I tried "xterm -e zsh -i -7" which works but wondering if there is
> > another way?
> [...]
> 
> You could set ignoreeof only when zsh is a session leader:
> 
> In ~/.zshrc:
> 
> (( $(ps -o sid= -p $$) == $$ )) && setopt ignoreeof

Hi,

apparently (( $(ps -o sid= -p $$) == $$ )) is always true, either when
launching xterms from ~/.xession (those I want ignoreeof) or later
through an openbox key mapping (not ignoreeof).

What do you mean by session leader?


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: passing a zsh option when opening an xterm
       [not found]   ` <20141119132834.GA27323__40854.0799552158$1416403898$gmane$org@apartia.fr>
@ 2014-11-19 16:20     ` Stephane Chazelas
  0 siblings, 0 replies; 7+ messages in thread
From: Stephane Chazelas @ 2014-11-19 16:20 UTC (permalink / raw)
  To: zsh-users

2014-11-19 14:28:34 +0100, Louis-David Mitterrand:
[...]
> apparently (( $(ps -o sid= -p $$) == $$ )) is always true, either when
> launching xterms from ~/.xession (those I want ignoreeof) or later
> through an openbox key mapping (not ignoreeof).
> 
> What do you mean by session leader?
[...]

Sorry, I thought you wanted to avoid CTRL-D to kill *any*
terminal.

The session leader is typically the process that is invoked by
the terminal emulator.

(( $(ps -o sid= -p $$) == $$ ))

returns true for the zsh started by xterm, but not for other
zshs started in that xterm in other processes.

Note (in case that has not already been said) that you can start
xterm as:

xterm -e zsh -o ignoreeof

-- 
Stephane


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: passing a zsh option when opening an xterm
  2014-11-14 13:21 ` René Neumann
@ 2014-11-14 13:40   ` Louis-David Mitterrand
  0 siblings, 0 replies; 7+ messages in thread
From: Louis-David Mitterrand @ 2014-11-14 13:40 UTC (permalink / raw)
  To: zsh-users

On Fri, Nov 14, 2014 at 02:21:45PM +0100, René Neumann wrote:
> Am 14.11.2014 um 13:27 schrieb Louis-David Mitterrand:
> > Hi,
> > 
> > When opening my fixed xterm's from my desktop startup file I'd like them
> > to not quit when accidentaly pressing CTRL-D.
> > 
> > How can I pass zsh's ignoreeof to the xterm?
> > 
> > (I don't want that option in my .zshrc as I like to terminate temporary
> > xterm's with CTRL-D)
> > 
> > I tried "xterm -e zsh -i -7" which works but wondering if there is
> > another way?
> 
> What speaks against using the line above in your desktop startup file?
> Especially as you require to have behavior A for 'startup xterms' and
> behavior B for 'temporary xterms' -- how is the shell expected to
> distinguish the one from the other¹?

Just wondering if "-e zsh -i" gets me exactly the same shell and
environment (except ignoreeof) as if no "-e" was passed?

> - René
> 
> ¹ Of course you could create a symlink 'startup-xterm' linking to xterm,
> and then differentiate in .zshrc between xterm and startup-xterm. But
> when allowing such overhead, you could equally well create a wrapper
> script or something alike.

Interesting approach.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: passing a zsh option when opening an xterm
  2014-11-14 12:27 Louis-David Mitterrand
  2014-11-14 12:49 ` Artur Penttinen
@ 2014-11-14 13:21 ` René Neumann
  2014-11-14 13:40   ` Louis-David Mitterrand
  1 sibling, 1 reply; 7+ messages in thread
From: René Neumann @ 2014-11-14 13:21 UTC (permalink / raw)
  To: zsh-users

Am 14.11.2014 um 13:27 schrieb Louis-David Mitterrand:
> Hi,
> 
> When opening my fixed xterm's from my desktop startup file I'd like them
> to not quit when accidentaly pressing CTRL-D.
> 
> How can I pass zsh's ignoreeof to the xterm?
> 
> (I don't want that option in my .zshrc as I like to terminate temporary
> xterm's with CTRL-D)
> 
> I tried "xterm -e zsh -i -7" which works but wondering if there is
> another way?

What speaks against using the line above in your desktop startup file?
Especially as you require to have behavior A for 'startup xterms' and
behavior B for 'temporary xterms' -- how is the shell expected to
distinguish the one from the other¹?

- René

¹ Of course you could create a symlink 'startup-xterm' linking to xterm,
and then differentiate in .zshrc between xterm and startup-xterm. But
when allowing such overhead, you could equally well create a wrapper
script or something alike.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: passing a zsh option when opening an xterm
  2014-11-14 12:27 Louis-David Mitterrand
@ 2014-11-14 12:49 ` Artur Penttinen
  2014-11-14 13:21 ` René Neumann
  1 sibling, 0 replies; 7+ messages in thread
From: Artur Penttinen @ 2014-11-14 12:49 UTC (permalink / raw)
  To: zsh-users

14.11.2014, 15:39, "Louis-David Mitterrand" <vindex+lists-zsh-users@apartia.org>:
> Hi,
>
> When opening my fixed xterm's from my desktop startup file I'd like them
> to not quit when accidentaly pressing CTRL-D.
>
> How can I pass zsh's ignoreeof to the xterm?
>
> (I don't want that option in my .zshrc as I like to terminate temporary
> xterm's with CTRL-D)
>
> I tried "xterm -e zsh -i -7" which works but wondering if there is
> another way?

  another way (linux'izm):

   [[ $(< /proc/$PPID/comm) == "xterm" ]] && setopt ignoreeof

  to .zshrc

-- 
wbw, artur


^ permalink raw reply	[flat|nested] 7+ messages in thread

* passing a zsh option when opening an xterm
@ 2014-11-14 12:27 Louis-David Mitterrand
  2014-11-14 12:49 ` Artur Penttinen
  2014-11-14 13:21 ` René Neumann
  0 siblings, 2 replies; 7+ messages in thread
From: Louis-David Mitterrand @ 2014-11-14 12:27 UTC (permalink / raw)
  To: zsh-users

Hi,

When opening my fixed xterm's from my desktop startup file I'd like them
to not quit when accidentaly pressing CTRL-D.

How can I pass zsh's ignoreeof to the xterm?

(I don't want that option in my .zshrc as I like to terminate temporary
xterm's with CTRL-D)

I tried "xterm -e zsh -i -7" which works but wondering if there is
another way?

Thanks,


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-11-19 16:20 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20141114122739.GA24113__32490.9376482994$1415968833$gmane$org@apartia.fr>
2014-11-14 14:37 ` passing a zsh option when opening an xterm Stephane Chazelas
2014-11-19 13:28   ` Louis-David Mitterrand
     [not found]   ` <20141119132834.GA27323__40854.0799552158$1416403898$gmane$org@apartia.fr>
2014-11-19 16:20     ` Stephane Chazelas
2014-11-14 12:27 Louis-David Mitterrand
2014-11-14 12:49 ` Artur Penttinen
2014-11-14 13:21 ` René Neumann
2014-11-14 13:40   ` Louis-David Mitterrand

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).