about summary refs log tree commit diff
path: root/configs
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2019-03-08T18·15+0000
committerWilliam Carroll <wpcarro@gmail.com>2019-03-08T18·15+0000
commitc487b09d6a1b054c3912397ec6cdbabd58d35eb0 (patch)
treed0ecc5473f4225599fdc97fa5644553b60c3826f /configs
parentc0b8167c2c852394b1fcdfc06f949bd57321b352 (diff)
Support i3wm and org-capture integration
Now this has been missing from my workflow for awhile.
Diffstat (limited to 'configs')
-rw-r--r--configs/linux/misc/.config/i3/config4
-rw-r--r--configs/shared/emacs/.emacs.d/wpc/packages/wpc-org.el39
-rw-r--r--configs/shared/zsh/dumping_grounds.zsh17
3 files changed, 49 insertions, 11 deletions
diff --git a/configs/linux/misc/.config/i3/config b/configs/linux/misc/.config/i3/config
index 1feb71dc8195..d1bd2116b362 100644
--- a/configs/linux/misc/.config/i3/config
+++ b/configs/linux/misc/.config/i3/config
@@ -62,6 +62,10 @@ bindsym F10                  exec --no-startup-id pactl set-sink-mute   @DEFAULT
 bindsym XF86MonBrightnessUp   exec light -A 10
 bindsym XF86MonBrightnessDown exec light -U 10
 
+# integrate with Emacs's org-mode
+bindsym $mod+o exec zsh -i -c org_capture
+for_window [class="GoogleEmacs" instance="org-protocol-capture"] floating enable
+
 # ensure wallpaper
 exec --no-startup-id feh --bg-scale ~/Pictures/cartoon-outdoors.jpg
 
diff --git a/configs/shared/emacs/.emacs.d/wpc/packages/wpc-org.el b/configs/shared/emacs/.emacs.d/wpc/packages/wpc-org.el
index c2682be5c158..dcbe06688519 100644
--- a/configs/shared/emacs/.emacs.d/wpc/packages/wpc-org.el
+++ b/configs/shared/emacs/.emacs.d/wpc/packages/wpc-org.el
@@ -6,16 +6,23 @@
 
 ;;; Code:
 
+;; TODO: figure out how to nest this in (use-package org ...)
+(setq org-capture-templates
+      (quote (
+
+("w" "work" entry (file+headline "~/Documents/org/work.org" "Tasks")
+ "* TODO %?")
+
+("p" "personal" entry (file+headline "~/Documents/org/personal.org" "Tasks")
+ "* TODO %? ")
+
+)))
+(evil-set-initial-state 'org-mode 'insert)
+
 (use-package org
   :preface
   (defconst wpc-org-directory
-    "~/Dropbox/org")
-  (defconst ub-org-directory
-    "~/Dropbox/sprint-planning-staging")
-  (defun wpc/org-file (file)
-    (f-join wpc-org-directory (f-swap-ext file "org")))
-  (defun ub/org-file (file)
-    (f-join ub-org-directory (f-swap-ext file "org")))
+    "~/Documents/org")
   :config
   ; (general-add-hook org-mode-hook (disable linum-mode))
   (general-define-key :prefix "C-c"
@@ -25,15 +32,25 @@
   (setq org-default-notes-file (wpc/org-file "notes"))
   (setq org-log-done 'time)
   (setq org-agenda-files (list (wpc/org-file "work")
-                               (wpc/org-file "personal")))
-  (setq org-capture-templates
-        `(("t" "Todo" entry (file+heading ,(ub/org-file "index") "Ideas")
-           "* TODO %?\n  %i"))))
+                               (wpc/org-file "personal"))))
 
 (use-package org-bullets
   :after (org)
   :config
   (general-add-hook 'org-mode-hook (enable org-bullets-mode)))
 
+;; i3, `org-mode' integration
+;; Heavily influenced by: https://somethingsomething.us/post/i3_and_orgmode/
+(defadvice org-switch-to-buffer-other-window
+    (after supress-window-splitting activate)
+  "Delete the extra window if we're in a capture frame."
+  (if (equal "org-protocol-capture" (wpc/frame-name))
+      (delete-other-windows)))
+
+(add-hook 'org-capture-after-finalize-hook
+          (lambda ()
+            (when (equal "org-protocol-capture" (wpc/frame-name))
+                (delete-frame))))
+
 (provide 'wpc-org)
 ;;; wpc-org.el ends here
diff --git a/configs/shared/zsh/dumping_grounds.zsh b/configs/shared/zsh/dumping_grounds.zsh
index c2acc64564af..ae16bb78bfaa 100644
--- a/configs/shared/zsh/dumping_grounds.zsh
+++ b/configs/shared/zsh/dumping_grounds.zsh
@@ -9,6 +9,23 @@ dsh() {
   docker exec -it "${container}" "${cmd}"
 }
 
+# Emacs
+dired() {
+  # Opens either the `$(pwd)` or `$1` in Emacs's `dired`.
+  # Uses i3 to focus Emacs.
+  directory=${1:-$(pwd)}
+  echo $directory
+  emacsclient --eval "(dired \"$directory\")" && focus Emacs
+}
+
+org_capture() {
+  # Spawns an Emacs frame running org-capture.
+  echo called
+  emacsclient --create-frame \
+              --frame-parameters '(quote (name . "org-protocol-capture"))' \
+              --eval '(org-capture)'
+}
+
 # Git
 conflicts() {
   # Edit git conflicts one-by-one in your favorite editor.