From 572d19f19416bd65d7fb3e24967655c9ce62fbce Mon Sep 17 00:00:00 2001 From: Vincent Zhang Date: Sun, 18 Aug 2019 00:40:07 +0800 Subject: [PATCH] Enhance grip segment. --- doom-modeline-segments.el | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/doom-modeline-segments.el b/doom-modeline-segments.el index 701e121..869fe08 100644 --- a/doom-modeline-segments.el +++ b/doom-modeline-segments.el @@ -2310,10 +2310,19 @@ The cdr can also be a function that returns a name to use.") :height 1.1 :v-adjust -0.225) "G") - 'help-echo (format "Preview with grip: http://localhost:%d -mouse-1: Exit preview" grip-port) + 'help-echo (format "Preview on: http://localhost:%d +mouse-1: Open browser +mouse-2: Stop preview" + grip-port) 'mouse-face '(:box 0) - 'local-map (make-mode-line-mouse-map 'mouse-1 #'grip-mode)) + 'local-map (let ((map (make-sparse-keymap))) + (define-key map [mode-line mouse-1] + (lambda () + (interactive) + (browse-url (format "http://localhost:%d" grip-port)))) + (define-key map [mode-line mouse-2] + #'grip-mode) + map)) (doom-modeline-spc)))) (provide 'doom-modeline-segments)