dotfiles/.emacs.d/exwm/exwm-config.el

109 lines
3.6 KiB
EmacsLisp
Raw Normal View History

2024-12-18 14:49:36 -05:00
(defun efs/run-in-background (command)
(let ((command-parts (split-string command "[ ]+")))
(apply #'call-process `(,(car command-parts) nil 0 nil ,@(cdr command-parts)))))
(defun efs/set-wallpaper ()
(interactive)
;; NOTE: You will need to update this to a valid background path!
(start-process-shell-command
"feh" nil "feh --bg-scale /home/zongor/Pictures/anorlondo.png"))
(defun efs/exwm-init-hook ()
;; Make workspace 1 be the one where we land at startup
(exwm-workspace-switch-create 1)
;; Show battery status in the mode line
(display-battery-mode 1)
;; Show the time and date in modeline
(setq display-time-day-and-date t)
(display-time-mode 1)
;; Also take a look at display-time-format and format-time-string
;; Launch apps that will run in the background
(efs/run-in-background "nm-applet")
;(efs/run-in-background "pasystray")
(efs/run-in-background "blueman-applet"))
(defun efs/exwm-update-class ()
(exwm-workspace-rename-buffer exwm-class-name))
(use-package exwm
:config
;; Set the default number of workspaces
(setq exwm-workspace-number 5)
;; When window "class" updates, use it to set the buffer name
(add-hook 'exwm-update-class-hook #'efs/exwm-update-class)
;; When EXWM starts up, do some extra confifuration
(add-hook 'exwm-init-hook #'efs/exwm-init-hook)
;; Set the screen resolution (update this to be the correct resolution for your screen!)
(require 'exwm-randr)
(exwm-randr-mode 1)
;(efs/set-wallpaper)
;; Load the system tray before exwm-init
(require 'exwm-systemtray)
;(setq exwm-systemtray-height 32)
(exwm-systemtray-mode 1)
;; These keys should always pass through to Emacs
(setq exwm-input-prefix-keys
'(?\C-x
?\C-u
?\C-h
?\M-x
?\M-`
?\M-&
?\M-:
?\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)
([s-right] . windmove-right)
([s-up] . windmove-up)
([s-down] . windmove-down)
;; Launch applications via shell command
([?\s-&] . (lambda (command)
(interactive (list (read-shell-command "$ ")))
(start-process-shell-command command nil command)))
;; Switch workspace
([?\s-w] . 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-SPC") 'counsel-linux-app)
(exwm-enable))
(use-package desktop-environment
:after exwm
:config (desktop-environment-mode)
:custom
(desktop-environment-brightness-small-increment "2%+")
(desktop-environment-brightness-small-decrement "2%-")
(desktop-environment-brightness-normal-increment "5%+")
(desktop-environment-brightness-normal-decrement "5%-"))