aboutsummaryrefslogtreecommitdiff
path: root/gui/conf/init.el
diff options
context:
space:
mode:
authorAdrian Kummerlaender2025-10-28 15:10:59 +0100
committerAdrian Kummerlaender2025-10-28 15:10:59 +0100
commitef560bb1d546766e64b666b16377c3b06d4c1ce1 (patch)
tree465a05c63d3f291b256c499d282546ab516fdb03 /gui/conf/init.el
parente3bec319255b892140032f53a89c3d330e3f05ba (diff)
downloadnixos_home-ef560bb1d546766e64b666b16377c3b06d4c1ce1.tar
nixos_home-ef560bb1d546766e64b666b16377c3b06d4c1ce1.tar.gz
nixos_home-ef560bb1d546766e64b666b16377c3b06d4c1ce1.tar.bz2
nixos_home-ef560bb1d546766e64b666b16377c3b06d4c1ce1.tar.lz
nixos_home-ef560bb1d546766e64b666b16377c3b06d4c1ce1.tar.xz
nixos_home-ef560bb1d546766e64b666b16377c3b06d4c1ce1.tar.zst
nixos_home-ef560bb1d546766e64b666b16377c3b06d4c1ce1.zip
emacs/niri: Add agenda shortcutwayland
Diffstat (limited to 'gui/conf/init.el')
-rw-r--r--gui/conf/init.el27
1 files changed, 27 insertions, 0 deletions
diff --git a/gui/conf/init.el b/gui/conf/init.el
index 3c2cfb4..af4bd71 100644
--- a/gui/conf/init.el
+++ b/gui/conf/init.el
@@ -285,6 +285,33 @@
((org-agenda-overriding-header "Top Priorities")))
(agenda "" nil)))))
+(defcustom custom/org-agenda-frame-name "**Agenda**"
+ "Customize dedicated frame name to launch `org-agenda' in."
+ :type 'string)
+
+(defun custom/org-agenda-frame (command)
+ "Invoke `org-agenda' in a dedicated Emacs frame.
+ This function is designed to be called from a shell script using `emacsclient'.
+ If the dedicated frame already exists, we will use it, otherwise we will create a
+ new frame.
+ Finally, the dedicated frame will be deleted up after `org-agenda' finalizes."
+ (interactive '(nil))
+ (if (not (equal custom/org-agenda-frame-name (frame-parameter nil 'name)))
+ (make-frame '((name . custom/org-agenda-frame-name))))
+ (select-frame-by-name custom/org-agenda-frame-name)
+ (delete-other-windows)
+ (defun org-agenda-quit--clean-up ()
+ "Close the frame after `org-agenda-quit'."
+ (advice-remove 'org-agenda 'delete-other-windows)
+ (advice-remove 'org-agenda-quit 'org-agenda-quit--clean-up)
+ (advice-remove 'org-agenda-Quit 'org-agenda-quit--clean-up)
+ (select-frame-by-name custom/org-agenda-frame-name)
+ (delete-frame nil t))
+ (advice-add 'org-agenda-quit :after #'org-agenda-quit--clean-up)
+ (advice-add 'org-agenda-Quit :after #'org-agenda-quit--clean-up)
+ (advice-add 'org-agenda :after #'delete-other-windows)
+ (org-agenda nil command))
+
(use-package org-fragtog
:ensure t
:config