XMonad plugin for brightness control (linux). Got the idea from xmonad-vanessa.
Note: This plugin was merged in xmonad-extras, no further development will be made in this repository.
Copy src/XMonad/Util/Brightness.hs to ~/.xmonad/lib/XMonad/Util/Brightness.hs.
This package exports three functions: increase, decrease and change.
increase: Callchangeto update the brightness by +150;decrease: Callchangeto update the brightness by -150;change: Receive a(Int -> Int)function and perform the neededIOto change brightness;
Note that change will return IO(). If you want to call it directly, be sure to return X() if whitin XMonad.
Inside ~/.xmonad/xmonad.hs (Manual keybindings):
import qualified Data.Map as M
import qualified Graphics.X11.ExtraTypes.XF86 as XF86
(...)
import qualified XMonad.Util.Brightness as Bright
(...)
myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $
(...)
++
[ ((0, XF86.xF86XK_MonBrightnessUp), Bright.increase) -- Increase screen brightness
, ((0, XF86.xF86XK_MonBrightnessDown), Bright.decrease)] -- Decrease screen brightnessIn a normal linux environment, the file /sys/class/backlight/intel_backlight/brightness will only be writable by root.
To allow your user to write this file, you can:
- Recomended: Create a group with your user and
rootand give permissions to this group to write the file; - Small Security risk: Allow anyone to write the file through
646permissions:-rw-r--rw-;