Last updated on November 29, 2020

Dedicated Emacs for org-agenda

👋 Hello! Most of these notes are "knowledge in the making", so parts of them could be incomplete 🙈, inaccurate 🙉 or even potentially wrong 🙊.

As part of my workflow with org-agenda, I want a dedicated Emacs instance for it, which should pop up when invoked with a keystroke (similar to Guake).


I'm planning to have this for Linux and Windows, since I use both. However, so far I've only got the Linux version ready.


I've only tested this on i3, but I suspect it could easily be adapted to other window managers. The main pre-requisite is to have xdotool installed.

The setup is done in two parts:

  • a shell script to toggle Emacs visibility; and
  • the i3 configuration

The shell script launches Emacs (if it hasn't been done yet), and then uses xdotool to toggle its visibility.

#!/usr/bin/env bash


# i3 is creating two windows with the same name, one being an "i3
# container". Is not meant to be unmaped, so I need to keep track of
# the ID of the real one.

window_id=`xdotool search --onlyvisible --name $NAME || cat $WINDOW_ID_FILE`

xdotool getwindowname $window_id
if [ $? -ne 0 ]; then
    emacs --name $NAME --eval '(org-agenda nil "x")' -geometry +$X+$Y &
echo $window_id > $WINDOW_ID_FILE

xdotool search --onlyvisible --name $NAME windowunmap \
    || xdotool windowmap $window_id windowmove $window_id $X $Y

In this case (org-agenda nil "x") is the command that opens my agenda (x is the key I have configured with org-agenda-custom-commands). I had to use windowmove after windowmap to avoid Emacs to slowly drift to the left on every toggle.

The i3 configuration binds F12 to the shell script, and sets the size and behavior of this instance of Emacs.

bindsym F12 exec --no-startup-id ~/src/dotfiles/scripts/

for_window [instance="emacs-org-agenda"] floating enable
for_window [instance="emacs-org-agenda"] border pixel 5
for_window [instance="emacs-org-agenda"] resize set 1024 800
for_window [instance="emacs-org-agenda"] sticky enable

I had to set the size with i3, doing it when launching Emacs with -geometry didn't work. When set with -geometry, the size would be set correctly at the beginning, but when Emacs got hidden for the first time, it would be messed up (i.e. it would become a tiny tiny window).


Haven't done this yet 🤭.