summary refs log tree commit diff stats
path: root/emacs
diff options
context:
space:
mode:
Diffstat (limited to 'emacs')
-rw-r--r--emacs/.emacs.d/init.org20
1 files changed, 19 insertions, 1 deletions
diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org
index 99d5899..59bf5d4 100644
--- a/emacs/.emacs.d/init.org
+++ b/emacs/.emacs.d/init.org
@@ -293,7 +293,25 @@ correct, at least for Liberation Mono.
 (line-number-mode -1)
 (size-indication-mode t)
 
-(setq frame-title-format '("%f" (dired-directory dired-directory)))
+
+(require 'f)
+(if (f-ancestor-of? "/nix/store" invocation-directory)
+    (setq frame-title-format (list "Emacs (Nix Generation "
+                                   (cadr
+                                    (split-string (f-base
+                                                   (car
+                                                    (last (split-string
+                                                           (s-chomp (shell-command-to-string (concat "nix-store -q --roots " invocation-directory)))
+                                                           "\n"))))
+                                                  "-"))
+                                   " "
+                                   (s-left 6 (nth 3 (f-split invocation-directory)))
+                                   "..."
+                                   (s-right 6 (car (split-string (nth 3 (f-split invocation-directory)) "-")))
+                                   ")"
+                                   " —  %f"
+                                   '(dired-directory dired-directory)))
+    (setq frame-title-format '("Emacs — %f" (dired-directory dired-directory))))
 #+END_SRC
 
 ** Chrome