Display Dhammapada

Dhammapada is a collection of sayings of the Buddha in verse form and one of the most widely read and best known Buddhist scriptures.

display-dhammapada is a program that displays a random verse from the English or Polish translations of the Dhammapada. One of the translations is by John Richards (default); the other is an older translation by F. Max Muller.

To install it in Debian, just

sudo apt-get install display-dhammapada

There are 2 versions:

  1. display‐dhammapada and dhamma (link) both print to the standard output.
  2. xdhamma displays a graphical notification (X window) using notify‐send.

To install notify‐send,

sudo apt-get install libnotify-bin

notify‐send sends desktop notifications to a notification daemon.

If there is no notification daemon installed yet, you can install a simple lightweight notification-daemon called dunst.

sudo apt-get install dunst

You can modify the way the notification message is being displayed in ~/.config/dunst/dunstrc
Eg. to specify the font name and size,
font = "Droid Sans Mono 24"

Note: other programs can also send desktop notifications.


I had written a simple script 1dhamma to basically keep track of the verse number I have seen and to display the next verse the next time. It will also check if notify‐send is installed, it will call xdhamma to display the verse, otherwise it will call dhamma to display in the standard output. The script is using Muller translation.

It stores the verse number in the file $TEMP/.status

The user must define the TEMP environment variable to a writable dir.

 1     #!/bin/sh
2 max=423
3 status=$TEMP/.status
4 current() {
5 if [ -f $status ]; then
6 read num < $status
7 if [ $num -gt $max ]; then
8 num=1
9 fi
10 next=$(($num + 1))
11 echo $next > $status
12 echo $num
13 else
14 echo 2 > $status
15 echo 1
16 fi
17 }
18 if [ -n "`which notify-send`" ]; then
19 xdhamma -m $(current)
20 exit 0
21 fi
22 out=0
23 dhamma -m $(current) |\
24 while read line
25 do
26 len=$(expr length "$line")
27 if [ $len -lt 2 ] && [ $out -gt 0 ]; then
28 echo ""
29 break
30 fi
31 echo -n "$line "
32 out=$((out + 1))
33 done
34

The script 1dhamma can be used in the same way as xdhamma or dhamma. (but without options)

You can call 1dhamma in your ~/.xsession to display the verse when your X window session starts.

I call it each time when I open a new shell terminal. :)


May the dhamma be with you

Comments

blog comments powered by Disqus