pallas: manage EventScripts scripts
This commit is contained in:
parent
160073943a
commit
e8db349c81
2 changed files with 43 additions and 0 deletions
|
@ -26,6 +26,8 @@ in
|
||||||
|
|
||||||
../programs/btop.nix
|
../programs/btop.nix
|
||||||
|
|
||||||
|
../programs/event-scripts.nix
|
||||||
|
|
||||||
../programs/gallery-dl.nix
|
../programs/gallery-dl.nix
|
||||||
|
|
||||||
../programs/gpg.nix
|
../programs/gpg.nix
|
||||||
|
|
41
home/programs/event-scripts.nix
Normal file
41
home/programs/event-scripts.nix
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
{ pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
home.file =
|
||||||
|
let
|
||||||
|
scriptDirectory = "Library/Application Scripts/net.mousedown.EventScripts";
|
||||||
|
fullScriptDirectoryPath = "$HOME/${scriptDirectory}";
|
||||||
|
mosquitto_pub = "${pkgs.mosquitto}/bin/mosquitto_pub";
|
||||||
|
in
|
||||||
|
{
|
||||||
|
"${scriptDirectory}/.hm_keyboard_connected.sh" = {
|
||||||
|
text = ''
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
if [ "$2" = "Keychron Q1" ]; then
|
||||||
|
${mosquitto_pub} -h 10.0.0.230 -m "USB-C" -t hadata/macos/daniels_monitor -u mqtt_bridge -P verySecurePassword
|
||||||
|
fi
|
||||||
|
'';
|
||||||
|
onChange = ''
|
||||||
|
rm -f "${fullScriptDirectoryPath}/keyboard_connected.sh"
|
||||||
|
cp "${fullScriptDirectoryPath}/.hm_keyboard_connected.sh" "${fullScriptDirectoryPath}/keyboard_connected.sh"
|
||||||
|
'';
|
||||||
|
executable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
"${scriptDirectory}/.hm_keyboard_disconnected.sh" = {
|
||||||
|
text = ''
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
if [ "$2" = "Keychron Q1" ]; then
|
||||||
|
${mosquitto_pub} -h 10.0.0.230 -m "DisplayPort" -t hadata/macos/daniels_monitor -u mqtt_bridge -P verySecurePassword
|
||||||
|
fi
|
||||||
|
'';
|
||||||
|
onChange = ''
|
||||||
|
rm -f "${fullScriptDirectoryPath}/keyboard_disconnected.sh"
|
||||||
|
cp "${fullScriptDirectoryPath}/.hm_keyboard_disconnected.sh" "${fullScriptDirectoryPath}/keyboard_disconnected.sh"
|
||||||
|
'';
|
||||||
|
executable = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue