aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md10
-rw-r--r--bash-prompt.sh9
-rw-r--r--screenshot.pngbin0 -> 14281 bytes
3 files changed, 18 insertions, 1 deletions
diff --git a/README.md b/README.md
index c9d1105..24de403 100644
--- a/README.md
+++ b/README.md
@@ -5,7 +5,7 @@ a status line in the bottom-most line of the terminal screen.
The status line shows the date, host name and current directory
(possibly abbreviated to fit).
-I use this in conjunction with a simple prompt:
+This allows me to have a simple prompt:
::text
PS1='\$ '
@@ -19,6 +19,14 @@ for instance by adding this line to `~/.bash_profile`:
This requires Bash 4.4 or higher.
+## Screenshot
+
+![Screenshot of Kabapro](screenshot.png)
+
+The clock actually updates. The code launches a background
+process which periodically the SIGALRM signal to the shell,
+whose trap calls the `update_status_line` function.
+
## License
This is under distributed under a modified two-clause BSD license.
diff --git a/bash-prompt.sh b/bash-prompt.sh
index 587b6ed..771207a 100644
--- a/bash-prompt.sh
+++ b/bash-prompt.sh
@@ -66,6 +66,15 @@ update_status_line()
PROMPT_COMMAND='update_status_line'
+if ! [ $update_status_alarm ] ; then
+ trap update_status_line ALRM
+ while true; do
+ sleep 15
+ kill -ALRM $$
+ done &
+ update_status_alarm=$!
+fi
+
# Copyright 2023
# Kaz Kylheku <kaz@kylheku.com>
# Vancouver, Canada
diff --git a/screenshot.png b/screenshot.png
new file mode 100644
index 0000000..5bc675a
--- /dev/null
+++ b/screenshot.png
Binary files differ