feat: added command-runner server

This commit is contained in:
uttarayan21
2025-06-23 12:06:14 +05:30
parent 371c35d73e
commit 7702946c5f
9 changed files with 398 additions and 192 deletions

View File

@@ -0,0 +1,27 @@
{
config,
lib,
pkgs,
...
}: {
services.command-runner = {
enable = true;
port = 5599;
user = "servius";
commands = let
hyprctl = "${pkgs.hyprland}/bin/hyprctl";
in
{
"display_on" = [hyprctl "-i" "{instance}" "dispatch" "dpms" "on"];
"display_off" = [hyprctl "-i" "{instance}" "dispatch" "dpms" "off"];
"display_toggle" = [hyprctl "-i" "{instance}" "dispatch" "dpms" "toggle"];
"display_status" = [hyprctl "-i" "{instance}" "-j" "monitors"];
"hyprland_instance" = [hyprctl "-j" "instances"];
}
// (builtins.foldl' (acc: elem: acc // elem) {} (lib.map (name: {
"display_on_${name}" = [hyprctl "-i" "{instance}" "dispatch" "dpms" "on" name];
"display_off_${name}" = [hyprctl "-i" "{instance}" "dispatch" "dpms" "off" name];
"display_toggle_${name}" = [hyprctl "-i" "{instance}" "dispatch" "dpms" "toggle" name];
}) ["HDMI-A-1" "DP-3" "DP-1"]));
};
}