From 4906b9da53d587714d3186dfd0b63e0993f9bd5b Mon Sep 17 00:00:00 2001 From: Laurens Miers Date: Fri, 19 Apr 2019 15:46:34 +0200 Subject: [PATCH] EXWM: Move config of exwm to use-package config section - + move found-custom-arg to 'Utils' section. --- config.org | 125 ++++++++++++++++++++++++++++------------------------- 1 file changed, 66 insertions(+), 59 deletions(-) diff --git a/config.org b/config.org index 68fa439..9c23751 100644 --- a/config.org +++ b/config.org @@ -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. -* 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 (defun found-custom-arg (switch) (let ((found-switch (member switch command-line-args))) (setq command-line-args (delete switch command-line-args)) found-switch)) +#+END_SRC -(use-package exwm - :ensure t -) +* EXWM +Arandr config is still too static, should find a way to simplify this. + +#+BEGIN_SRC emacs-lisp (if (found-custom-arg "-start_wm") (progn (message "Loading EXWM...") - (require 'exwm) - (require 'exwm-config) - (require 'exwm-randr) + (use-package exwm + :ensure t + :config + (require 'exwm-systemtray) + (exwm-systemtray-enable) - ;; systray not working? - (require 'exwm-systemtray) - (exwm-systemtray-enable) + (require 'exwm-randr) + (setq exwm-workspace-number 2) - (setq exwm-workspace-number 2) - - (setq exwm-randr-workspace-output-plist - '(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 + (setq exwm-randr-workspace-output-plist + '(0 "DP1" 1 "DP2")) + (add-hook 'exwm-randr-screen-change-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-&': 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]))) + (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) - (global-set-key (kbd "C-x C-b") 'exwm-workspace-switch-to-buffer) + (require 'exwm-config) - ;; Enable EXWM - (exwm-enable) + ;; Make class name the buffer name + (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