Support i3wm and org-capture integration

Now this has been missing from my workflow for awhile.
This commit is contained in:
William Carroll 2019-03-08 18:15:27 +00:00
parent c0b8167c2c
commit c487b09d6a
3 changed files with 49 additions and 11 deletions

View file

@ -62,6 +62,10 @@ bindsym F10 exec --no-startup-id pactl set-sink-mute @DEFAULT
bindsym XF86MonBrightnessUp exec light -A 10 bindsym XF86MonBrightnessUp exec light -A 10
bindsym XF86MonBrightnessDown exec light -U 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 # ensure wallpaper
exec --no-startup-id feh --bg-scale ~/Pictures/cartoon-outdoors.jpg exec --no-startup-id feh --bg-scale ~/Pictures/cartoon-outdoors.jpg

View file

@ -6,16 +6,23 @@
;;; Code: ;;; 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 (use-package org
:preface :preface
(defconst wpc-org-directory (defconst wpc-org-directory
"~/Dropbox/org") "~/Documents/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")))
:config :config
; (general-add-hook org-mode-hook (disable linum-mode)) ; (general-add-hook org-mode-hook (disable linum-mode))
(general-define-key :prefix "C-c" (general-define-key :prefix "C-c"
@ -25,15 +32,25 @@
(setq org-default-notes-file (wpc/org-file "notes")) (setq org-default-notes-file (wpc/org-file "notes"))
(setq org-log-done 'time) (setq org-log-done 'time)
(setq org-agenda-files (list (wpc/org-file "work") (setq org-agenda-files (list (wpc/org-file "work")
(wpc/org-file "personal"))) (wpc/org-file "personal"))))
(setq org-capture-templates
`(("t" "Todo" entry (file+heading ,(ub/org-file "index") "Ideas")
"* TODO %?\n %i"))))
(use-package org-bullets (use-package org-bullets
:after (org) :after (org)
:config :config
(general-add-hook 'org-mode-hook (enable org-bullets-mode))) (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) (provide 'wpc-org)
;;; wpc-org.el ends here ;;; wpc-org.el ends here

View file

@ -9,6 +9,23 @@ dsh() {
docker exec -it "${container}" "${cmd}" 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 # Git
conflicts() { conflicts() {
# Edit git conflicts one-by-one in your favorite editor. # Edit git conflicts one-by-one in your favorite editor.