Skip to content

Instantly share code, notes, and snippets.

@fooqri
Last active December 10, 2016 21:46
Show Gist options
  • Save fooqri/5034d31ac48201933d0d967d601df100 to your computer and use it in GitHub Desktop.
Save fooqri/5034d31ac48201933d0d967d601df100 to your computer and use it in GitHub Desktop.
A few alias functions for using qlmanage to create png files. Used for creatingpng previews of iThoughtsX files that can be embedded in org-mode notes.
# qlmanager is used to open quicklook view of a file from command line.
# see http://www.quicklookplugins.com/ for more plugins
# an alias to create a simple command to olen a quicklook view in background, showing no terminal messages
alias ql='function _qlfunc(){ qlmanage -p $@ >/dev/null 2>&1 &};_qlfunc'
# I use this to save png files using qlmanager into an images directory inside my org-mode notes dir.
# I use a lisp function that calles this comand when org-links are added to notes so I get a nice embedded png view
# of the file being linked to. Requires plugin for file type that creates png's
# I use for mindmaps, stl files, etc so canshow quicklook inside emacs org-mode for linked files
alias qlo='function _qlofunc(){ qlmanage -p $1 -o . >/dev/null; cp $1.qlpreview/[pP]review.png ./images/$1.png; rm -rf $1.qlpreview &};_qlofunc'
# qloo below outputs png as text, meant to pipe to a function or app that can use it (like Preview app).
# to view output of gloo use:
# qloo {filename.itmz} | open -f -a Preview
alias qloo='function _qloofunc(){ qlmanage -p $1 -o . >/dev/null; pattern="${1}.qlpreview/[Pp]review.*"; files=( $pattern ); cat ${files[0]}; rm -rf $1.qlpreview &};_qloofunc'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment