Master branch of exwm seems to have fixed the firefox issue

This commit is contained in:
Benson Chu 2018-07-06 15:10:54 -05:00
parent c2ae9c9e30
commit d9e5bb9e6b
4 changed files with 52 additions and 87 deletions

6
.gitmodules vendored
View file

@ -13,3 +13,9 @@
[submodule "custom/emacs-memoize"] [submodule "custom/emacs-memoize"]
path = custom/emacs-memoize path = custom/emacs-memoize
url = https://github.com/skeeto/emacs-memoize url = https://github.com/skeeto/emacs-memoize
[submodule "custom/exwm"]
path = custom/exwm
url = https://github.com/ch11ng/exwm
[submodule "custom/xelb"]
path = custom/xelb
url = https://github.com/ch11ng/xelb

View file

@ -82,102 +82,59 @@
* EXWM * EXWM
** Config ** Config
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package exwm) ;(use-package exwm)
(add-to-list 'load-path "~/.emacs.d/custom/exwm")
(add-to-list 'load-path "~/.emacs.d/custom/xelb")
(require 'exwm)
(require 'exwm-systemtray) (require 'exwm-systemtray)
(require 'exwm-config) (require 'exwm-config)
(exwm-config-default) (exwm-config-default)
;(setq exwm-input-line-mode-passthrough t) ;(setq exwm-input-line-mode-passthrough t)
#+END_SRC #+END_SRC
** Set focus fix
#+BEGIN_SRC emacs-lisp
(defun exwm-input--set-focus (id)
"Set input focus to window ID in a proper way."
(when (exwm--id->buffer id)
(with-current-buffer (exwm--id->buffer id)
(cond
((and (not exwm--hints-input)
(memq xcb:Atom:WM_TAKE_FOCUS exwm--protocols))
(when (= (frame-parameter nil 'exwm-id)
(slot-value (xcb:+request-unchecked+reply exwm--connection
(make-instance 'xcb:GetInputFocus))
'focus))
(exwm--log "Focus on #x%x with WM_TAKE_FOCUS" id)
(exwm-input--update-timestamp
(lambda (timestamp id)
(let ((event (make-instance 'xcb:icccm:WM_TAKE_FOCUS
:window id
:time timestamp)))
(setq event (xcb:marshal event exwm--connection))
(xcb:+request exwm--connection
(make-instance 'xcb:icccm:SendEvent
:destination id
:event event))
(exwm-input--set-active-window id)
(xcb:flush exwm--connection)))
id)))
(t
(exwm--log "Focus on #x%x with SetInputFocus" id)
(exwm-input--update-timestamp
(lambda (timestamp id)
(let ((event (make-instance 'xcb:icccm:WM_TAKE_FOCUS
:window id
:time timestamp)))
(setq event (xcb:marshal event exwm--connection))
(xcb:+request exwm--connection
(make-instance 'xcb:icccm:SendEvent
:destination id
:event event)))
(xcb:+request exwm--connection
(make-instance 'xcb:SetInputFocus
:revert-to xcb:InputFocus:Parent
:focus id
:time timestamp))
(exwm-input--set-active-window id)
(xcb:flush exwm--connection))
id))))))
#+END_SRC
** Global keys ** Global keys
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(setq exwm-input-global-keys (use-package transpose-frame)
`(([?\s-r] . exwm-reset) (setq exwm-input-global-keys
([?\s-w] . exwm-workspace-switch) `(([?\s-r] . exwm-reset)
([?\s-l] . lock-screen) ([?\s-w] . exwm-workspace-switch)
,@(mapcar (lambda (i) ([?\s-l] . lock-screen)
`(,(kbd (format "s-%d" (mod (1+ i) 10))) . ,@(mapcar (lambda (i)
(lambda () `(,(kbd (format "s-%d" (mod (1+ i) 10))) .
(interactive) (lambda ()
(exwm-workspace-switch-create ,i)))) (interactive)
(number-sequence 0 9)) (exwm-workspace-switch-create ,i))))
(,(kbd "s-b") . ivy-switch-buffer) (number-sequence 0 9))
(,(kbd "s-a") . org-agenda) (,(kbd "s-b") . ivy-switch-buffer)
(,(kbd "s-c") . org-capture) (,(kbd "s-a") . org-agenda)
(,(kbd "s-h") . split-window-right) (,(kbd "s-c") . org-capture)
(,(kbd "s-t") . split-window-below) (,(kbd "s-h") . split-window-right)
(,(kbd "s-n") . switch-window) (,(kbd "s-t") . split-window-below)
(,(kbd "s-k") . ido-kill-buffer) (,(kbd "s-n") . switch-window)
(,(kbd "s-s") . resize-window))) (,(kbd "s-k") . ido-kill-buffer)
(global-set-key (kbd "M-T") 'flop-frame) (,(kbd "s-s") . resize-window)))
(global-set-key (kbd "C-x p") 'launch-program) (global-set-key (kbd "M-T") 'flop-frame)
(global-set-key (kbd "M-…") 'multi-term) (global-set-key (kbd "C-x p") 'launch-program)
(global-set-key (kbd "C-ü") 'undo-tree-undo) (global-set-key (kbd "M-…") 'multi-term)
(global-set-key (kbd "C-ü") 'undo-tree-undo)
(defun prompt-workspace (&optional prompt) (defun prompt-workspace (&optional prompt)
"Prompt for a workspace, returning the workspace frame." "Prompt for a workspace, returning the workspace frame."
(exwm-workspace--update-switch-history) (exwm-workspace--update-switch-history)
(let* ((current-idx (exwm-workspace--position exwm-workspace--current)) (let* ((current-idx (exwm-workspace--position exwm-workspace--current))
(history-add-new-input nil) ;prevent modifying history (history-add-new-input nil) ;prevent modifying history
(history-idx (read-from-minibuffer (history-idx (read-from-minibuffer
(or prompt "Workspace: ") (or prompt "Workspace: ")
(elt exwm-workspace--switch-history current-idx) (elt exwm-workspace--switch-history current-idx)
exwm-workspace--switch-map nil exwm-workspace--switch-map nil
`(exwm-workspace--switch-history . ,(1+ current-idx)))) `(exwm-workspace--switch-history . ,(1+ current-idx))))
(workspace-idx (mod (1- (cl-position history-idx exwm-workspace--switch-history (workspace-idx (mod (1- (cl-position history-idx exwm-workspace--switch-history
:test #'equal)) 10))) :test #'equal))
(elt exwm-workspace--list workspace-idx))) 10)))
(elt exwm-workspace--list workspace-idx)))
(advice-add 'exwm-workspace--prompt-for-workspace (advice-add 'exwm-workspace--prompt-for-workspace
:override :override
#'prompt-workspace) #'prompt-workspace)
#+END_SRC #+END_SRC
** Custom ** Custom

1
custom/exwm Submodule

@ -0,0 +1 @@
Subproject commit 0680be104f9394e39dd55b5c4e33b9b7e4e77926

1
custom/xelb Submodule

@ -0,0 +1 @@
Subproject commit 4509a3304ebfdb64a41be3ad2dc239c70227112e