Skip to content

Commit

Permalink
Small fix to eaf-layer refactor
Browse files Browse the repository at this point in the history
This PR reimplements the refactor changes by @lebensterben but with his fix as
he suggested [here](syl20bnr#14681 (comment))
  • Loading branch information
dalanicolai committed May 8, 2021
1 parent c4a1caa commit fccbca1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
18 changes: 10 additions & 8 deletions layers/+tools/eaf/README.org
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,19 @@ If you do want to modify the leader keys, then information about the tricks
implemented in this layer can be found [[https://github.com/manateelazycat/emacs-application-framework/issues/498][here]] and [[https://github.com/manateelazycat/emacs-application-framework/pull/500][here]].

* Key bindings
Except for the few Spacemacs specific modifications listed below, all EAF
keybindings are documented [[https://github.com/manateelazycat/emacs-application-framework/wiki/Keybindings][here.]]

Use ~SPC t k m~ to [[https://develop.spacemacs.org/doc/DOCUMENTATION.html#which-key-persistent][show the EAF keybindings persistently in which-key]], or use
~SPC h d K~ to show the `eaf-mode-map` in a separate buffer.
** Global
*** All EAF-applications

| Key binding | Description |
|-------------+----------------------------------------------------------------------------|
| ~SPC a a f~ | EAF open file ([[https://github.com/manateelazycat/emacs-application-framework#launch-eaf-applications][see EAF doc for supported file types]]) |
| ~SPC t k m~ | Show available key commands in which-key (read [[https://develop.spacemacs.org/doc/DOCUMENTATION.html#which-key][here]] for more details) |
| ~SPC m d~ | toggle dark-mode (or in browser press ~M-d~, in pdf-viewer just press ~d~) |
| Key binding | Description |
|-------------+-------------------------------------------------------------------------------|
| ~SPC a a f~ | EAF open file ([[https://github.com/manateelazycat/emacs-application-framework#launch-eaf-applications][see EAF doc for supported file types]]) |
| ~SPC t k m~ | Show available key commands in which-key (read [[https://develop.spacemacs.org/doc/DOCUMENTATION.html#which-key][here]] for more details) |
| ~SPC m d~ | toggle dark-mode (or in browser press ~M-d~ and in pdf-viewer just press ~d~) |

*** Browser

Expand Down Expand Up @@ -102,6 +107,3 @@ implemented in this layer can be found [[https://github.com/manateelazycat/emacs
| Key binding | Description |
|-------------+------------------------|
| ~SPC m e~ | open in eaf pdf-viewer |

There are many more key bindings. Use ~SPC t k m~ to [[https://develop.spacemacs.org/doc/DOCUMENTATION.html#which-key-persistent][show them persistently in
which-key]], or use ~SPC h d k~ to show the `eaf-mode-map` in a separate buffer.
12 changes: 7 additions & 5 deletions layers/+tools/eaf/packages.el
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@
("-" . "insert_or_zoom_out")
("=" . "insert_or_zoom_in")
("0" . "insert_or_zoom_reset")
;; ("d" . "insert_or_dark_mode")
("m" . "insert_or_save_as_bookmark")
("o" . "insert_or_open_browser")
;; ("y" . "insert_or_download_youtube_video")
Expand Down Expand Up @@ -235,11 +236,12 @@
(lambda (prompt)
(if (derived-mode-p 'eaf-mode)
(pcase eaf--buffer-app-name
("browser" (if (string= (eaf-call-sync "call_function" eaf--buffer-id "is_focus") "True")
(kbd "SPC")
(kbd eaf-evil-leader-key)))
("pdf-viewer" (kbd eaf-evil-leader-key))
("image-viewer" (kbd eaf-evil-leader-key))
((or
(and "browser"
(guard (not (string= (eaf-call-sync "call_function" eaf--buffer-id "is_focus") "True"))))
"image-viewer"
"pdf-viewer")
(kbd eaf-evil-leader-key))
(_ (kbd "SPC")))
(kbd "SPC"))))

Expand Down

0 comments on commit fccbca1

Please sign in to comment.