On my dell I want to use exwm as the main window manager.
Write a desktop file called emacs.desktop
and place here:
/usr/share/xsessions
[Desktop Entry] Name=EXWM Comment=Emacs as a window manger Exec=emacs -l ~/.emacs.d/elisp/exwm_config.el Type=Application
(use-package exwm
:ensure t
:config
;; necessary to configure exwm manually
(require 'exwm-config)
;; fringe size, most people prefer 1
(fringe-mode 1)
;; emacs as a daemon, use "emacsclient <filename>" to seamlessly edit files from the terminal directly in the exwm instance
(server-start)
;; this fixes issues with ido mode, if you use helm, get rid of it
;;(exwm-config-ido)
;;(exwm-enable-ido-workaround)
;; a number between 1 and 9, exwm creates workspaces dynamically so I like starting out with 1
(setq exwm-workspace-number 1)
;; this is a way to declare truly global/always working keybindings
;; this is a nifty way to go back from char mode to line mode without using the mouse
(exwm-input-set-key (kbd "s-r") #'exwm-reset)
(exwm-input-set-key (kbd "s-k") #'exwm-workspace-delete)
(exwm-input-set-key (kbd "s-w") #'exwm-workspace-swap)
;; the next loop will bind s-<number> to switch to the corresponding workspace
(dotimes (i 10)
(exwm-input-set-key (kbd (format "s-%d" i))
`(lambda ()
(interactive)
(exwm-workspace-switch-create ,i))))
;; the simplest launcher, I keep it in only if dmenu eventually stopped working or something
(exwm-input-set-key (kbd "s-&")
(lambda (command)
(interactive (list (read-shell-command "$ ")))
(start-process-shell-command command nil command)))
;; an easy way to make keybindings work *only* in line mode
(push ?\C-q exwm-input-prefix-keys)
(define-key exwm-mode-map [?\C-q] #'exwm-input-send-next-key)
;; simulation keys are keys that exwm will send to the exwm buffer upon inputting a key combination
(exwm-input-set-simulation-keys
'(
;; movement
([?\C-b] . left)
([?\M-b] . C-left)
([?\C-f] . right)
([?\M-f] . C-right)
([?\C-p] . up)
([?\C-n] . down)
([?\C-a] . home)
([?\C-e] . end)
([?\M-v] . prior)
([?\C-v] . next)
([?\C-d] . delete)
([?\C-k] . (S-end delete))
;; cut/paste
([?\C-w] . ?\C-x)
([?\M-w] . ?\C-c)
([?\C-y] . ?\C-v)
;; search
([?\C-s] . ?\C-f)))
;; this little bit will make sure that XF86 keys work in exwm buffers as well
(dolist (k '(
XF86AudioMute
XF86AudioLowerVolume
XF86AudioRaiseVolume
XF86AudioPrev
XF86AudioPlay
XF86AudioNext
XF86MonBrightnessUp
XF86MonBrightnessDown
)) (cl-pushnew k exwm-input-prefix-keys))
;; this little bit will make sure that XF86 keys work in exwm buffers as well
;; xrandr --output eDP-1 --brightness 0.75
;; This just enables exwm, it started automatically once everything is ready
(exwm-enable))
(require 'exwm-systemtray)
(exwm-systemtray-enable)
(setq exwm-systemtray-height 16)
(use-package dmenu
:ensure t
:bind
("s-SPC" . 'dmenu))