Skip to content

Instantly share code, notes, and snippets.

@mskorzhinskiy
Created June 28, 2020 21:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mskorzhinskiy/59de5f191cd54ce598ccc1b9d1047965 to your computer and use it in GitHub Desktop.
Save mskorzhinskiy/59de5f191cd54ce598ccc1b9d1047965 to your computer and use it in GitHub Desktop.
Helper to attach files to org-mode
#!/bin/bash
# Author: Mikhail Skorzhinskii <mskorzhinskiy@eml.cc>
#
# Description: Create a new file for org-mode and (may-be) try to attach it to
# the org-mode
choice=`kdialog --radiolist Type: Drawing Drawing on Screenshot Screenshot off Voice Voice off`
file_name=`uuidgen`
fpath=~/inbox/${file_name}
case "${choice}" in
Drawing)
fpath=${fpath}.png
convert -size 1024x768 canvas:white ${fpath}
krita --fullscreen --canvasonly ${fpath}
;;
Screenshot)
fpath=${fpath}.png
echo "spectacle>>"
spectacle -r -b -n --output ${fpath}
echo "krita>"
krita --fullscreen --canvasonly ${fpath}
;;
Voice)
parecord -r ${fpath}.wav &
kdialog=`kdialog --title "Creating new file" --progressbar 'Recording:'`
qdbus ${kdialog} showCancelButton true
while [ "false" = `qdbus ${kdialog} wasCancelled` ]; do
sleep 1
inc=$((`qdbus ${kdialog} Get "" "value"` + 1))
qdbus $kdialog Set "" "value" $inc;
done
qdbus $kdialog close
kill %1
ffmpeg -i ${fpath}.wav -acodec libvorbis ${fpath}.ogg
rm ${fpath}.wav
fpath=${fpath}.ogg
;;
esac
kdialog --title "Creating new file" --yesno "Attach to org-mode?"
if [ $? = 0 ]; then
emacs-org-attach-file ${fpath}
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment