Skip to content

Commit

Permalink
Mark linux.Light as deprecated.
Browse files Browse the repository at this point in the history
Light has been unmaintained for a while (since Apr 2023 at least) and the repo was recently deleted.
There have been attempts from package maintainers to fork the project and maintain a build, but there's no indication yet
of a new maintainer.

I've marked this as deprecated but without a planned removal date/version since the dust is still settling. I'll add
a removal date if it becomes clear that no maintainer will step forwards.

New code should use `linux.SysFiles` instead
  • Loading branch information
Crozzers committed Mar 13, 2024
1 parent 4aa12f2 commit 2e86484
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 11 deletions.
14 changes: 7 additions & 7 deletions docs/source/extras/Installing On Linux.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,19 @@
Here is an outline of all of the external programs that `screen_brightness_control` can call upon:
Program | Works on laptop displays | Works on external monitors | Per-display brightness control | Requires Special Permissions After Install
--------------|--------------------------|----------------------------|---------------------------------------|-------------------------------------------------------------
ddcutil | No | Yes (slowest) [1] | Yes | Read/write access for `/dev/i2c*` [2]
xrandr | Yes | Yes [3] | Yes | No
light | Yes | No | Yes | User must be in the `video` group [3]
[No program] | Yes | Yes (slow) | Yes | Read/write access for `/dev/i2c*` and `/sys/class/backlight`
--------------|--------------------------|----------------------------|---------------------------------------|-------------------------------------------------------------------
ddcutil | No | Yes (slowest) [1] | Yes | Read/write access for `/dev/i2c*` (see [above](#desktop-displays))
xrandr [2] | Yes | Yes | Yes | No
light [3] | Yes | No | Yes | User must be in the `video` group [4]
[No program] | Yes | Yes (slow) | Yes | See [above](#without-using-a-3rd-party-program)
#### Footnotes
[1] While both DDCUtil and the 1st party `linux.I2C` class do similar things over the same interface (I2C),
DDCUtil also supports communicating with monitors that implement the [Monitor Control Command Set over USB](https://www.ddcutil.com/usb)
[2] Read/write access for the `i2c` bus can be granted via the steps outlined in the [Desktop displays](#desktop-displays) section or by running the script using `sudo`.
[2] Xrandr has two key limitations. It doesn't support Wayland and it doesn't actually change the backlight of the display, it just changes the brightness by applying a filter to the pixels to make them look dimmer/brighter.
[3] Xrandr does not actually change the backlight of the display, it just changes the brightness by applying a filter to the pixels to make them look dimmer/brighter.
[3] This method is deprecated as the original Light project was archived in April 2023 and the repository has since been deleted. Unofficial packages are still available for some distros.
[4] You can add yourself to the video user group by running `sudo usermod -a -G video [your username]` and then logging out and back in again for the changes to take effect.
Expand Down
30 changes: 26 additions & 4 deletions screen_brightness_control/linux.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import operator
import os
import re
import warnings
import time
from typing import List, Optional, Tuple

Expand Down Expand Up @@ -439,10 +440,9 @@ class Light(BrightnessMethod):
3rd party tool that can control brightness levels for e-DP displays.
.. warning::
As of April 2nd 2023, the official repository for the light project has
[been archived](https://github.com/haikarainen/light/issues/147) and
will no longer receive any updates unless another maintainer picks it
up.
The official repository was archived in April 2023 and has since been deleted.
Due to [having no maintainer](https://github.com/haikarainen/light/issues/147)
or official packages, this feature has been marked as deprecated.
'''

executable: str = 'light'
Expand All @@ -456,6 +456,14 @@ def get_display_info(cls, display: Optional[DisplayIdentifier] = None) -> List[d
Works by taking the output of `SysFiles.get_display_info` and
filtering out any displays that aren't supported by Light
'''
warnings.warn(
(
'Light is unmaintained and has been deprecated.'
' Please use `SysFiles` instead'
),
DeprecationWarning
)

light_output = check_output([cls.executable, '-L']).decode()
displays = []
index = 0
Expand All @@ -479,6 +487,13 @@ def get_display_info(cls, display: Optional[DisplayIdentifier] = None) -> List[d

@classmethod
def set_brightness(cls, value: IntPercentage, display: Optional[int] = None):
warnings.warn(
(
'Light is unmaintained and has been deprecated.'
' Please use `SysFiles` instead'
),
DeprecationWarning
)
info = cls.get_display_info()
if display is not None:
info = [info[display]]
Expand All @@ -489,6 +504,13 @@ def set_brightness(cls, value: IntPercentage, display: Optional[int] = None):

@classmethod
def get_brightness(cls, display: Optional[int] = None) -> List[IntPercentage]:
warnings.warn(
(
'Light is unmaintained and has been deprecated.'
' Please use `SysFiles` instead'
),
DeprecationWarning
)
info = cls.get_display_info()
if display is not None:
info = [info[display]]
Expand Down

0 comments on commit 2e86484

Please sign in to comment.