#!/bin/sh
# my-init.org(open-a-window-for-org-capture) id:fc0749df-a6ad-4885-afb8-bbab36846558
currentWindow=$(xprop -id $(xprop -root | awk '/_NET_ACTIVE_WINDOW\(WINDOW\)/{print $NF}') | awk '/WM_CLASS\(STRING\)/{print $NF}')

if [[ $currentWindow == '"Emacs"' ]] ; then
    emacsclient --eval "(call-interactively #'org-capture)"
else
    emacsclient -c --eval '(my/call-org-capture-in-new-window)'
fi
# End my-init.org(open-a-window-for-org-capture) id:fc0749df-a6ad-4885-afb8-bbab36846558
