This commit is contained in:
2025-02-05 23:46:22 -05:00
parent ed160b8280
commit af09e1e1f9
4 changed files with 35 additions and 31 deletions

View File

@@ -2,21 +2,32 @@
{
systemd.services.no-rgb =
let
no-rgb = pkgs.writeScriptBin "no-rgb" ''
#!/bin/sh
set -e
no-rgb = (
pkgs.writeShellApplication {
name = "no-rgb";
runtimeInputs = with pkgs; [
openrgb
coreutils
gnugrep
];
NUM_DEVICES=$(${pkgs.openrgb}/bin/openrgb --noautoconnect --list-devices | ${pkgs.gnugrep}/bin/grep -E '^[0-9]+: ' | ${pkgs.coreutils}/bin/wc -l)
text = ''
#!/bin/sh
set -e
for i in $(${pkgs.coreutils}/bin/seq 0 $(($NUM_DEVICES - 1))); do
${pkgs.openrgb}/bin/openrgb --noautoconnect --device $i --mode direct --color 000000
done
'';
NUM_DEVICES=$(openrgb --noautoconnect --list-devices | grep -cE '^[0-9]+: ')
for i in $(seq 0 $((NUM_DEVICES - 1))); do
openrgb --noautoconnect --device "$i" --mode direct --color 000000
done
'';
}
);
in
{
description = "disable rgb";
serviceConfig = {
ExecStart = "${no-rgb}/bin/no-rgb";
ExecStart = "${no-rgb}/bin/${no-rgb.name}";
Type = "oneshot";
};
wantedBy = [ "multi-user.target" ];
@@ -29,5 +40,4 @@
environment.systemPackages = with pkgs; [
openrgb-with-all-plugins
];
}