Inspired by LG Companion for Windows (https://github.com/JPersson77/LGTVCompanion), LG Buddy is a set of scripts and service using https://github.com/chros73/bscpylgtv to turn LG WebOS TV's on and off automatically on startup, shutdown (but not reboot), sleep, and wake in Linux.
- Startup/Shutdown: Automatically turn TV on at boot and off at shutdown
- Sleep/Wake: Turn TV off on suspend, back on at wake
- Screen Idle/Resume: Blank the TV panel when your GNOME or wlroots-based Wayland session goes idle, unblank it when you return
- Brightness Control: Interactive slider to adjust OLED pixel brightness (via
zenity) - Interactive Setup:
configure.shprompts for TV and screen settings and writes them to your home directory
You will need the following packages installed:
python3,python3-venv,python3-pip— for bscpylgtvwakeonlan(orwol) — to wake TV from standbygdbus— for GNOME screen idle detection (usually installed with GNOME/GLib)swayidle— for wlroots/COSMIC screen idle detection (optional)zenity— for OLED Pixel Brightness Control (optional)
Debian/Ubuntu/Pop!_OS:
sudo apt install python3-venv python3-pip wakeonlan zenityFedora:
sudo dnf install python3 python3-pip wol zenityArch:
sudo pacman -S python python-pip wakeonlan zenityIf gdbus is missing on GNOME, install your distro's GLib utilities package (libglib2.0-bin on Debian/Ubuntu, glib2 on Fedora/Arch).
Note: The screen monitor now supports multiple backends. On GNOME it uses
org.gnome.ScreenSaverplusorg.gnome.Mutter.IdleMonitorover D-Bus. On wlroots/COSMIC desktops it usesswayidle.
-
Clone or download the latest release of LG Buddy.
-
Make
install.shexecutable and run it:
chmod +x ./install.sh
./install.sh-
The installer will:
- Install prerequisites (
python3-venv,wakeonlanorwol) - Run
configure.shto create~/.config/lg-buddy/config.env - Create the Python virtual environment and install bscpylgtv
- Copy scripts to system locations and set up systemd services
- Install the screen monitor user service and optionally enable it during install
- Install prerequisites (
-
Restart your computer.
-
On first use, you may need to accept a prompt on your TV to allow this application to connect. See: https://github.com/chros73/bscpylgtv/blob/master/docs/guides/first_use.md
The screen monitor auto-detects a supported backend:
- GNOME: Uses
org.gnome.ScreenSaverfor idle transitions andorg.gnome.Mutter.IdleMonitorfor early wake-on-activity, while still following GNOME's own blank/lock timing - wlroots/COSMIC: Uses
swayidle
In a normal GNOME Shell session, Mutter is part of the GNOME stack. No separate Mutter package needs to be installed for this backend.
When idle:
- LG_Buddy_Screen_Off blanks the TV panel (if it's on the configured HDMI input)
- LG_Buddy_Screen_On unblanks the panel when you move the mouse or press a key
Startup, shutdown, suspend, and resume still use full TV power transitions.
The swayidle backend defaults to a 300 second (5 minute) timeout. You can change it with ./configure.sh. The installer and configurator only prompt for that timeout when swayidle is the selected backend.
Check status:
systemctl --user status LG_Buddy_screen.servicePreferred way to change backend or timeout:
./configure.shTemporary backend override for testing:
systemctl --user edit LG_Buddy_screen.serviceThen add:
[Service]
Environment=LG_BUDDY_SCREEN_BACKEND=gnomeSupported values are auto, gnome, and swayidle.
Test the GNOME backend manually:
gdbus monitor --session --dest org.gnome.ScreenSaver --object-path /org/gnome/ScreenSaverTest the swayidle backend manually:
swayidle -w timeout 10 'echo IDLE' resume 'echo RESUMED'To reconfigure your TV settings after installation, run:
./configure.shThis updates ~/.config/lg-buddy/config.env. It does not rewrite the installed scripts, and it does not require sudo.
The config file currently contains:
tv_iptv_macinputscreen_backendscreen_idle_timeout
| File | Purpose |
|---|---|
bin/LG_Buddy_Startup |
Turn TV on at boot/wake |
bin/LG_Buddy_Shutdown |
Turn TV off at shutdown |
bin/LG_Buddy_sleep |
Turn TV off on suspend |
bin/LG_Buddy_Common |
Shared config and helper functions |
bin/LG_Buddy_Screen_Monitor |
Multi-backend idle monitor (GNOME or swayidle) |
bin/LG_Buddy_Screen_Off |
Blank the TV panel on screen idle |
bin/LG_Buddy_Screen_On |
Unblank the TV panel on resume |
bin/LG_Buddy_Brightness |
Interactive brightness control |
configure.sh |
Interactive configuration tool |
install.sh |
Automated installer |
LG_Buddy_Brightness.desktop |
OLED Brightness Control app |
systemd/LG_Buddy.service |
Shutdown systemd service |
systemd/LG_Buddy_wake.service |
Startup systemd service |
systemd/LG_Buddy_screen.service |
Screen monitor user service |
Rob Grieves aka https://github.com/Faceless3882 aka r/TheFacIessMan
- https://github.com/chros73 for the bscpylgtv software that makes this possible.
- https://github.com/JPersson77 for the inspiration and pointing me in the right direction.