Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Call a function when idle?
- X-seq: zsh-users 26226
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: Call a function when idle?
- Date: Mon, 14 Dec 2020 08:06:30 -0800
- Archived-at: <https://zsh.org/users/26226>
- Archived-at: <http://www.zsh.org/sympa/arcsearch_id/zsh-users/2020-12/CAH%2Bw%3D7YwtDNBMzZ8Vx52XwVmkZgT8a0eGNHzJa0%2BOFQfTwkdxA%40mail.gmail.com>
- Authentication-results: zsh.org; iprev=pass (mail-oi1-f177.google.com) smtp.remote-ip=209.85.167.177; dkim=pass header.d=brasslantern-com.20150623.gappssmtp.com header.s=20150623 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none
- Cc: "A. Wik" <awik32@xxxxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=F4bYD9PGTINl/kEvMaHWFTnN13euZDCeZ8Hxel2+8gQ=; b=hzwq3mqUHZj6Su0wnVCSzy00DNDQNPO7I/zYEyD0NAxHfGMnwmgul1Qe6t3ChSHLDa QKIsRSAFmF/T2tYZppcjO35dvC2F/Qi9HvjfMDY8q+yXIcbTHAazMX8VZw7QqGVjj0Zk idagppeSDw2N2U4dIRE+SLYo0pJHdYqnRMTX7oZ23tAHY443S3V2BN3DTW7dks8xGIIg fkjLEgkUWahTn/zu50P0kPcNPvlkCZZmrOLHSD/zNY08Op5c0Eefr9SRTkXh5nLWJZ0w 7XIudHvtvHahXC0nQll4o7vu2DLFuJoKSFB3IzqJgGZ4NP/lnZmn4YH0zadsu/zt2pNY lGzA==
- In-reply-to: <CAHYJk3QNN7yGZspvXyNhn3WVhss-xYZ9dW-kSY1QnLT9ED3gaw@mail.gmail.com>
- List-archive: <http://www.zsh.org/sympa/arc/zsh-users>
- List-help: <mailto:sympa@zsh.org?subject=help>
- List-id: <zsh-users.zsh.org>
- List-owner: <mailto:zsh-users-request@zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- List-subscribe: <mailto:sympa@zsh.org?subject=subscribe%20zsh-users>
- List-unsubscribe: <mailto:sympa@zsh.org?subject=unsubscribe%20zsh-users>
- References: <CALPW7mQjh9-5USvtdcmW=Z=bSFT7qmXN8bM0VXhrJtYzSzJ-ag@mail.gmail.com> <CAHYJk3QNN7yGZspvXyNhn3WVhss-xYZ9dW-kSY1QnLT9ED3gaw@mail.gmail.com>
- Sender: zsh-users-request@xxxxxxx
On Mon, Dec 14, 2020 at 6:57 AM Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
>
> On 12/14/20, A. Wik <awik32@xxxxxxxxx> wrote:
> >
> > So, the question is how to set up an idle timer to call the function.
> > I figured someone had already done something like that before (perhaps
> > to log out automatically).
>
> You may want to unset TMOUT in your handler and then arrange for it to
> be set when you enter a new command line and/or any relevant
> information has changed, otherwise you will come back to a lot of the
> same information.
I've been using the following for years to maintain the title bars in
my xterm-compatible shell windows:
typeset top=$'\C-[]0;'
typeset back=$'\C-G'
title () {
setopt localoptions promptpercent
print -nP "%{$top${*:-%m.%l:%2c - %t}$back%}"
}
TRAPALRM () {
TMOUT=60
title
}
precmd () {
TMOUT=600
title
}
This updates the title bar on every prompt, and then after 10 minutes
of idle time it updates it again every minute.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author