2018-09-14 03:53:46 +02:00
---
layout: page
---
# Brightness widget
2022-01-24 01:17:02 +01:00
This widget represents current brightness level, depending on config parameters could be an arcchart or icon with text: ![Brightness widget ](./br-wid-1.png )
2019-12-15 21:38:54 +01:00
## Customization
It is possible to customize widget by providing a table with all or some of the following config parameters:
| Name | Default | Description |
|---|---|---|
2021-01-24 20:46:54 +01:00
| `type` | `arc` | The widget type. Could be `arc` or `icon_and_text` |
2022-01-24 01:17:02 +01:00
| `program` | `light` | The program used to control the brightness, either `light` , `xbacklight` , or `brightnessctl` . |
2021-01-24 20:46:54 +01:00
| `step` | 5 | Step |
2022-01-24 01:17:02 +01:00
| `base` | 20 | Base level to set brightness to on left click. |
2019-12-15 21:38:54 +01:00
| `path_to_icon` | `/usr/share/icons/Arc/status/symbolic/display-brightness-symbolic.svg` | Path to the icon |
| `font` | `Play 9` | Font |
2021-01-24 20:46:54 +01:00
| `timeout` | 1 | How often in seconds the widget refreshes. Check the note below |
2022-01-24 01:17:02 +01:00
| `tooltip` | false | Display brightness level in a tooltip when the mouse cursor hovers the widget |
2019-12-15 21:38:54 +01:00
2021-01-24 20:46:54 +01:00
_Note:_ If brightness is controlled only by the widget (either by a mouse, or by a shortcut, then the `timeout` could be quite big, as there is no reason to synchronize the brightness level).
2018-09-14 03:53:46 +02:00
## Installation
2021-01-24 20:46:54 +01:00
To choose the right `program` argument, first you need to check which of them works better for you.
2018-09-14 03:53:46 +02:00
2021-01-24 20:46:54 +01:00
- using `xbacklight` :
2018-09-14 03:53:46 +02:00
2021-01-24 20:46:54 +01:00
Install (on Ubuntu it's available in the apt repository) it and check if it works by running:
2018-09-14 03:53:46 +02:00
```bash
2018-09-15 23:33:42 +02:00
xbacklight -get
2018-09-14 03:53:46 +02:00
```
2021-01-24 20:46:54 +01:00
If there is no output it means that it doesn't work, you can either try to fix it, or try to use `light` .
2018-09-14 03:53:46 +02:00
2022-01-24 01:17:02 +01:00
- using `light` command:
2018-09-14 03:53:46 +02:00
2021-01-24 20:46:54 +01:00
Install (on Ubuntu it's available in the apt repository) from the repo: [github.com/haikarainen/light ](https://github.com/haikarainen/light ) and check if it works by running
2018-09-14 03:53:46 +02:00
```bash
light -G
49.18
2021-01-24 20:46:54 +01:00
light -A 5
2018-09-14 03:53:46 +02:00
```
2021-01-24 20:46:54 +01:00
If you're on Ubuntu/debian and if the brightness level doesn't change, try to do this: https://github.com/haikarainen/light/issues/113#issuecomment-632638436.
2018-09-25 01:18:45 +02:00
2022-01-24 01:17:02 +01:00
- using `brightnessctl` :
On Ubuntu it is available in the apt repository. Install and check the ouptut of the following command.
```bash
brightnessctl --list
```
2018-09-25 01:18:45 +02:00
Then clone this repo under ** ~/.config/awesome/**:
```bash
2020-05-01 02:58:02 +02:00
git clone https://github.com/streetturtle/awesome-wm-widgets.git ~/.config/awesome/awesome-wm-widgets
2018-09-25 01:18:45 +02:00
```
2018-11-02 21:14:10 +01:00
Require widget at the beginning of **rc.lua** :
2018-09-25 01:18:45 +02:00
```lua
local brightness_widget = require("awesome-wm-widgets.brightness-widget.brightness")
```
2021-01-24 20:46:54 +01:00
Add the widget to the tasklist:
2018-09-25 01:18:45 +02:00
```lua
s.mytasklist, -- Middle widget
{ -- Right widgets
layout = wibox.layout.fixed.horizontal,
...
2019-12-15 21:38:54 +01:00
-- default
brightness_widget(),
-- or customized
2021-01-24 20:46:54 +01:00
brightness_widget{
type = 'icon_and_text',
program = 'xbacklight',
step = 2,
}
2019-12-15 21:38:54 +01:00
}
2021-01-24 20:46:54 +01:00
...
2018-09-25 01:18:45 +02:00
```
2018-09-15 23:33:42 +02:00
## Controls
2018-09-14 03:53:46 +02:00
In order to change brightness by shortcuts you can add them to the `globalkeys` table in the **rc.lua** :
```lua
2021-01-24 20:46:54 +01:00
awful.key({ modkey }, ";", function () brightness_widget:inc() end, {description = "increase brightness", group = "custom"}),
awful.key({ modkey, "Shift"}, ";", function () brightness_widget:dec() end, {description = "decrease brightness", group = "custom"}),
2018-09-14 03:53:46 +02:00
```
2021-01-24 20:46:54 +01:00
On a laptop you can use `XF86MonBrightnessUp` and `XF86MonBrightnessDown` keys.