How to Use Emacs as a Desktop Environment in Linux with EXWM

by Joana Maria
20 minutes read

How to Use Emacs as a Desktop Environment in Linux with EXWM

A photograph of a individual typing on a laptop computer system.

Exwm is a lightweight tiling residence window boss for Linux that revolves Emacs into a extensive visual ambience. In this blog post, I will noticeably go via the boni of gleaning utility of Exwm, install it on Ubuntu 24.10, and debunk some of what you can lug out via this astounding residence window boss.

Content
  • Why Usage Exwm As Your Abode window Boss
  • Posturing Exwm in Emacs
  • Making earn employ of of Exwm for the Initially Time
  • Sprinting and Taking care of Regiments in Exwm
  • Configuring and Matching Exwm
  • Devising Brand-newfangled Pivot-board Shortcuts in Exwm

Why Usage Exwm As Your Abode window Boss

One of the greatest selling times of Exwm is that it can combine other apps into your current Emacs workflow. This permits you to earn employ of what you currently recognized about Emacs buffers and use it to your other apps, gleaning you added undisputable in the long run.

A screenshot reflecting Exwm sprinting Firefox and a need Emacs buffer.

In reclamation, Exwm in addition declines the quantity of config records pose on a desktop computer installation. With it, your .emacs record miens as the config for your message editor and your residence window boss. This administers it eye-recording to clients who want to lessen the clutter they deal with on their tool.

A screenshot reflecting the major Emacs config record for the Exwm desktop computer.

Last however not the awfully least, Exwm is super lean and rapid. In my suffer, loading the residence window boss from a frosty boot forecloses a few seconds, and sprinting it for a entirety day simply consumes over 500 MB of RAM.

On a side chit: glancing for a added dynamic residence window boss? Dissect out our overview on arranging and sprinting Hyprland in Linux.

Posturing Exwm in Emacs

The first quantify in installing Exwm in Linux is to earn sure that you have both Emacs and its dependencies on your tool. To lug out that, run the ensuing command:

sudo apt install emacs dbus gnome-settings-daemon

Amenable your Emacs consumer, press Alt + X, then form “technique-install” to lug up the editors installment incite.

Kind “exwm” on the incite, then press Get in to install the residence window boss within Emacs.

A screenshot accentuating the Install Peculiarity incite in Emacs.

Press Ctrl + X, then Ctrl + F to lug up the record buffer, form “~/.emacs” on the incite, then press Get in.

Paste the ensuing block of code within your brand name-newfangled .emacs record. This is a individualized model of the default config record that offers the minimum kit of features for Exwm:

(menu-bar-mode -1) (tool-bar-mode -1) (scroll-bar-mode -1) (fringe-mode 1) (setq display-time-default-load-average nil) (display-time-mode t) (icomplete-vertical-mode 1) (exwm-systemtray-mode 1)   (require 'exwm) (setq exwm-workspace-number 5) (setq exwm-input-global-keys       `(         ([?s-r] . exwm-reset)           ([?s-w] . exwm-workspace-switch)           ([?s-&] . (lambda (command)            (interactive (list (read-shell-command "$ ")))            (start-process-shell-command command nil command)))           ,@(mapcar (lambda (i)                     `(,(kbd (format "s-%d" i)) .                       (lambda ()                         (interactive)                         (exwm-workspace-switch-create ,i))))                   (number-sequence 0 9))))   (exwm-enable)

Tab: you can in addition incorporate this code to an current Emacs config. Merely earn sure to void (exwm-enable) after your Exwm-synonymous settings.

Press Ctrl + X, then Ctrl + S to preserve your brand name-newfangled .emacs record.

A screenshot reflecting the example config in an actual .emacs record.

Amenable your municipality individual’s .xsession record, then paste the ensuing block of code within it:

xhost +SI:localuser:$USER gnome-settings-daemon & xsetroot -cursor_name left_ptr xset r rate 200 60   exec dbus-launch --exit-with-session emacs

Conserve your .xsessions record, then run the ensuing command to model a brand name-newfangled desktop computer entry for your tool:

sudo nano /usr/share/xsessions/emacs.desktop

Paste the ensuing within your brand name-newfangled .desktop computer record:

[Desktop Entry]<br>Name=Exwm<br>Exec=emacs<br>Type=Application
A screenshot reflecting a example desktop computer entry for Exwm.

Conserve your brand name-newfangled desktop computer record, then reboot your tool to fully use your brand name-newfangled settings.

Sweet to recognized: Dissect out some of our picks for the faultless desktop computer environments for 2024.

Making earn employ of of Exwm for the Initially Time

At this juncture, you currently have a need installment of Emacs and Exwm sprinting on your Ubuntu Linux desktop computer. To earn employ of it, click the Advancement symbol on your tool’s login incite, then decide Exwm.

A screenshot accentuating the Exwm entry within GDM.

Login to your individual account, then wait for a pair of seconds as Emacs and Exwm agglomerations on your current session.

When within, the first point that you can lug out is model a brand name-newfangled residence window within the current work-related expanse. For that, press Ctrl + X, then 3. This will noticeably model a upright residence window rip, placing the residence window on the right side of the display.

A screenshot reflecting a upright residence window rip in Exwm.

You can in addition press Ctrl + X, then 2 to model a horizontal rip via the brand name-newfangled residence window resting at the substructure of your display.

A screenshot reflecting a horizontal residence window rip in Exwm.

To slide in between unalike workspaces, press Win complied via by the any number in your pivot-board’s number row. For example, pressing Win + 3 will noticeably ranked focus on the third Exwm work-related expanse.

Tab: you can in addition press Alt + X, then form “exwm-work-related expanse-switch” to access the switcher from the command buffer.

Sprinting and Taking care of Regiments in Exwm

Dissimilar a usual residence window boss, Exwm doesn’t come via a perpetrated app launcher. Instead, Exwm gains employ of a individualized shindig that implements the input from the Emacs command buffer on an isolated Linux rind session.

To launch a prospectus, press Transition + Win + 7, then lend the tag of the app that you want to run. For instance, typing “firefox” will noticeably responsive the browser as a structure within Exwm.

A screenshot reflecting Firefox sprinting within Exwm.

Tab: Exwm will noticeably “collar over” an current Emacs structure instead of accumulating a brand name-newfangled one.

To close a currently boisterous residence window, press Ctrl + K. Channeling out this will noticeably faultlessly kill the procedure however in addition vacate a need Emacs structure behind. You can press Ctrl + X, then 0 to buy rid of the structure as nicely.

Configuring and Matching Exwm

While the need Exwm install suffices for numerous earn employ of vessels, it’s you can perhaps picture to faultlessly revise the desktop computer according to your necessitates. In this void, we’ll go via some of the tweaks that you can lug out to Exwm.

One of the most convenient modifications that you can lug out is to modify the desktop computer’s default display resolution. To lug out that, responsive a incurable residence window by pressing Transition + Win + 7, then typing “gnome-incurable.”

Run xrandr on the incurable and collar chit of your display’s tool tag and the comfortably available resolutions for it. For instance, my display’s tag is “Digital-1” and I want to kit my desktop computer’s resolution to 1360×768.

A incurable accentuating the display tag and the list of comfortably available resolutions for the display.

Paste the ensuing command, then replace the “MONITOR” label via the tag of your display and “RESOLUTION” via your target display resolution.

xrandr --output MONITOR --mode RESOLUTION
A incurable reflecting the individualized Xrandr command.

Tab: you can earn earn this modify congruent across restarts by pasting the specific same command within your .xsession record.

Reload your current Exwm session by pressing Alt + X, then typing “exwm-restart.”

FYI: Dissect out our helpful overview on some of the faultless plugins for Hyprland today.

Devising Brand-newfangled Pivot-board Shortcuts in Exwm

Exwm doesn’t come via most keybindings by default. This is since the residence window boss trust funds both constructed-in Emacs secrets as nicely as its clients adding their individualized faster means.

To add your own keybinds, responsive your .emacs record, then scroll to the void that has “exwm-input-global-secrets.”

A screenshot reflecting the global keybind config shindig.

Go within the shindig and paste the ensuing pitch up of code:

([?SHORTCUT] . FUNCTION)

Readjust the “SHORTCUT” label via the pivot assimilation that you want. In my husk, I want to earn employ of Win + Q as a shortcut so I will noticeably add “s-q.”

A screenshot reflecting the individualized keybind via a pivot-board shortcut.

Tab: Exwm gains employ of c, s, and m to stand for Ctrl, Win, and Alt secrets specifically.

Readjust the “FUNCTION” label via the shindig that you want to compeer via the shortcut.

Install Emacs Exwm Desktop 14 Transaction Brand-newfangled Purpose Instance

Press Ctrl + X, then Ctrl + S to preserve your config, then restart your Exwm session.

Substantiate that it’s kneading accordingly by pressing your individualized pivot-board shortcut.

Incorporating Passthrough Primes

On optimal of adding individualized keybinds, it’s in addition you can perhaps picture to kit passthrough secrets in Exwm. These are faster means that doesn’t avail thieved on any X11 residence window, permitting you to access Emacs even while gleaning utility of a secure GUI prospectus.

To add passthrough secrets, responsive your .emacs record, then scroll down to the void on global Exwm keybinds.

Paste the ensuing block of code simply before the global Exwm faster means shindig. This will noticeably make it feasible for you earn employ of the need Ctrl + X, and Alt + X leader secrets as nicely as access the help shindig:

(setq exwm-input-prefix-keys  '(?C-x    ?C-u    ?C-h    ?M-x ))
A screenshot accentuating the passthrough secrets in Exwm.

Conserve your Emacs config record, then restart the desktop computer to use your brand name-newfangled settings.

A screenshot reflecting the Exwm passthrough secrets kneading.

Converting your Emacs consumer into a bona fide residence window boss via Exwm is simply a partiality of what you can lug out via this highly flexible message editor. Anxious on viewing added? Situate out why Emacs owns finished up being my favorite job and productivity app today.

Photograph debt: Mia Baker via Unsplash. All enhancements and screenshots by Ramces Red.

Related Posts