;;; package : EXWM configuration --- ;;; .* --- .* ;;; Code: ;; (use-package dmenu ;; :bind ;; ("s-d" . dmenu)) (defun apollo/run_rofi () "Launch rofi. Cant get it to work with exwm as of now tho." (interactive) (start-process-shell-command "rofi" nil "rofi -show run")) ;; (global-set-key (kbd "s-") 'apollo/run_rofi) (defun apollo/run-in-background (command) "Run COMMAND in the background." (let ((command-parts (split-string command "[ ]+"))) (apply #'call-process `(,(car command-parts) nil 0 nil ,@(cdr command-parts))))) (defun apollo/volume-increase () "Increase Volume." (interactive) (start-process-shell-command "amixer" nil "amixer sset Master 5%+")) (defun apollo/volume-decrease () "Decrease Volume." (interactive) (start-process-shell-command "amixer" nil "amixer sset Master 5%-")) (defun apollo/set-wallpaper () "Restore wallpaper." (interactive) (start-process-shell-command "nitrogen" nil "nitrogen --restore")) (defun apollo/change-keys () "Swap caps with ctrl." (interactive) (start-process-shell-command "setxkbmap" nil "setxkbmap -option ctrl:swapcaps")) (defun apollo/exwm-init-hook () "Do this upon start." (display-battery-mode 0) ;;Change to 1 to display battery (setq display-time-day-and-date t) (display-time-mode 1) ;;Launch apps that will run in the background ;; (apollo/run-in-background "blueman-applet") (apollo/run-in-background "picom") ;; (apollo/run-background "nm-applet") (apollo/change-keys) (apollo/set-wallpaper) ) (defun apollo/exwm-update-class () (exwm-workspace-rename-buffer exwm-class-name)) (use-package exwm :config (setq exwm-workspace-number 6) ;; When window "class" updates, use it to set the buffer name (add-hook 'exwm-update-class-hook #'apollo/exwm-update-class) ;;When EXWM starts up, run this hook (add-hook 'exwm-init-hook #'apollo/exwm-init-hook) (start-process-shell-command "xrandr" nil "xrandr --output eDP1 --off --output DP1 --off --output DP2 --off --output HDMI1 --mode 1920x1080 --pos 0x0 --rotate left --output HDMI2 --primary --mode 2560x1440 --pos 1080x0 --rotate normal --output VIRTUAL1 --off") ;; Set the screen resolution (update this to be the correct resolution for your screen!) (require 'exwm-randr) (exwm-randr-enable) ;; (start-process-shell-command "xrandr" nil "xrandr --output Virtual-1 --primary --mode 2048x1152 --pos 0x0 --rotate normal") ;; Load the system tray before exwm-init (require 'exwm-systemtray) (exwm-systemtray-enable) ;; These keys should always pass through to Emacs (setq exwm-input-prefix-keys '(?\C-x ?\C-u ?\C-h ?\C-w ?\M-x ?\M-` ?\M-& ?\M-: ?\s-d ?\C-\M-j ;; Buffer list ?\C-\ )) ;; Ctrl+Space ;; Ctrl+Q will enable the next key to be sent directly (define-key exwm-mode-map [?\C-q] 'exwm-input-send-next-key) ;; Set up global key bindings. These always work, no matter the input state! ;; Keep in mind that changing this list after EXWM initializes has no effect. (setq exwm-input-global-keys `( ;; Reset to line-mode (C-c C-k switches to char-mode via exwm-input-release-keyboard) ([?\s-r] . exwm-reset) ;; Move between windows ([s-left] . windmove-left) ([C-w C-n] . windmove-right) ([s-up] . windmove-up) ([s-down] . windmove-down) ([C-w C-v] . split-window-right) ;; Launch applications via shell command ([?\s-&] . (lambda (command) (interactive (list (read-shell-command "$ "))) (start-process-shell-command command nil command))) ;; Switch workspace ([?\s-e] . exwm-workspace-switch) ([?\s-`] . (lambda () (interactive) (exwm-workspace-switch-create 0))) ;; 's-N': Switch to certain workspace with Super (Win) plus a number key (0 - 9) ,@(mapcar (lambda (i) `(,(kbd (format "s-%d" i)) . (lambda () (interactive) (exwm-workspace-switch-create ,i)))) (number-sequence 0 9)))) (exwm-input-set-key (kbd "s-d") 'counsel-linux-app) (exwm-input-set-key (kbd "s-") 'apollo/run_rofi) (exwm-input-set-key (kbd "s-q") 'kill-emacs) (exwm-input-set-key (kbd "") 'apollo/volume-increase) (exwm-input-set-key (kbd "") 'apollo/volume-decrease) (exwm-enable)) ;;; init-exwm.el ends here