Zsh Mailing List Archive
Messages sorted by:
Call a function when idle?
- X-seq: zsh-users 26224
- From: "A. Wik" <awik32@xxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Call a function when idle?
- Date: Mon, 14 Dec 2020 11:57:59 +0000
- Archived-at: <https://zsh.org/users/26224>
- Archived-at: <http://www.zsh.org/sympa/arcsearch_id/zsh-users/2020-12/CALPW7mQjh9-5USvtdcmW%3DZ%3DbSFT7qmXN8bM0VXhrJtYzSzJ-ag%40mail.gmail.com>
- Authentication-results: zsh.org; iprev=pass (mail-wr1-f53.google.com) smtp.remote-ip=18.104.22.168; dkim=pass header.d=gmail.com header.s=20161025 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=A84QbdB25E62fdFn3ayatqhF4s8SBdbM2+pFvCTtlHQ=; b=MCnLgx2/7v92kJJjTQraQ5nT8e2O4R8kV9htgfUy6/dATWwOWXL89q96LwzkIzK+xE 5nTOvHfNQqIHL2AaLn3cGWnH4UtspR5+ajgd9li5SblBwDR1e3WxBJq4fUF2w8JzvkNb Z1zHg0+qpmMu0U+/TVnCYPFEiE4cGzSDeYT4zNO7bcxN2EM/BPJOptYlcSsZpWnotwt3 1JLL2CF+EnTOiSjJDqrZ9BJ/EAxLfz5IbTG1gyaiZ6vLmDCWK+YtAI/dDMmSmpGf/B6x vC/LatImHjkymSeBGg8/MFDiUXPRCQepS9FbAM9ImLrmEJsGOmIuhOKUNu71NMhsZpY0 WS0A==
- List-archive: <http://www.zsh.org/sympa/arc/zsh-users>
- List-help: <mailto:email@example.com?subject=help>
- List-id: <zsh-users.zsh.org>
- List-owner: <mailto:firstname.lastname@example.org>
- List-post: <mailto:email@example.com>
- List-subscribe: <mailto:firstname.lastname@example.org?subject=subscribe%20zsh-users>
- List-unsubscribe: <mailto:email@example.com?subject=unsubscribe%20zsh-users>
- Sender: zsh-users-request@xxxxxxx
For the most part, when I get started working at a terminal, I can do
just fine with a simple and short prompt like "% ". A prompt that
includes the current directory often gets annoyingly long so that you
can rarely type a command line that doesn't scroll onto another line,
which is harder to read.
However, when I've been away from a terminal (window or tab) for some
time, I would like to know where in the file system I am, to remind me
(hopefully) of what I was doing. If the current working directory is
not in the prompt, I have to type "pwd" manually.
To solve the problem, I was thinking of getting a function to run
after a specified period of idle time. This function could then run
"print -P" to print useful pieces of data, such as the hostname, the
tty name, etc., and of course the current directory.
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).
Messages sorted by: