Unverified Commit 93650157 authored by Pol Dellaiera's avatar Pol Dellaiera Committed by GitHub
Browse files

Merge pull request #230342 from dit7ya/dotool

dotool: init at 1.3
parents 37878e02 eca89b07
Loading
Loading
Loading
Loading
+46 −0
Original line number Diff line number Diff line
{ lib
, buildGoModule
, fetchFromSourcehut
, libxkbcommon
, pkg-config
}:

buildGoModule rec {
  pname = "dotool";
  version = "1.3";

  src = fetchFromSourcehut {
    owner = "~geb";
    repo = "dotool";
    rev = version;
    hash = "sha256-z0fQ+qenHjtoriYSD2sOjEvfLVtZcMJbvnjKZFRSsMA=";
  };

  vendorHash = "sha256-v0uoG9mNaemzhQAiG85RequGjkSllPd4UK2SrLjfm7A=";

  # uses nix store path for the dotool binary
  # also replaces /bin/echo with echo
  patches = [ ./fix-paths.patch ];

  postPatch = ''
    substituteInPlace ./dotoold --replace "@dotool@" "$out/bin/dotool"
  '';

  buildInputs = [ libxkbcommon ];
  nativeBuildInputs = [ pkg-config ];

  ldflags = [ "-s" "-w" "-X main.Version=${version}" ];

  postInstall = ''
    mkdir -p $out/bin
    cp ./dotoold ./dotoolc $out/bin
  '';

  meta = with lib; {
    description = "Command to simulate input anywhere";
    homepage = "https://git.sr.ht/~geb/dotool";
    changelog = "https://git.sr.ht/~geb/dotool/tree/${version}/item/CHANGELOG.md";
    license = licenses.gpl3Only;
    maintainers = with maintainers; [ dit7ya ];
  };
}
+33 −0
Original line number Diff line number Diff line
diff --git a/dotoolc b/dotoolc
index e2f7bba..6d1879e 100755
--- a/dotoolc
+++ b/dotoolc
@@ -7,7 +7,7 @@ is $DOTOOL_PIPE else /tmp/dotool-pipe.' >&2
 fi
 
 fifo_being_read(){
-	[ -p "$1" ] && /bin/echo 1<>"$1" >"$1"
+	[ -p "$1" ] && echo 1<>"$1" >"$1"
 }
 
 p="${DOTOOL_PIPE:-/tmp/dotool-pipe}"
diff --git a/dotoold b/dotoold
index d2d39a3..e46129c 100755
--- a/dotoold
+++ b/dotoold
@@ -7,7 +7,7 @@ for the pipe is $DOTOOL_PIPE else /tmp/dotool-pipe.' >&2
 fi
 
 fifo_being_read(){
-	[ -p "$1" ] && /bin/echo 1<>"$1" >"$1"
+	[ -p "$1" ] && echo 1<>"$1" >"$1"
 }
 
 p="${DOTOOL_PIPE:-/tmp/dotool-pipe}"
@@ -20,5 +20,5 @@ fi
 rm -f -- "$p" || exit 1
 trap 'rm -f -- "$p"; pkill -P $$; trap - EXIT; exit' EXIT INT TERM HUP
 mkfifo -m 660 "$p" || exit 1
-dotool <> "$p" &
+@dotool@ <> "$p" &
 wait
+2 −0
Original line number Diff line number Diff line
@@ -4829,6 +4829,8 @@ with pkgs;
    inherit (darwin.apple_sdk.frameworks) Security;
  };
  dotool = callPackage ../tools/dotool { };
  inherit (ocamlPackages) dot-merlin-reader;
  dozenal = callPackage ../applications/misc/dozenal { };