A GUI/TUI addressbook searcher/viewer for use with a mess of vcards
If the above is too small, you can see it on terminalizer
I really liked ppl and the control it
gave you over your contacts. I was thrilled to find vdirsyncer
and the way it can sync your contacts with multiple services. But I wanted a way to be able to
quickly and easily search through my contacts for basic information and, if I wanted,
to have a GUI to do it.
As ppl
is now defunct, this script has taken the place of accessing (though
not editing) my addressbook quickly and easily with a GUI or TUI.
This is a complete overhaul from prior versions.
This project is licensed under the MIT License. For the full license, see LICENSE
.
All of these are available in Debian (and presumably Ubuntu) as packages:
sudo apt install vdirsyncer rofi fzf xclip ripgrep tee
Trust me, you want to check out fzf
, rofi
, and ripgrep
anyhow.
Place pplsearch
and vcardreader
in the same directory somewhere in your PATH.
If your VCards are somewhere other than $HOME/.contacts/contacts
you will
need to edit line 14 to reflect the location of your contacts.
pplsearch [-h|-m|-c]
Call pplsearch
(from the command line, a launcher, Mutt, or an Openbox menu)
and it will quickly give you a list of names (through fzf
in the terminal, or
using rofi
on X. Select the name (and VCard) you want to use.
In GUI mode, pplsearch
will use rofi
to nicely display the results. In
TUI mode, pplsearch
will return the information to STDOUT. In both cases,
the results are copies to all clipboards using tee
and xclip
automatically.
Black and white emojis are used to make things look a bit better.
In Mutt mode, pplsearch
will only return an email address, so can be used
for address completion by Mutt. If there is more than one email address for
that contact, it will use fzf
again to let you choose the proper email.
If you do not have vdirsyncer
set up, you’ll have to get the vcards
there some other way (say, exporting from your mail client).
Yes, it’s another VCard reader. This one is in bash.
It can be sourced to provide the function read_vcard
. If sourced to provide
this function, it expects the variable $SelectedVcard
to point to the VCard
you want to read.
It can also be used as a standalone VCard reader by specifying the full path and filename of the VCard you wish to examine. For example,
vcardreader /home/steven/.contacts/contacts/VCard_is_here.vcf
The vcardfixer.sh
script is there to simply fix some small irregularities
in individual vcards. Currently it handles the lack of the N: field (and
properly swaps last and first names) and the lack of an END:VCARD field.
It’s a pretty simple bash script (though finding out that a rogue carriage
return was causing me problems took forever), so if you have another field
that’s causing problems, you can fix it.
Make your contacts into a git repository!
While slightly afield from the scope of this script, I found it useful to make your contacts directory a git repository so that you can check and revert changes from syncing.
Set up vdirsyncer properly, and when it’s all configured, call it with a wrapper script like this:
/usr/bin/vdirsyncer sync 2>&1
# Your contacts directory goes here, obviously.
cd /home/steven/.contacts
git add .
git commit -a -m "automated sync"
git gc --auto --prune
Known issue: Some rofi themes wrap the selection line and try to make it fit in one row (arthur, in particular) while others gracefully chop it and it looks great.
Steven Saus injects people with radioactivity for his day job, but only to serve the forces of good.
Mostly.