From: "A. Wik" <awik32@gmail.com>
To: zsh-users@zsh.org
Subject: Call a function when idle?
Date: Mon, 14 Dec 2020 11:57:59 +0000 [thread overview]
Message-ID: <CALPW7mQjh9-5USvtdcmW=Z=bSFT7qmXN8bM0VXhrJtYzSzJ-ag@mail.gmail.com> (raw)
Hi all,
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).
Cheers,
Albert Wik.
next reply other threads:[~2020-12-14 12:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-14 11:57 A. Wik [this message]
2020-12-14 14:57 ` Mikael Magnusson
2020-12-14 16:06 ` Bart Schaefer
2020-12-15 11:09 ` A. Wik
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='CALPW7mQjh9-5USvtdcmW=Z=bSFT7qmXN8bM0VXhrJtYzSzJ-ag@mail.gmail.com' \
--to=awik32@gmail.com \
--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).