aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Kummerlaender2025-10-28 15:10:59 +0100
committerAdrian Kummerlaender2025-10-28 15:10:59 +0100
commitef560bb1d546766e64b666b16377c3b06d4c1ce1 (patch)
tree465a05c63d3f291b256c499d282546ab516fdb03
parente3bec319255b892140032f53a89c3d330e3f05ba (diff)
downloadnixos_home-wayland.tar
nixos_home-wayland.tar.gz
nixos_home-wayland.tar.bz2
nixos_home-wayland.tar.lz
nixos_home-wayland.tar.xz
nixos_home-wayland.tar.zst
nixos_home-wayland.zip
emacs/niri: Add agenda shortcutwayland
-rw-r--r--gui/conf/init.el27
-rw-r--r--gui/conf/niri.kdl4
-rw-r--r--gui/emacs.nix14
3 files changed, 45 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
diff --git a/gui/conf/niri.kdl b/gui/conf/niri.kdl
index cfe7d20..f795bcb 100644
--- a/gui/conf/niri.kdl
+++ b/gui/conf/niri.kdl
@@ -105,6 +105,7 @@ window-rule {
window-rule {
match title="\\*\\*Capture\\*\\*"
+ match title="\\*\\*Agenda\\*\\*"
open-floating true
open-focused true
focus-ring {
@@ -126,7 +127,10 @@ binds {
Mod+Return { spawn "kitty"; }
Mod+Shift+Return { spawn "emacsclient" "-c"; }
+
+ Mod+a { spawn "org-show-agenda"; }
Mod+numbersign { spawn "org-capture-todo"; }
+
Mod+Space { spawn "rofi" "-show" "combi"; }
Ctrl+Alt+L { spawn "swaylock" "--color" "#000000"; }
diff --git a/gui/emacs.nix b/gui/emacs.nix
index b5b40f6..8d3e123 100644
--- a/gui/emacs.nix
+++ b/gui/emacs.nix
@@ -93,14 +93,20 @@
#!/usr/bin/env bash
emacsclient -c -e '(custom/org-capture-frame "t")' -F '((name . "**Capture**"))'
'';
+ org-show-agenda = pkgs.writeScriptBin "org-show-agenda" ''
+ #!/usr/bin/env bash
+ emacsclient -c -e '(custom/org-agenda-frame "a")' -F '((name . "**Agenda**"))'
+ '';
in with pkgs; [
symbola
(iosevka-bin.override { variant = "Aile"; })
(iosevka-bin.override { variant = "Etoile"; })
mu
+
org-protocol-shortcut
org-capture-todo
+ org-show-agenda
];
home.file.".emacs.d/init.el".source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/dotfiles/home/gui/conf/init.el";
@@ -118,4 +124,12 @@
terminal = false;
type = "Application";
};
+
+ xdg.desktopEntries.org-show-agenda = {
+ name = "Org Agenda";
+ comment = "Show today's agenda";
+ exec = "org-show-agenda";
+ terminal = false;
+ type = "Application";
+ };
}