From ff4a21d9656fc9de43db50d70e0dfc39f75f155c Mon Sep 17 00:00:00 2001 From: Kopatz <7265381+Kropatz@users.noreply.github.com> Date: Wed, 1 Oct 2025 19:08:47 +0200 Subject: [PATCH] turn tv on and off pretty cooool --- systems/laptop/configuration.nix | 35 ++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/systems/laptop/configuration.nix b/systems/laptop/configuration.nix index 5151710..1869fff 100644 --- a/systems/laptop/configuration.nix +++ b/systems/laptop/configuration.nix @@ -1,4 +1,7 @@ { config, pkgs, inputs, lib, ... }: +let + cec = "${pkgs.v4l-utils}/bin/cec-ctl"; +in { imports = [ # Include the results of the hardware scan. @@ -22,6 +25,38 @@ inputs.nixos-hardware.nixosModules.framework-13-7040-amd ]; + # issue with internal mic not workin + # ... didn't work + services.pipewire.wireplumber.extraConfig.no-ucm = { + "monitor.alsa.properties" = { + "alsa.use-ucm" = false; + }; + }; + + # after suspend, do `cec-ctl -A | grep cec0 | wc -l`, if >0, do `cec-ctl --standby --to TV` + # similar on wakeup, if present send `cec-ctl --user-control-pressed ui-cmd=power-on-function --to TV` + environment.etc."systemd/system-sleep/sleep-turn-tv-off-on.sh".source = + pkgs.writeShellScript "post-sleep-turn-tv-off.sh" '' + case $1/$2 in + pre/*) + if [ $(${cec} -A | ${pkgs.gnugrep}/bin/grep cec0 | ${pkgs.coreutils}/bin/wc -l) -gt 0 ]; then + ${cec} -C --skip-info + ${cec} --tv --skip-info + ${cec} --standby --skip-info --to TV + echo "Turning TV off!" + ${pkgs.coreutils}/bin/sleep 2 + fi + ;; + post/*) + if [ $(${cec} -A | ${pkgs.gnugrep}/bin/grep cec0 | ${pkgs.coreutils}/bin/wc -l) -gt 0 ]; then + ${cec} --tv --skip-info + ${cec} --skip-info --user-control-pressed ui-cmd=power-on-function --to TV + echo "Turning TV on!" + fi + ;; + esac + ''; + custom = { cli-tools.enable = true; tmpfs.enable = true;