ctucx.git: nixfiles

ctucx' nixfiles

commit cb3e05b8fd41b2bd4b5afa679450a745cc23ab44
parent e240cfceee2622e81f73f98f7d64f7906f6985e0
Author: Leah (ctucx) <leah@ctu.cx>
Date: Sun, 10 Jul 2022 11:38:27 +0200

pkgs/SpeakerDaemon: do nothing if dock is not connected
1 file changed, 3 insertions(+), 0 deletions(-)
diff --git a/pkgs/SpeakerDaemon/default.nix b/pkgs/SpeakerDaemon/default.nix
@@ -34,6 +34,9 @@ let
             case kIOMessageSystemWillSleep:
                 printf("Sleep-Event!\n");
 
+                // check if dock is connected
+                if (system("ioreg -p IOUSB | grep 'Anker USB-C Hub Device' 1> /dev/null") != 0) break;
+
                 curl = curl_easy_init();
                 if (curl) {
                     curl_easy_setopt(curl, CURLOPT_WRITEDATA,   dummy_writer);