{"id":13622207,"url":"https://github.com/linusg/rpi-backlight","last_synced_at":"2025-04-14T23:30:22.155Z","repository":{"id":44102680,"uuid":"69806405","full_name":"linusg/rpi-backlight","owner":"linusg","description":"🔆 A Python module for controlling power and brightness of the official Raspberry Pi 7\" touch display","archived":false,"fork":false,"pushed_at":"2024-12-03T23:40:16.000Z","size":2765,"stargazers_count":280,"open_issues_count":5,"forks_count":33,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-04-07T18:06:57.224Z","etag":null,"topics":["backlight","brightness","cli","display","gui","library","linux","python","python3","raspberry-pi","raspbian","rpi-backlight","touch-display"],"latest_commit_sha":null,"homepage":"https://rpi-backlight.readthedocs.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/linusg.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.rst","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"linusg","liberapay":"linusg"}},"created_at":"2016-10-02T15:56:46.000Z","updated_at":"2025-03-15T08:43:16.000Z","dependencies_parsed_at":"2024-06-12T07:23:14.323Z","dependency_job_id":"92ffc0bd-a01d-4ade-a96f-14b165fa1d05","html_url":"https://github.com/linusg/rpi-backlight","commit_stats":{"total_commits":230,"total_committers":8,"mean_commits":28.75,"dds":0.4347826086956522,"last_synced_commit":"b90d8424019f7bd59f10bd2177a35511a6fe4fc4"},"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linusg%2Frpi-backlight","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linusg%2Frpi-backlight/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linusg%2Frpi-backlight/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linusg%2Frpi-backlight/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/linusg","download_url":"https://codeload.github.com/linusg/rpi-backlight/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248978189,"owners_count":21192731,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["backlight","brightness","cli","display","gui","library","linux","python","python3","raspberry-pi","raspbian","rpi-backlight","touch-display"],"created_at":"2024-08-01T21:01:15.791Z","updated_at":"2025-04-14T23:30:22.097Z","avatar_url":"https://github.com/linusg.png","language":"Python","funding_links":["https://github.com/sponsors/linusg","https://liberapay.com/linusg"],"categories":["Python"],"sub_categories":[],"readme":"# rpi-backlight\n\n\u003e A Python module for controlling power and brightness of the official Raspberry Pi 7\" touch display.\n\n[![PyPI](https://img.shields.io/pypi/v/rpi-backlight)](https://pypi.org/project/rpi-backlight/)\n![Python Version](https://img.shields.io/pypi/pyversions/rpi-backlight)\n[![Downloads](https://pepy.tech/badge/rpi-backlight)](https://pepy.tech/project/rpi-backlight)\n[![Documentation](https://img.shields.io/badge/docs-latest-blue)](https://rpi-backlight.readthedocs.io/en/latest/)\n[![License](https://img.shields.io/github/license/linusg/rpi-backlight?color=d63e97)](https://github.com/linusg/rpi-backlight/blob/main/LICENSE)\n[![Black](https://img.shields.io/badge/code%20style-black-000000)](https://github.com/ambv/black)\n[![Build](https://github.com/linusg/rpi-backlight/workflows/Build/badge.svg)](https://github.com/linusg/rpi-backlight/actions?query=workflow%3ABuild)\n[![Read the Docs](https://img.shields.io/readthedocs/rpi-backlight)](https://rpi-backlight.readthedocs.io/en/latest/)\n[![Issues](https://img.shields.io/github/issues/linusg/rpi-backlight)](https://github.com/linusg/rpi-backlight/issues)\n\n![Example](https://raw.githubusercontent.com/linusg/rpi-backlight/main/docs/_static/example.gif)\n\n**Note:** _This GIF was created using the old v1 API, so please don't use it as API reference 🙂_\n\n## Features\n\n- Set the display brightness **smoothly** or **abrupt**\n- Set the display power on or off\n- Get the current brightness\n- Get the display power state (on/off)\n- Command line interface\n- Graphical user interface\n\n## Requirements\n\n- A **Raspberry Pi or ASUS Tinker Board** including a correctly assembled **7\" touch display v1.1 or higher**\n  (look on the display's circuit board to see its version), or a [**Surface RT**](https://openrt.gitbook.io/open-surfacert/surface-rt/linux/root-filesystem/distros/raspberry-pi-os) or an [**ARM Chromebook**](https://askubuntu.com/q/1506894) running a Linux-based OS\n- Python 3.7+\n- Optional: Raspberry Pi: ``pygobject`` for the GUI, already installed on a recent Raspbian\n- Optional: Tinker Board: ``gir1.2-gtk-3.0`` for the GUI install\n\n## Installation\n\nInstall from PyPI:\n\n```console\n$ pip3 install rpi-backlight\n```\n\n**Note:** Create this udev rule to update permissions, otherwise you'll have to run\nPython code, the GUI and CLI as root when _changing_ the power or brightness:\n\n```console\n$ echo 'SUBSYSTEM==\"backlight\",RUN+=\"/bin/chmod 666 /sys/class/backlight/%k/brightness /sys/class/backlight/%k/bl_power\"' | sudo tee -a /etc/udev/rules.d/backlight-permissions.rules\n```\n\n### Emulator\n\nFor testing without a physical display (e.g. on your main Linux/macOS/Windows machine)\nyou can use [`linusg/rpi-backlight-emulator`](https://github.com/linusg/rpi-backlight-emulator).\n\n## Usage\n\n### API\n\nExample in a Python shell:\n\n```python\n\u003e\u003e\u003e from rpi_backlight import Backlight\n\u003e\u003e\u003e\n\u003e\u003e\u003e backlight = Backlight()\n\u003e\u003e\u003e backlight.brightness\n100\n\u003e\u003e\u003e backlight.brightness = 50\n\u003e\u003e\u003e backlight.brightness\n50\n\u003e\u003e\u003e\n\u003e\u003e\u003e with backlight.fade(duration=1):\n...     backlight.brightness = 0\n...\n\u003e\u003e\u003e backlight.fade_duration = 0.5\n\u003e\u003e\u003e # subsequent `backlight.brightness = x` will fade 500ms\n\u003e\u003e\u003e\n\u003e\u003e\u003e backlight.power\nTrue\n\u003e\u003e\u003e backlight.power = False\n\u003e\u003e\u003e backlight.power\nFalse\n\u003e\u003e\u003e\n```\n\nFor more details see [docs](https://rpi-backlight.readthedocs.io/en/latest/api.html).\n\n### CLI\n\nOpen a terminal and run `rpi-backlight`.\n\n```console\n$ rpi-backlight -b 100\n$ rpi-backlight --set-brightness 20 --duration 1.5\n$ rpi-backlight --get-brightness\n20\n$ rpi-backlight --get-power\non\n$ rpi-backlight -p off\n$ rpi-backlight --get-power\noff\n$ rpi-backlight --set-power off :emulator:\n$ rpi-backlight -p toggle\n$ rpi-backlight -p toggle -d 1.5\n$\n```\n\nFor all available options see [docs](https://rpi-backlight.readthedocs.io/en/latest/usage.html#command-line-interface).\n\n### GUI\n\nOpen a terminal and run `rpi-backlight-gui`.\n\n![Graphical User Interface](https://raw.githubusercontent.com/linusg/rpi-backlight/main/docs/_static/gui.png)\n![Graphical User Interface (2)](https://raw.githubusercontent.com/linusg/rpi-backlight/main/docs/_static/gui2.png)\n\n### Adding a shortcut to the LXDE panel\n\n![Panel result](https://raw.githubusercontent.com/linusg/rpi-backlight/main/docs/_static/panel_result.png)\n\nSee [docs](https://rpi-backlight.readthedocs.io/en/latest/usage.html#adding-a-shortcut-to-the-lxde-panel).\n\n## Tests\n\nTests use `pytest`, install with `pip3 install pytest`.\n\nNow, run from the repository root directory:\n\n```console\n$ python3 -m pytest\n```\n\n## Contributing\n\nPlease free to open an issue for bug reports and to discuss new features - pull requests for new features or bug fixes are welcome as well!\n\n## License\n\nThe source code and all other files in this repository are licensed under the MIT\nlicense, so you can easily use it in your own projects. See [`LICENSE`](LICENSE) for\nmore information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinusg%2Frpi-backlight","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flinusg%2Frpi-backlight","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinusg%2Frpi-backlight/lists"}