Created
June 28, 2020 21:43
-
-
Save mskorzhinskiy/59de5f191cd54ce598ccc1b9d1047965 to your computer and use it in GitHub Desktop.
Helper to attach files to org-mode
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 | |
# Author: Mikhail Skorzhinskii <[email protected]> | |
# | |
# 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