xmonad-extras-0.15.2: Third party extensions for xmonad with wacky dependencies

License | MIT
Stability | unstable
Portability | unportable
Safe Haskell | None
Language | Haskell98

XMonad.Util.Brightness

Description

Module to control the brightness of the screen in linux environments

`Requirements`
  This module assumes that the following files exists:
  - /sys/class/backlight/intel_backlight/max_brightness
  - /sys/class/backlight/intel_backlight/brightness

  Also, brightness should be updatable by changing the content of /sys/class/backlight/intel_backlight/brightness.

`Permissions`
  To use this module, the owner of the xmonad process will need to have permission to write to /sys/class/backlight/intel_backlight/brightness. To achieve this, you can:

  - Create a group with your user and root and give permissions to this group to write to the file. I usually follow these steps:

    - Create a group named xmonad

        $ sudo groupadd xmonad

    - Add user root and your user name to the group xmonad.

        $ sudo usermod -a -G xmonad root
        $ sudo usermod -a -G xmonad sibi

    - The files under /sys are virtual. It's a RAM based filesystem through which you can access kernel data structures. The permission you give there won't persist after reboot. One of the way for persisting is creating a systemd script:

        $ cat /etc/systemd/system/brightness.service
        [Unit]
        Description=Set brightness writable to everybody
        Before=nodered.service

        [Service]
        Type=oneshot
        User=root
        ExecStart=/bin/bash -c "chgrp -R -H xmonad /sys/class/backlight/intel_backlight && chmod g+w /sys/class/backlight/intel_backlight/brightness"

        [Install]
        WantedBy=multi-user.target

        $ sudo systemctl enable brightness.service
        $ sudo systemctl start brightness.service
        $ sudo systemctl status brightness.service

- Allow anyone to write the file through 646 permissions: -rw-r--rw-;

Synopsis

- increase :: X ()
- decrease :: X ()
- change :: (Int -> Int) -> IO (Either () ())
- setBrightness :: Int -> X ()

# Documentation

increase :: X () Source #

Update brightness by +100

decrease :: X () Source #

Update brightness by -100

change :: (Int -> Int) -> IO (Either () ()) Source #

Perform all needed IO to update screen brightness

setBrightness :: Int -> X () Source #

Change brightness to a particular level

Since: 0.13.4