EXWM: Move config of exwm to use-package config section

- + move found-custom-arg to 'Utils' section.
This commit is contained in:
Laurens Miers 2019-04-19 15:46:34 +02:00
parent 794973b051
commit 4906b9da53

View file

@ -24,81 +24,88 @@ This configuration requires the installation of :
When first checking out this config, run =irony-install-server= to make and install the irony-server. When first checking out this config, run =irony-install-server= to make and install the irony-server.
* EXWM * Utils
** Custom command line arguments
Return if a custom command line arguments was found.
If it was found, we delete it from the list of command line arguments.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(defun found-custom-arg (switch) (defun found-custom-arg (switch)
(let ((found-switch (member switch command-line-args))) (let ((found-switch (member switch command-line-args)))
(setq command-line-args (delete switch command-line-args)) (setq command-line-args (delete switch command-line-args))
found-switch)) found-switch))
#+END_SRC
(use-package exwm * EXWM
:ensure t
)
Arandr config is still too static, should find a way to simplify this.
#+BEGIN_SRC emacs-lisp
(if (found-custom-arg "-start_wm") (if (found-custom-arg "-start_wm")
(progn (progn
(message "Loading EXWM...") (message "Loading EXWM...")
(require 'exwm) (use-package exwm
(require 'exwm-config) :ensure t
(require 'exwm-randr) :config
(require 'exwm-systemtray)
(exwm-systemtray-enable)
;; systray not working? (require 'exwm-randr)
(require 'exwm-systemtray) (setq exwm-workspace-number 2)
(exwm-systemtray-enable)
(setq exwm-workspace-number 2) (setq exwm-randr-workspace-output-plist
'(0 "DP1" 1 "DP2"))
(setq exwm-randr-workspace-output-plist (add-hook 'exwm-randr-screen-change-hook
'(0 "DP1" 1 "DP2"))
(add-hook 'exwm-randr-screen-change-hook
(lambda ()
(start-process-shell-command
"xrandr" nil "xrandr --output DP2 --primary --mode 1920x1080 --pos 1920x0 --rotate left --output DP1 --mode 1920x1080 --pos 0x0 --rotate normal --auto")))
(exwm-randr-enable)
;; Make class name the buffer name
(add-hook 'exwm-update-class-hook
(lambda () (lambda ()
(exwm-workspace-rename-buffer exwm-class-name))) (start-process-shell-command
;; Global keybindings. "xrandr" nil "xrandr --output DP2 --primary --mode 1920x1080 --pos 1920x0 --rotate left --output DP1 --mode 1920x1080 --pos 0x0 --rotate normal --auto")))
(setq exwm-input-global-keys (exwm-randr-enable)
`(
;; 's-r': Reset (to line-mode).
([?\s-r] . exwm-reset)
;; 's-w': Switch workspace.
([?\s-w] . exwm-workspace-switch)
;; 's-&': Launch application.
([s-return] . (lambda (command)
(interactive (list (read-shell-command "$ ")))
(start-process-shell-command command nil command)))
;; 's-N': Switch to certain workspace.
,@(mapcar (lambda (i)
`(,(kbd (format "s-%d" i)) .
(lambda ()
(interactive)
(exwm-workspace-switch-create ,i))))
(number-sequence 0 9))))
;; Line-editing shortcuts
(setq exwm-input-simulation-keys
'(([?\C-b] . [left])
([?\C-f] . [right])
([?\C-p] . [up])
([?\C-n] . [down])
([?\C-a] . [home])
([?\C-e] . [end])
([?\M-v] . [prior])
([?\C-v] . [next])
([?\C-d] . [delete])
([?\C-s] . [C-f])
([?\C-k] . [S-end delete])))
(global-set-key (kbd "C-x C-b") 'exwm-workspace-switch-to-buffer) (require 'exwm-config)
;; Enable EXWM ;; Make class name the buffer name
(exwm-enable) (add-hook 'exwm-update-class-hook
(lambda ()
(exwm-workspace-rename-buffer exwm-class-name)))
;; Global keybindings.
(setq exwm-input-global-keys
`(
;; 's-r': Reset (to line-mode).
([?\s-r] . exwm-reset)
;; 's-w': Switch workspace.
([?\s-w] . exwm-workspace-switch)
;; 's-return': Launch application.
([s-return] . (lambda (command)
(interactive (list (read-shell-command "$ ")))
(start-process-shell-command command nil command)))
;; 's-N': Switch to certain workspace.
,@(mapcar (lambda (i)
`(,(kbd (format "s-%d" i)) .
(lambda ()
(interactive)
(exwm-workspace-switch-create ,i))))
(number-sequence 0 9))))
;; Line-editing shortcuts
(setq exwm-input-simulation-keys
'(([?\C-b] . [left])
([?\C-f] . [right])
([?\C-p] . [up])
([?\C-n] . [down])
([?\C-a] . [home])
([?\C-e] . [end])
([?\M-v] . [prior])
([?\C-v] . [next])
([?\C-d] . [delete])
([?\C-s] . [C-f])
([?\C-k] . [S-end delete])))
(global-set-key (kbd "C-x C-b") 'exwm-workspace-switch-to-buffer)
;; Enable EXWM
(exwm-enable)
)
) )
) )
#+END_SRC #+END_SRC