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")