about summary refs log tree commit diff
path: root/users/tazjin/emacs
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2023-04-01T15·17+0300
committerclbot <clbot@tvl.fyi>2023-04-01T15·21+0000
commitf687f5c3a356850533d8c8931062246111824d1c (patch)
treea3e72560cd45031fcc7743fba6439c90a1c2bf82 /users/tazjin/emacs
parenta8bd926e0fc22c706d01fe44db2d9f6ea2a552a4 (diff)
fix(tazjin/nixos): scrot is out, maim is in r/6070
Scrot doesn't work very well anyways, it keeps producing crazy
artifacts. Maim seems more sane.

Change-Id: I0823b1755b7810c8b35a9c53f232d2e7f1722943
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8414
Tested-by: BuildkiteCI
Autosubmit: tazjin <tazjin@tvl.su>
Reviewed-by: tazjin <tazjin@tvl.su>
Diffstat (limited to 'users/tazjin/emacs')
-rw-r--r--users/tazjin/emacs/config/functions.el11
1 files changed, 8 insertions, 3 deletions
diff --git a/users/tazjin/emacs/config/functions.el b/users/tazjin/emacs/config/functions.el
index f64907a591b6..23cb47d02a3b 100644
--- a/users/tazjin/emacs/config/functions.el
+++ b/users/tazjin/emacs/config/functions.el
@@ -241,11 +241,16 @@ the GPG agent correctly."
   (if prefix (text-scale-adjust 0)
     (set-face-attribute 'default nil :height (or to 120))))
 
-(defun scrot-select ()
+(defun screenshot-select (filename)
   "Take a screenshot based on a mouse-selection and save it to
   ~/screenshots."
-  (interactive)
-  (shell-command "scrot '$a_%Y-%m-%d_%s.png' -s -e 'mv $f ~/screenshots/'"))
+  (interactive "sScreenshot filename: ")
+  (let* ((path (f-join "~/screenshots"
+                       (format "%s-%d.png"
+                               (if (string-empty-p filename) "shot" filename)
+                               (time-convert nil 'integer)))))
+    (shell-command (format "maim --select %s" path))
+    (message "Wrote screenshot to %s" path)))
 
 (defun graph-unread-mails ()
   "Create a bar chart of unread mails based on notmuch tags.