Skip to content

Commit 1be37e5

Browse files
committed
Altered README to make it more readable
1 parent 1e3401e commit 1be37e5

File tree

1 file changed

+40
-30
lines changed

1 file changed

+40
-30
lines changed

README.md

Lines changed: 40 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# screen_brightness_control
22
A Python tool for controlling the brightness of your monitor. Supports Windows and most flavours of Linux.
33

4-
## Installation
4+
# Installation
55
#### Pip:
66
* Open a terminal and run `pip3 install screen-brightness-control`
77

@@ -17,7 +17,7 @@ For running on Linux you will need to install one of these programs: [light](htt
1717
* Fedora: `sudo dnf install light` or `sudo dnf install libXrandr` or `sudo dnf install xbacklight`
1818

1919

20-
## Usage
20+
# Usage
2121
You can call this module from your command line or use it as a python library (see the documentation section below).
2222
```
2323
python -m screen_brightness_control --help
@@ -40,12 +40,13 @@ python -m screen_brightness_control -g
4040
python -m screen_brightness_control -s 50
4141
```
4242

43-
## Documentation
43+
# Documentation
4444
### ScreenBrightnessError(`Exception`)
45-
###### Summary:
45+
**Summary:**
4646
Raised by `set_brightness` and `get_brightness` when the brightness cannot be set or retrieved
4747
Used as a unifying class for the multiple error types to make it easier to handle exceptions
48-
###### Usage:
48+
49+
**Usage:**
4950
```python
5051
import screen_brightness_control as sbc
5152

@@ -56,13 +57,15 @@ except sbc.ScreenBrightnessError as error:
5657
```
5758

5859
### get_brightness(`verbose_error=False, **kwargs`)
59-
###### Summary:
60+
**Summary:**
6061
Returns the current screen brightness as a percentage by default. If you're on Windows it may return a list of values if you have multiple, brightness adjustable monitors.
6162
Raises `ScreenBrightnessError` upon failure
62-
###### Arguments:
63+
64+
**Arguments:**
6365
* `verbose_error` - a boolean value to control how much detail any error messages should contain
6466
* `kwargs` - passed to the OS relevant brightness method
65-
###### Usage:
67+
68+
**Usage:**
6669
```python
6770
import screen_brightness_control as sbc
6871

@@ -74,16 +77,19 @@ primary_display_brightness = sbc.get_brightness(display=0)
7477
secondary_display_brightness = sbc.get_brightness(display=1)
7578
```
7679

80+
7781
### set_brightness(`value, force=False, verbose_error=False, **kwargs`)
78-
###### Summary:
82+
**Summary:**
7983
Sets the brightness to `value`. If `value` is a string and contains "+" or "-" then that value is added to/subtracted from the current brightness.
8084
Raises `ScreenBrightnessError` upon failure
81-
###### Arguments:
85+
86+
**Arguments:**
8287
* `value` - the level to set the brightness to. Can either be an integer or a string.
8388
* `force` (Linux only) - if set to `False` then the brightness is never set to less than 1 because on Linux this often turns the screen off. If set to `True` then it will bypass this check
8489
* `verbose_error` - a boolean value to control how much detail any error messages should contain
8590
* `kwargs` - passed to the OS relevant brightness method
86-
###### Usage:
91+
92+
**Usage:**
8793
```python
8894
import screen_brightness_control as sbc
8995

@@ -103,18 +109,21 @@ sbc.set_brightness('-30')
103109
sbc.set_brightness(50, display=0)
104110
```
105111

112+
106113
### fade_brightness(`finish, start=None, interval=0.01, increment=1, blocking=True, **kwargs`)
107-
###### Summary:
114+
**Summary:**
108115
Fades the brightness from `start` to `finish` in steps of `increment`, pausing for `interval` seconds between each step.
109116
If it runs in the main thread it will return the final brightness upon success, `ScreenBrightnessError` upon failure. Otherwise it returns the list of thread objects that the process is running in
110-
###### Arguments:
117+
118+
**Arguments:**
111119
* `finish` - The brightness value to fade to
112120
* `start` - The value to start from. If not specified it defaults to the current brightness
113121
* `interval` - The time interval between each step in brightness
114122
* `increment` - The amount to change the brightness by each step in percent.
115123
* `blocking` - If set to `False` it fades the brightness in a new thread
116124
* `kwargs` - passed to `set_brightness`
117-
###### Usage:
125+
126+
**Usage:**
118127
```python
119128
import screen_brightness_control as sbc
120129

@@ -134,47 +143,48 @@ sbc.fade_brightness(90, start=100, interval=0.1)
134143
sbc.fade_brightness(100, blocking=False)
135144
```
136145

146+
137147
## A Toast
138-
To GitHub user `lcharles` for contributing to this project
148+
To GitHub user [lcharles](https://github.com/lcharles) for contributing to this project
139149

140150
## License
141151
This software is licensed under the [MIT license](https://mit-license.org/)
142152

143-
## FAQ
144-
#### Why is there no support for DDC/CI commands on Linux?
153+
# FAQ
154+
### Why is there no support for DDC/CI commands on Linux?
145155
I'm working on it, however, I am struggling to find a way to implement it without root being required every time the program is called.
146156
If you have any suggestions feel free to raise an [issue](https://github.com/Crozzers/screen_brightness_control/issues),
147157
[pull request](https://github.com/Crozzers/screen_brightness_control/pulls) or to [ping me an email](mailto:[email protected])
148158

149-
#### Why do I always get `ScreenBrightnessError` on Linux?
150-
###### Why this happens:
159+
### Why do I always get `ScreenBrightnessError` on Linux?
160+
**Why this happens:**
151161
The way brightness is adjusted on Linux is the program tries to run shell commands to adjust the brightness.
152162
The programs it attempts to call are "light", "xrandr" and "xbacklight".
153163
If none of these programs can be called a `ScreenBrightnessError` is raised
154-
###### How to fix it:
164+
**How to fix it:**
155165
Install light (recommended), xrandr or xbacklight using your system package manager:
156166
* Arch: `sudo pacman -S light-git` or `sudo pacman -S xorg-xrandr` or `sudo pacman -S xorg-xbacklight`
157167
* Debian/Ubuntu: [Light install instructions](https://github.com/haikarainen/light) or `sudo apt install x11-server-utils` or `sudo apt install xbacklight`
158168
* Fedora: `sudo dnf install light` or `sudo dnf install libXrandr` or `sudo dnf install xbacklight`
159169

160-
#### I call `set_brightness()` and nothing happens on Linux
161-
###### Why this happens:
170+
### I call `set_brightness()` and nothing happens on Linux
171+
**Why this happens:**
162172
Light requires root access to run, which is usually provided when you manually install it using you package manager.
163173
If you installed xbacklight or xrandr, it only supports Intel (and sometimes NVidia) graphics, not AMD.
164-
###### How to fix it:
174+
**How to fix it:**
165175
Install Light by following [these steps](https://github.com/haikarainen/light#installation). Make sure to run the install as sudo
166176

167-
#### Using the `display` kwarg does nothing/creates exceptions on Linux
168-
###### Why this happens:
177+
### Using the `display` kwarg does nothing/creates exceptions on Linux
178+
**Why this happens:**
169179
The `display` kwarg is only supported by the `Light` and `XRandr` classes, not by `XBacklight`. So if you only have `xbacklight` installed on your system this kwarg will not work
170-
###### How to fix it:
180+
**How to fix it:**
171181
Install light (recommended) or xrandr using your system package manager:
172182
* Arch: `sudo pacman -S light-git` or `sudo pacman -S xorg-xrandr`
173183
* Debian/Ubuntu: [Light install instructions](https://github.com/haikarainen/light) or `sudo apt install x11-server-utils`
174184
* Fedora: `sudo dnf install light` or `sudo dnf install libXrandr`
175185

176-
#### The model of my monitor/display is not what the program says it is (Windows)
177-
###### Why this happens:
186+
### The model of my monitor/display is not what the program says it is (Windows)
187+
**Why this happens:**
178188
If your display is a laptop screen and can be adjusted via a Windows brightness slider then there is no easy way to get the monitor model that I am aware of.
179189
If your display is a desktop monitor with a Virtual Control Panel (VCP) then there is a way to get the actual model, but the function call takes
180190
anywhere between 1 and 2 seconds to run, which is why it doesn't automatically.
@@ -188,7 +198,7 @@ print(monitor.model_name)
188198
> 'GL2450HM'
189199
```
190200

191-
#### When I call `get_brightness()` the returned value isn't what I set it to (Windows)
201+
### When I call `get_brightness()` the returned value isn't what I set it to (Windows)
192202
Not all monitors can set the brightness for every value between 0 and 100. Most of them have a number of 'levels' that they can set them to.
193203
You can likely see this if you open your display settings and very slowly move the brightness slider.
194204
You can find out your brightness 'levels' by running the following python code:
@@ -201,7 +211,7 @@ print(monitor.Levels)
201211
print(monitor.Level)
202212
```
203213

204-
## Things to note:
214+
# Things to note:
205215
* If you encounter any issues or bugs with this software please do not hesitate to [raise an issue](https://github.com/Crozzers/screen_brightness_control/issues) or to email me [[email protected]](mailto:[email protected])
206216
* It is unlikely that this project will support MAC in the forseeable future for 3 reasons.
207217
1. I do not own a (working) MAC.

0 commit comments

Comments
 (0)