zsh-users
 help / color / mirror / code / Atom feed
From: Thorsten Kampe <thorsten@thorstenkampe.de>
To: zsh-users@zsh.org
Subject: Re: Executing command on reattaching to screen session
Date: Fri, 7 Feb 2014 12:54:15 +0100	[thread overview]
Message-ID: <ld2hgj$jfq$1@ger.gmane.org> (raw)
In-Reply-To: <140206200141.ZM27955@torch.brasslantern.com>

* Bart Schaefer (Thu, 06 Feb 2014 20:01:41 -0800)
> On Feb 6,  7:27pm, Thorsten Kampe wrote:
> } Every time I login, /etc/motd is displayed. Since I hardly ever
> } log  out and in, I'd like to have the same functionality when
> }  reattaching 
> 
> Perhaps a better way to do this is to put something in your precmd
> hooks so that the /etc/motd is shown when it has changed?  E.g.,
> 
>   latest_motd() {
>     if [[ /etc/motd -nt ~/.last_motd ]]
>     then
>       cp --preserve=timestamps /etc/motd ~/.last_motd
>       cat ~/.last_motd
>     fi
>   }
>   add-zsh-hook precmd latest_motd

Thanks for the suggestion. The information has to be displayed 
regularly even if it hasn't changed.

I was unsure whether to handle the task on the terminal (multiplexer) 
or on the shell level. As far as I can see, the shell doesn't get 
"notified" when I reattach, so it has to be done on the screen/tmux 
level.

The best "approximation" I found so far is to display not on 
reattaching but on idle: I changed the byobu backend to screen, then 
I created a .screenrc in ~/.byobu containing

blankerprg  zsh -c "while true; do cat /etc/motd.d; sleep 30; clear; 
done"
idle        600

That uses screen's screensaver functionality to display text I would 
normally only see on login on a blank screen.

Thorsten


  reply	other threads:[~2014-02-07 11:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-06 18:27 Thorsten Kampe
2014-02-07  0:31 ` Kurtis Rader
2014-02-07  0:37   ` Kurtis Rader
2014-02-07  0:51 ` Eric De Mund
2014-02-07  4:01 ` Bart Schaefer
2014-02-07 11:54   ` Thorsten Kampe [this message]
2014-02-07 16:26     ` Bart Schaefer
2014-02-09  3:20 ` Axel Beckert
2014-02-13  7:32 ` Sebastian Stark
2014-02-13  8:35   ` Thorsten Kampe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='ld2hgj$jfq$1@ger.gmane.org' \
    --to=thorsten@thorstenkampe.de \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).