{"id":51636081,"url":"https://github.com/lmrisdal/lgctl","last_synced_at":"2026-07-13T14:32:51.317Z","repository":{"id":367416795,"uuid":"1280661099","full_name":"lmrisdal/lgctl","owner":"lmrisdal","description":"Control an LG webOS TV from Linux/SteamOS — wake on resume, sleep on suspend (input-aware), switch HDMI input. Single static Go binary, config file + systemd, no GUI.","archived":false,"fork":false,"pushed_at":"2026-06-25T22:24:15.000Z","size":42,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-26T00:06:12.770Z","etag":null,"topics":["bazzite","cli","golang","home-theater","htpc","lg-tv","steamos","systemd","wake-on-lan","webos"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lmrisdal.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-06-25T20:11:44.000Z","updated_at":"2026-06-25T22:26:24.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/lmrisdal/lgctl","commit_stats":null,"previous_names":["lmrisdal/lgctl"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/lmrisdal/lgctl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lmrisdal%2Flgctl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lmrisdal%2Flgctl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lmrisdal%2Flgctl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lmrisdal%2Flgctl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lmrisdal","download_url":"https://codeload.github.com/lmrisdal/lgctl/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lmrisdal%2Flgctl/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35426085,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-13T02:00:06.543Z","response_time":119,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["bazzite","cli","golang","home-theater","htpc","lg-tv","steamos","systemd","wake-on-lan","webos"],"created_at":"2026-07-13T14:32:48.890Z","updated_at":"2026-07-13T14:32:51.307Z","avatar_url":"https://github.com/lmrisdal.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# lgctl\n\nControl an LG webOS TV from Linux — wake it when your PC resumes from sleep,\nswitch it to the PC's HDMI input, and put it to sleep when the PC suspends\n(only if the PC is the active input).\n\nA small, single-binary, no-GUI take on the Windows-only\n[LGTV Companion](https://github.com/JPersson77/LGTVCompanion), aimed at HTPCs\nrunning Linux / SteamOS (e.g. Bazzite). Configured with one JSON file and driven\nby systemd units.\n\n## Features\n\n- **Wake on resume** — Wake-on-LAN magic packets plus a webOS power-on handshake.\n- **Sleep on suspend, input-aware** — powers the TV off when the PC suspends,\n  but only if the PC's HDMI input is the currently active source (so it won't\n  turn the TV off while you're watching something else). Use `--force` to skip\n  the check.\n- **Switch HDMI input on wake** — optionally select the PC's input after waking.\n- **Manual control** — `lgctl on|off|input N|status` for scripts and hotkeys.\n\nNo external dependencies: it's pure Go standard library (its own minimal\nWebSocket client), so `go build` produces one static binary.\n\n## Install\n\nRun the command:\n\n```sh\ncurl -fsSL https://raw.githubusercontent.com/lmrisdal/lgctl/main/packaging/install.sh | sh\n```\n\nInstalls it to `/usr/local/bin/lgctl`, writes an example config to `/etc/lgctl`,\nand asks which systemd services to enable (sleep/resume and boot/shutdown).\n\nThen [Configure](#configure) and [Pair](#pair) below.\n\n\u003cdetails\u003e\n\u003csummary\u003eNon-interactive flags\u003c/summary\u003e\n\nAnswer the service prompts up front (the default with no terminal — e.g. fully\npiped — is to install both):\n\n```sh\n... | sh -s -- --no-power     # skip the boot/shutdown service\n... | sh -s -- --no-sleep     # skip the sleep/resume service\n... | sh -s -- -y             # accept defaults (both services)\n```\n\nRun `install.sh --help` for the full option list.\n\n\u003c/details\u003e\n\nEach tagged release ships static `amd64`/`arm64` Linux binaries.\n\n### Update\n\n```sh\nsudo lgctl update   # fetch the latest release, verify its checksum, swap in place\n```\n\n### Uninstall\n\n```sh\nsudo lgctl uninstall\n```\n\nInteractive: it lists the installed systemd services (and whether each is\nenabled), then lets you pick which to remove — or choose **Everything** to also\ndelete the binary and `/etc/lgctl` (config + saved pairing key). Disabling a\nservice never runs its shutdown hook, so uninstalling does not toggle the TV.\n\n### Build it yourself\n\nPrefer to compile from source? Clone and build — it's pure Go standard library,\nso one command produces the static binary:\n\n```sh\ngit clone https://github.com/lmrisdal/lgctl\ncd lgctl\nCGO_ENABLED=0 go build -trimpath -ldflags \"-s -w\" -o lgctl .\nsudo install -Dm755 lgctl /usr/local/bin/lgctl\n```\n\nThen install the config and systemd units as described under\n[Configure](#configure) and [Power events](#power-events-systemd).\n\n## Configure\n\n`install.sh` placed an example config at `/etc/lgctl/config.json` (or copy\n`packaging/config.example.json` there yourself). Edit it:\n\n| Field                  | Meaning                                                       |\n| ---------------------- | ------------------------------------------------------------- |\n| `ip`                   | TV's IP address (give it a DHCP reservation).                 |\n| `mac`                  | TV's MAC for WOL. String, or array for multiple NICs.         |\n| `ssl`                  | Use the encrypted port 3001 (default `true`); `false` = 3000. |\n| `hdmi_input`           | HDMI port the PC is on (1–4).                                 |\n| `check_input_on_off`   | Only power off if the PC is the active input.                 |\n| `set_input_on_wake`    | Switch to the PC's input after waking.                        |\n| `input_wake_delay_sec` | Delay before switching input (default 1).                     |\n| `timeout_sec`          | How long to retry WOL + connect on power-on (default 20).     |\n| `subnet`               | Mask for the directed-broadcast WOL target.                   |\n\nThe config file is searched in this order when `--config` is omitted:\n`$LGCTL_CONFIG`, `/etc/lgctl/config.json`, `~/.config/lgctl/config.json`.\n\n## Pair\n\nThe TV shows a one-time prompt the first time you connect:\n\n```sh\nsudo lgctl pair      # accept the prompt on the TV with your remote\n```\n\nThe received `client_key` is written back into your config file. After that,\nall commands work non-interactively.\n\n## Power events (systemd)\n\n`install.sh` offers two units (it asks about each) that cover all four power\nevents:\n\n- **`lgctl-sleep.service`** — powers the TV off just before suspend, back on at\n  resume.\n- **`lgctl-power.service`** — wakes the TV at boot (fire-and-forget, so an\n  unreachable TV never delays boot) and powers it off at shutdown/reboot (ordered\n  after the network so the TV is still reachable).\n\nBoth power-off paths are input-aware (`check_input_on_off`), so they leave the\nTV alone if you're watching another source. To skip the boot power-on, remove\nthe `ExecStart=` line from `lgctl-power.service`.\n\nTest it:\n\n```sh\nsystemctl suspend\n```\n\n\u003cdetails\u003e\n\u003csummary\u003eInstalling the units by hand (if you're not using install.sh)\u003c/summary\u003e\n\n```sh\nsudo install -Dm644 packaging/lgctl-sleep.service /etc/systemd/system/lgctl-sleep.service\nsudo install -Dm644 packaging/lgctl-power.service /etc/systemd/system/lgctl-power.service\nsudo systemctl daemon-reload\nsudo systemctl enable lgctl-sleep.service lgctl-power.service\n# Arm off-at-shutdown now (don't 'start' the sleep unit — that would power the\n# TV off immediately).\nsudo systemctl start lgctl-power.service\n```\n\n\u003c/details\u003e\n\n\u003e On immutable distros (Bazzite/SteamOS), `/usr/local/bin` (a symlink to\n\u003e `/var/usrlocal/bin`), `/etc`, and `/etc/systemd/system` are all writable, so\n\u003e this survives OS image updates.\n\n## Manual commands\n\n```sh\nlgctl on            # wake (WOL + power on) and optionally switch input\nlgctl off           # power off, but only if the PC is the active input\nlgctl off --force   # power off regardless\nlgctl input 2       # switch to HDMI 2 (wakes the TV first if it's off)\nlgctl input-type 2 pc   # set HDMI 2's input type to \"PC\" (icon + label)\nlgctl input-type list   # list the available input types\nlgctl status        # show power state and active input\nsudo lgctl update   # download and install the latest release in place\n```\n\n`on`/`off` also accept the aliases `resume`/`suspend`.\n\n`update` fetches the latest GitHub release for your architecture, verifies it\nagainst the published `SHA256SUMS.txt`, and atomically swaps the running binary.\nUse `sudo` when `lgctl` lives in a root-owned path like `/usr/local/bin`; add\n`--force` to reinstall even when you're already on the latest version.\n\n## Notes\n\n- `lgctl pair` automatically enables Wake-on-LAN on the TV (best-effort, via the\n  same luna workaround the Windows app uses). If it reports it couldn't, enable\n  it manually in the TV's network settings.\n- The TV must also have \"Quick Start+\" (or LAN/Wi-Fi standby) enabled for WOL to\n  work from a fully-off state — set this once in the TV's General settings.\n- Wire the PC to the TV over Ethernet for the most reliable WOL.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flmrisdal%2Flgctl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flmrisdal%2Flgctl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flmrisdal%2Flgctl/lists"}