You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Raised by `set_brightness` and `get_brightness` when the brightness cannot be set or retrieved
47
-
Used as a unifying class for the multiple error types to make it easier to handle exceptions
46
+
47
+
There is full documentation for this project hosted [here](https://crozzers.github.io/screen_brightness_control) but here are the basics
48
+
49
+
### ScreenBrightnessError(`Exception`)
50
+
A generic error class designed to make catching errors under one umbrella easy. Raised when the brightness cannot be set/retrieved.
48
51
49
52
**Usage:**
50
53
```python
@@ -61,7 +64,8 @@ except sbc.ScreenBrightnessError as error:
61
64
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.
62
65
Raises `ScreenBrightnessError` upon failure
63
66
64
-
**Arguments:**
67
+
**Arguments:**
68
+
65
69
*`verbose_error` - a boolean value to control how much detail any error messages should contain
66
70
*`kwargs` - passed to the OS relevant brightness method
Sets the brightness to `value`. If `value` is a string and contains "+" or "-" then that value is added to/subtracted from the current brightness.
84
88
Raises `ScreenBrightnessError` upon failure
85
89
86
-
**Arguments:**
90
+
**Arguments:**
91
+
87
92
*`value` - the level to set the brightness to. Can either be an integer or a string.
88
93
*`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
89
94
*`verbose_error` - a boolean value to control how much detail any error messages should contain
Fades the brightness from `start` to `finish` in steps of `increment`, pausing for `interval` seconds between each step.
116
121
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
117
122
118
-
**Arguments:**
123
+
**Arguments:**
124
+
119
125
*`finish` - The brightness value to fade to
120
126
*`start` - The value to start from. If not specified it defaults to the current brightness
121
127
*`interval` - The time interval between each step in brightness
@@ -157,34 +163,42 @@ If you have any suggestions feel free to raise an [issue](https://github.com/Cro
157
163
[pull request](https://github.com/Crozzers/screen_brightness_control/pulls) or to [ping me an email](mailto:[email protected])
158
164
159
165
### Why do I always get `ScreenBrightnessError` on Linux?
160
-
**Why this happens:**
166
+
**Why this happens:**
161
167
The way brightness is adjusted on Linux is the program tries to run shell commands to adjust the brightness.
162
168
The programs it attempts to call are "light", "xrandr" and "xbacklight".
163
169
If none of these programs can be called a `ScreenBrightnessError` is raised
164
-
**How to fix it:**
170
+
171
+
**How to fix it:**
165
172
Install light (recommended), xrandr or xbacklight using your system package manager:
173
+
166
174
* Arch: `sudo pacman -S light-git` or `sudo pacman -S xorg-xrandr` or `sudo pacman -S xorg-xbacklight`
167
175
* Debian/Ubuntu: [Light install instructions](https://github.com/haikarainen/light) or `sudo apt install x11-server-utils` or `sudo apt install xbacklight`
168
176
* Fedora: `sudo dnf install light` or `sudo dnf install libXrandr` or `sudo dnf install xbacklight`
169
177
178
+
170
179
### I call `set_brightness()` and nothing happens on Linux
171
-
**Why this happens:**
180
+
**Why this happens:**
172
181
Light requires root access to run, which is usually provided when you manually install it using you package manager.
173
182
If you installed xbacklight or xrandr, it only supports Intel (and sometimes NVidia) graphics, not AMD.
174
-
**How to fix it:**
183
+
184
+
**How to fix it:**
175
185
Install Light by following [these steps](https://github.com/haikarainen/light#installation). Make sure to run the install as sudo
176
186
187
+
177
188
### Using the `display` kwarg does nothing/creates exceptions on Linux
178
-
**Why this happens:**
189
+
**Why this happens:**
179
190
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
180
-
**How to fix it:**
191
+
192
+
**How to fix it:**
181
193
Install light (recommended) or xrandr using your system package manager:
### The model of my monitor/display is not what the program says it is (Windows)
187
-
**Why this happens:**
201
+
**Why this happens:**
188
202
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.
189
203
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
190
204
anywhere between 1 and 2 seconds to run, which is why it doesn't automatically.
0 commit comments