summaryrefslogtreecommitdiff
path: root/.emacs.d/snippets/exwm-holyK-firefox.el
diff options
context:
space:
mode:
Diffstat (limited to '.emacs.d/snippets/exwm-holyK-firefox.el')
-rw-r--r--.emacs.d/snippets/exwm-holyK-firefox.el97
1 files changed, 63 insertions, 34 deletions
diff --git a/.emacs.d/snippets/exwm-holyK-firefox.el b/.emacs.d/snippets/exwm-holyK-firefox.el
index 5e741a4..8604990 100644
--- a/.emacs.d/snippets/exwm-holyK-firefox.el
+++ b/.emacs.d/snippets/exwm-holyK-firefox.el
@@ -12,46 +12,75 @@
;;; Code:
-;(require 'exwm-firefox-core)
+(require 'exwm-firefox-core)
+(require 'exwm)
+
+(defvar exwm-firefox-holyK-mode-map
+ (let
+ ((map (make-sparse-keymap)))
+ (define-key map (kbd "C-n") 'exwm-firefox-core-down)
+ (define-key map (kbd "C-p") 'exwm-firefox-core-up)
+ (define-key map (kbd "C-f") 'exwm-firefox-core-right)
+ (define-key map (kbd "C-b") 'exwm-firefox-core-left)
+ (define-key map (kbd "C-y") 'exwm-firefox-core-paste)
+ (define-key map (kbd "C-s") 'exwm-firefox-core-quick-find)
+ (define-key map (kbd "M-f") 'exwm-firefox-core-tab-next)
+ (define-key map (kbd "M-b") 'exwm-firefox-core-tab-previous)
+ (define-key map (kbd "C-c C-c") 'exwm-firefox-core-copy)
+ (define-key map (kbd "C-c n") 'exwm-firefox-core-tab-new)
+ (define-key map (kbd "C-c d") 'exwm-firefox-core-tab-close)
+ (define-key map (kbd "C-c b") 'exwm-firefox-core-history-back)
+ (define-key map (kbd "C-c f") 'exwm-firefox-core-history-forward)
+ (define-key map (kbd "C-c C-d") 'exwm-firefox-core-window-close)
+ (define-key map (kbd "C-c C-n") 'exwm-firefox-core-window-new)
+ (define-key map (kbd "C-c C-p") 'exwm-firefox-core-window-new-private)
+ (define-key map (kbd "C-l") 'exwm-firefox-core-focus-search-bar)
+ (define-key map (kbd "C-/") 'exwm-firefox-core-undo)
+ (define-key map (kbd "M-<") 'exwm-firefox-core-top)
+ (define-key map (kbd "M->") 'exwm-firefox-core-bottom)
+ (define-key map (kbd "C-c C-b") 'exwm-firefox-core-bookmark-new)
+ (define-key map (kbd "C-c r") 'exwm-firefox-core-reload)
+ (define-key map (kbd "C-c C-r") 'exwm-firefox-core-reload-override-cache)
+ (define-key map (kbd "C-c B") 'exwm-firefox-core-bookmark-menu)
+ (define-key map (kbd "C-c C-b") 'exwm-firefox-core-bookmark-new)
+ (define-key map (kbd "C-c C-t m") 'exwm-firefox-core-tab-mute)
+ (define-key map (kbd "C-c C-t l") 'exwm-firefox-core-tab-last)
+ (define-key map (kbd "C-c C-t f") 'exwm-firefox-core-tab-first)
+ (define-key map (kbd "C-d") 'exwm-firefox-core-cut)
+ (define-key map (kbd "C-c C-o f") 'exwm-firefox-core-open-file)
+ (define-key map (kbd "C-c C-q") 'exwm-firefox-core-quit)
+ (define-key map (kbd "C-c C-m r") 'exwm-firefox-core-reader-mode)
+ (define-key map (kbd "C-c C-s") 'exwm-firefox-core-save-page)
+ map))
(defvar exwm-firefox-class-names
'("firefox-default" "firefox" "Firefox"
- "Nightly" "Icecat" "icecat-default" "Iceweasel")
- "The class name used for detecting if current buffer is a firefox browser.")
-
-(define-minor-mode exwm-firefox-holyK-mode
- "Get Emacs keybindings in Firefox with EXWM."
- :lighter " Firefox/EXWM"
- :keymap (let
- ((map (make-sparse-keymap)))
- (define-key map (kbd "C-n") 'exwm-firefox-core-down)
- (define-key map (kbd "C-p") 'exwm-firefox-core-up)
- (define-key map (kbd "C-f") 'exwm-firefox-core-right)
- (define-key map (kbd "C-b") 'exwm-firefox-core-left)
- (define-key map (kbd "C-y") 'exwm-firefox-core-paste)
- (define-key map (kbd "C-s") 'exwm-firefox-core-quick-find)
- (define-key map (kbd "M-f") 'exwm-firefox-core-tab-next)
- (define-key map (kbd "M-b") 'exwm-firefox-core-tab-previous)
- (define-key map (kbd "C-c C-c") 'exwm-firefox-core-copy)
- (define-key map (kbd "C-c n") 'exwm-firefox-core-tab-new)
- (define-key map (kbd "C-c d") 'exwm-firefox-core-tab-close)
- (define-key map (kbd "C-c b") 'exwm-firefox-core-history-back)
- (define-key map (kbd "C-c f") 'exwm-firefox-core-history-forward)
- (define-key map (kbd "C-l") 'exwm-firefox-core-focus-search-bar)
- (define-key map (kbd "C-/") 'exwm-firefox-core-undo)
- (define-key map (kbd "M-<") 'exwm-firefox-core-top)
- (define-key map (kbd "M->") 'exwm-firefox-core-bottom)
- (define-key map (kbd "C-c C-b") 'exwm-firefox-core-bookmark-new)
- map))
+ "Nightly" "Icecat" "icecat-default"
+ "icecat" "Iceweasel")
+ "The class name used for detecting if current buffer is a firefox browser.")
(defun holyK-activate-if-firefox ()
"Activates firefox-holyK-mode mode when buffer is firefox.
Firefox variant can be assigned in 'exwm-firefox-class-names`"
(interactive)
- (if (member exwm-class-name exwm-firefox-class-names)
- (list (exwm-firefox-holyK-mode 1)
- (setq-local exwm-input-line-mode-passthrough nil)
- ;;if exwm-input-line-mode-passthroug t mouse will stop working properly
- )))
+ (when (member exwm-class-name exwm-firefox-class-names)
+ (exwm-firefox-holyK-mode 1)
+ (setq-local exwm-input-line-mode-passthrough nil)
+ ;; if exwm-input-line-mode-passthrough t
+ ;; the mouse will stop working properly
+ ))
+
+(define-minor-mode exwm-firefox-holyK-mode
+ "Get Emacs keybindings in Firefox with EXWM."
+ :lighter " Firefox/EXWM"
+ (if exwm-firefox-holyK-mode
+ (add-hook 'window-configuration-change-hook 'holyK-activate-if-firefox)
+ (remove-hook 'window-configuration-change-hook 'holyK-activate-if-firefox)))
+
+
+
+(provide 'exwm-holyK-firefox)
+
+;;; exwm-holyK-firefox.el ends here.
+
-(add-hook 'exwm-mode 'holyK-activate-if-firefox)