tvos - disable autosleep and wake on hdmi

This commit is contained in:
ari committed 2026-09-15 13:04:00 -04:00
1 parent 9824f0474e
commit a89641769b
6 files changed
+67 -2

No files matched your search

-1
View File
@@ -10,4 +10,3 @@ require("conf/inputs")
require("conf/window-rules")
require("conf/keybindings")
require("conf/autostart")
require("/home/ari/nixos-setup/configs/hl-fws1/hypr/conf/apps.lua")
+4
View File
@@ -1,3 +1,5 @@
require("conf/cec")
---@param s string
---@return string
local function escape_pattern(s)
@@ -36,6 +38,8 @@ end
---@return fun()
local function make_commandable(tag, cmd, is_target_window)
return function()
Cec.wake_and_switch()
local existing = attempt_to_switch_to_existing(tag)
if existing ~= nil then
hl.dispatch(hl.dsp.focus({ window = existing }))
+3
View File
@@ -1,6 +1,9 @@
require("conf/cec")
-- =========================
-- Autostart
-- =========================
hl.on("hyprland.start", function()
hl.exec_cmd("setpriv --ambient-caps -all -- hypridle")
Cec.wake_and_switch()
end)
+24
View File
@@ -0,0 +1,24 @@
-- =========================
-- CEC (HDMI-CEC control, e.g. waking/switching the TV)
-- =========================
---@param cmd string raw cec-client command, e.g. "on" or "as"
---@param target integer CEC logical address (0 = TV)
local function cec_send(cmd, target)
hl.exec_cmd(string.format("bash -c \"echo '%s %d' | cec-client -s -d 1\"", cmd, target))
end
---Wake a CEC device and make this box its active source.
---@param target integer? CEC logical address, defaults to 0 (TV)
local function wake_and_switch(target)
target = target or 0
cec_send("on", target)
cec_send("as", target)
end
---@class Cec
---@field send fun(cmd: string, target: integer)
---@field wake_and_switch fun(target: integer?)
Cec = Cec or {}
Cec.send = cec_send
Cec.wake_and_switch = wake_and_switch
+1
View File
@@ -11,6 +11,7 @@ require("conf/animations")
require("conf/monitors")
require("conf/inputs")
require("conf/window-rules")
require("conf/cec")
require("conf/keybindings")
require("conf/autostart")
require("conf/apps")
+35 -1
View File
@@ -84,15 +84,49 @@
{ name = "libpipewire-module-raop-discover"; }
];
};
wireplumber.extraConfig."51-hdmi-tv" = {
# Stop remembering the analog profile between boots — always prefer HDMI.
"wireplumber.settings" = {
"device.restore-profile" = false;
"device.restore-routes" = false;
};
# ACP ranks analog-stereo (6565) above hdmi-stereo (5900) by default;
# override that so the LG TV (hdmi-output-0, confirmed via ELD) wins.
"device.profile.priority.rules" = [
{
matches = [{ "device.name" = "alsa_card.pci-0000_00_1f.3"; }];
actions.update-props.priorities = [ "output:hdmi-stereo" ];
}
];
# Make the resulting HDMI sink win the default-sink vote too.
"monitor.alsa.rules" = [
{
matches = [{ "node.name" = "~alsa_output.*hdmi.*"; }];
actions.update-props."priority.session" = 2000;
}
];
};
};
security.rtkit.enable = true;
# Let the logged-in session (not just root) open the CEC device, so
# Hyprland can drive the TV without sudo.
services.udev.extraRules = ''
SUBSYSTEM=="cec", MODE="0664", TAG+="uaccess"
'';
# Disable auto-suspend/hibernate — always-on TV box
systemd.targets.sleep.enable = false;
systemd.targets.suspend.enable = false;
systemd.targets.hibernate.enable = false;
systemd.targets.hybrid-sleep.enable = false;
# Send audio to AirPlay speakers
services.avahi.enable = true;
# AirPlay receiver
services.shairport-sync = {
enable = true;
arguments = "-o pw";
arguments = "-o pipewire";
};
}