tvbox volume controls + hermes vm + removing deprecation warnings

This commit is contained in:
ari committed 2026-09-15 15:19:33 -04:00
1 parent 68b2f88282
commit b014fa5cea
13 files changed
+127 -21

No files matched your search

+2
View File
@@ -5,5 +5,7 @@ require("conf/cec")
-- =========================
hl.on("hyprland.start", function()
hl.exec_cmd("setpriv --ambient-caps -all -- hypridle")
hl.exec_cmd("wpctl set-volume @DEFAULT_AUDIO_SINK@ 100%")
hl.exec_cmd("wpctl set-mute @DEFAULT_AUDIO_SINK@ 0")
Cec.wake_and_switch()
end)
+41
View File
@@ -18,9 +18,50 @@ local function wake_and_switch(target)
cec_send("as", target)
end
---Send a CEC "User Control Pressed" + "Released" key press to a device.
---cec-client's built-in volup/voldown/mute shortcuts hardcode the CEC
---"Audio System" address (5), which is a no-op when there's no amp/soundbar
---on the bus — so volume keys go through raw tx frames addressed at the
---TV instead, the same address `wake_and_switch` already proves works.
---@param target integer CEC logical address (0 = TV)
---@param ui_cmd string UI command hex byte, e.g. "41" Volume Up, "42" Volume Down, "43" Mute
local function cec_key(target, ui_cmd)
local src = 1
local press = string.format("tx %x%x:44:%s", src, target, ui_cmd)
local release = string.format("tx %x%x:45", src, target)
hl.exec_cmd(
string.format(
"bash -c \"printf '%%s\\n%%s\\n' '%s' '%s' | cec-client -s -d 1 -o SkygBox -t p\"",
press,
release
)
)
end
---@param target integer? defaults to 0 (TV)
local function volume_up(target)
cec_key(target or 0, "41")
end
---@param target integer? defaults to 0 (TV)
local function volume_down(target)
cec_key(target or 0, "42")
end
---@param target integer? defaults to 0 (TV)
local function mute(target)
cec_key(target or 0, "43")
end
---@class Cec
---@field send fun(cmd: string, target: integer)
---@field wake_and_switch fun(target: integer?)
---@field volume_up fun(target: integer?)
---@field volume_down fun(target: integer?)
---@field mute fun(target: integer?)
Cec = Cec or {}
Cec.send = cec_send
Cec.wake_and_switch = wake_and_switch
Cec.volume_up = volume_up
Cec.volume_down = volume_down
Cec.mute = mute
+20 -2
View File
@@ -64,8 +64,26 @@ hl.bind("XF86AudioStop", hl.dsp.exec_cmd("playerctl stop"))
hl.bind("XF86ChannelUp", hl.dsp.focus({ direction = "right" }))
hl.bind("XF86ChannelDown", hl.dsp.focus({ direction = "left" }))
hl.bind("XF86HomePage", hl.dsp.exec_cmd("skygqts carousel ~/.config/hypr/skygqts-carousel.json"))
hl.bind("XF86AudioRaiseVolume", hl.dsp.exec_cmd("noctalia msg volume-up"), { locked = true })
hl.bind("XF86AudioLowerVolume", hl.dsp.exec_cmd("noctalia msg volume-down"), { locked = true })
---- volume keys just remote-control the TV over CEC; the machine's own
---- volume is pinned at 100%/unmuted (see force_max_volume) so all real
---- volume control happens on the TV, not in software.
local function force_max_volume()
hl.exec_cmd("wpctl set-volume @DEFAULT_AUDIO_SINK@ 100%")
hl.exec_cmd("wpctl set-mute @DEFAULT_AUDIO_SINK@ 0")
end
hl.bind("XF86AudioRaiseVolume", function()
force_max_volume()
Cec.volume_up()
end, { locked = true })
hl.bind("XF86AudioLowerVolume", function()
force_max_volume()
Cec.volume_down()
end, { locked = true })
hl.bind("XF86AudioMute", function()
force_max_volume()
Cec.mute()
end, { locked = true })
---- middle
-- hl.bind("F5", hl.dsp.exec_cmd("")) -- LIVE TV