Skip to content

Latest commit

 

History

History
231 lines (135 loc) · 4.58 KB

Emacs-Desktop-02.org

File metadata and controls

231 lines (135 loc) · 4.58 KB

Improving the EXWM Experience

Desktop.org

Take a look at new Desktop.org file. We have to update auto-tangle hook to accomodate this:

;; Automatically tangle our Emacs.org config file when we save it
(defun efs/org-babel-tangle-config ()
  (when (string-equal (file-name-directory (buffer-file-name))
                      (expand-file-name "~/.emacs.d/"))
    ;; Dynamic scoping to the rescue
    (let ((org-confirm-babel-evaluate nil))
      (org-babel-tangle))))

Only load desktop.el when EXWM is needed in start-exwm.sh:

exec dbus-launch --exit-with-session emacs -mm --debug-init -l ~/.emacs.d/desktop.el

Configuring EXWM after load

Use exwm-init-hook:

(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 dw/exwm-init-hook ()
  ;; Make workspace 1 be the one where we land at startup
  (exwm-workspace-switch-create 1)

  ;; Open eshell by default
  ;;(eshell)

  ;; Launch apps that will run in the background
  (efs/run-in-background "nm-applet"))

In use-package exwm:

;; When EXWM finishes initialization, do some extra setup
(add-hook 'exwm-init-hook #'efs/after-exwm-init)

Setting a background image

Install and run Compton:

sudo apt install compton
compton &

There’s a newer program called Picom for this purpose, but it may not be in all Linux distributions. Compton is pretty universal.

Install and run feh:

sudo apt install feh
feh --bg-scale /usr/share/backgrounds/matt-mcnulty-nyc-2nd-ave.jpg

Set frame transparency and maximize windows by default.

;; Set frame transparency
(set-frame-parameter (selected-frame) 'alpha '(90 . 90))
(add-to-list 'default-frame-alist '(alpha . (90 . 90)))
(set-frame-parameter (selected-frame) 'fullscreen 'maximized)
(add-to-list 'default-frame-alist '(fullscreen . maximized))

Add to your configuration early in EXWM setup:

(defun efs/set-wallpaper ()
  (interactive)
  (start-process-shell-command
   "feh" nil  "feh --bg-scale /usr/share/backgrounds/matt-mcnulty-nyc-2nd-ave.jpg"))

Run this function after running xrandr to make sure it stretches to screen size!

;; Set the wallpaper after setting screen resolution
(efs/set-wallpaper)

In start-exwm.sh:

# Enable screen compositing
compton &

Using media keys

Use the desktop-environment package!

https://github.com/DamienCassou/desktop-environment

(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%-"))

Make sure to install dependencies:

sudo apt install scrot brightnessctl playerctl

Computer status and configuration

Tray apps

Tray apps like blueman and pasystray:

sudo apt install blueman pasystray pavucontrol
(efs/run-in-background "pavucontrol"))
(efs/run-in-background "blueman-applet"))

Make sure to add exwm-systemtray-height to make sure icons appear!

(setq exwm-systemtray-height 32)

Mode line status

Battery and time display:

;; 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

Better app launcher

Use counsel-linux-app!

In your use-package counsel:

:custom
(counsel-linux-app-format-function #'counsel-linux-app-format-function-name-only)

In your EXWM config:

(exwm-input-set-key (kbd "s-SPC") 'counsel-linux-app)
(exwm-input-set-key (kbd "s-f") 'exwm-layout-toggle-fullscreen)

Locking the screen

Use slock and xss-lock!

sudo apt install slock xss-lock

Add this to start-exwm.sh:

# Enable screen locking on suspend
xss-lock -- slock &