Helps you control your GNU/Linux computer from Emacs
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Damien Cassou 9798ef19d4 Merge branch 'typos' of DamienCassou/desktop-environment into master 2 months ago
.gitignore * .gitignore: add 11 months ago
.gitlab-ci.yml * .gitlab-ci.yml: Remove official support for Emacs 25.1 11 months ago
COPYING Initial version 1 year ago
Makefile * Makefile: Use makel 11 months ago Add 'light' as a replacement for brightnessctl 3 months ago
desktop-environment.el Fix typos 2 months ago



MELPA Stable


pipeline status



The package desktop-environment provides commands and a global minor mode to control your GNU/Linux desktop from Emacs.

With desktop-environment, you can control the brightness and volume as well as take screenshots and lock your screen. The package depends on the availability of shell commands to do the hard work for us. These commands can be changed by customizing the appropriate variables.

The global minor mode desktop-environment-mode binds standard keys to provided commands: e.g., <XF86AudioRaiseVolume> to raise the volume, <print> to take a screenshot, and <s-l> to lock the screen.


Add the following to your initialization file:

  (add-to-list 'load-path "~/.emacs.d/lib/desktop-environment/")
  (require 'desktop-environment)

If you want all commands to be bound to keys, add this line after the ones above:



The following table summarizes the available commands and their keybinding if desktop-environment-mode is enabled:

*Command* *Key binding*
desktop-environment-brightness-increment <XF86MonBrightnessUp>
desktop-environment-brightness-decrement <XF86MonBrightnessDown>
desktop-environment-brightness-increment-slowly S-<XF86MonBrightnessUp>
desktop-environment-brightness-decrement-slowly S-<XF86MonBrightnessDown>
desktop-environment-volume-increment <XF86AudioRaiseVolume>
desktop-environment-volume-decrement <XF86AudioLowerVolume>
desktop-environment-volume-increment-slowly S-<XF86AudioRaiseVolume>
desktop-environment-volume-decrement-slowly S-<XF86AudioLowerVolume>
desktop-environment-toggle-mute <XF86AudioMute>
desktop-environment-toggle-microphone-mute <XF86AudioMicMute>
desktop-environment-screenshot-part S-<print>
desktop-environment-screenshot <print>
desktop-environment-lock-screen s-l
desktop-environment-toggle-wifi <XF86WLAN>
desktop-environment-toggle-bluetooth <XF86Bluetooth>


Default configuration

To use all commands desktop-environment provides without customizing the package, the following system packages must be available on your system:

Configuring desktop-environment

The table below summarizes the available options. You can use M-x customize-group RET desktop-environment RET to change them.

*Option* *Description*
desktop-environment-keyboard-backlight-normal-increment Normal keyboard increment value
desktop-environment-keyboard-backlight-normal-decrement Normal keyboard decrement value
desktop-environment-brightness-normal-increment Normal brightness increment value
desktop-environment-brightness-normal-decrement Normal brightness decrement value
desktop-environment-brightness-small-increment Small brightness increment value
desktop-environment-brightness-small-decrement Small brightness decrement value
desktop-environment-brightness-get-command Shell command getting current screen brightness level
desktop-environment-brightness-get-regexp Regular expression matching brightness value
desktop-environment-brightness-set-command Shell command setting the brightness level
desktop-environment-volume-normal-increment Normal volume increment value
desktop-environment-volume-normal-decrement Normal volume decrement value
desktop-environment-volume-small-increment Small volume increment value
desktop-environment-volume-small-decrement Small volume decrement value
desktop-environment-volume-get-command Shell command getting current volume level
desktop-environment-volume-get-regexp Regular expression matching volume value
desktop-environment-volume-set-command Shell command setting the volume level
desktop-environment-volume-toggle-command Shell command toggling between muted and unmuted
desktop-environment-volume-toggle-microphone-command Shell command toggling microphone between muted and unmuted
desktop-environment-screenshot-command Shell command taking a screenshot in the current working directory
desktop-environment-screenshot-partial-command Shell command taking a partial screenshot in the current working directory
desktop-environment-screenshot-directory Directory where to save screenshots
desktop-environment-screenlock-command Shell command locking the screen
desktop-environment-wifi-command Shell command toggling wifi
desktop-environment-bluetooth-command Shell command toggling bluetooth

Using light instead of brightnessctl

You might prefer to use light instead of brightnessctl. This can be done by adding the following to your configuration file:

(setq desktop-environment-brightness-get-command "light") (setq desktop-environment-brightness-set-command "light %s") (setq desktop-environment-brightness-get-regexp "^\\([0-9]+\\)") (setq desktop-environment-brightness-normal-increment "-A 10") (setq desktop-environment-brightness-normal-decrement "-U 10") (setq desktop-environment-brightness-small-increment "-A 5") (setq desktop-environment-brightness-small-decrement "-U 5")


See COPYING. Copyright (c) 2018 Damien Cassou.

#+BEGIN_HTML Donate using Liberapay #+END_HTML