Fix clipboard translator process detection for long process names

The pgrep command was failing to match Wine processes with long names
like "c:\nyanchangame\bk\play.exe" because pgrep by default only
matches against the first 15 characters of process names. Fixed by
adding the -f flag to match against the full command line.
This commit is contained in:
2025-09-11 16:36:57 -04:00
parent 0cf2145852
commit ba0075e74b

View File

@@ -13,7 +13,7 @@ if [[ $# -ne 2 ]]; then
fi
# Wait for the application to start
while ! pgrep -u "$USER" ^$1 &> /dev/null ; do
while ! pgrep -f -u "$USER" "$1" &> /dev/null ; do
sleep 0.05
done
@@ -56,7 +56,7 @@ insert_database() {
}
# Read so long as the application is running
while pgrep -u "$USER" ^$1 &> /dev/null ; do
while pgrep -f -u "$USER" "$1" &> /dev/null ; do
sleep 0.05
text="$(xclip -d "${DISPLAY:-:0}" -selection clipboard -o 2> /dev/null)"
if [[ -f ~/.agmsilent ]]; then