Last active
April 8, 2020 20:14
-
-
Save thentenaar/2dd7d47a17f6527652dc to your computer and use it in GitHub Desktop.
A simple script for importing text/calendar files into calcurse
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Import text/calendar files from mutt | |
# to calcurse. | |
# | |
# Make sure calcurse is running | |
if [ ! -f "$HOME/.calcurse/.calcurse.pid" ]; then | |
exit 1 | |
fi | |
# Extract the attachments | |
TEMPDIR=$(mktemp -d add-to-calcurse.XXXXXXXX) | |
cat "$@" | uudeview -i -m -n -q -p $TEMPDIR - > /dev/null 2>&1 | |
# Add the calendar file (last attachment) to calcurse | |
FILE=$(ls $TEMPDIR | sort -r | head -1) | |
calcurse -i "$TEMPDIR/$FILE" > /dev/null 2>&1 | |
# Remove the temporary dir and trigger a reload in calcurse | |
rm -rf $TEMPDIR > /dev/null 2>&1 | |
kill -USR1 `cat $HOME/.calcurse/.calcurse.pid` > /dev/null 2>&1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment