Created
March 22, 2017 14:58
-
-
Save iamahuman/6d3ec110789b5afc59dbaeabf4eef2f4 to your computer and use it in GitHub Desktop.
Workaroud for Rosetta@home's screensaver window attachment operation absence bug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
pid= | |
do_term() { | |
trap - INT TERM EXIT CHLD | |
echo "Do exit $pid" | |
if [ "$pid" ] | |
then | |
kill "$pid" 2> /dev/null || : | |
fi | |
pkill minirosetta_gra || : | |
} | |
trap do_term INT TERM EXIT | |
trap 'kill -0 $pid 2> /dev/null || do_term' CHLD | |
boincscr "$@" & pid=$! | |
dir="/proc/$pid/cwd" | |
while : | |
do | |
if class=`grep -oP '[^/]*(?=</soft_link>)' "$dir/graphics_app"` && \ | |
wu_name=`grep -oP '(?<=<wu_name>)[^]\\[]*(?=</wu_name>)' "$dir/init_data.xml"` | |
then | |
echo "Found! $class $wu_name" | |
wu_name_esc=`echo "$wu_name" | sed 's/./[&]/g'` | |
xdotool search --sync --name "minirosetta version [0-9.]* \\[workunit: $wu_name_esc\\]" set_window --class "$class" --classname "$class" && echo "Found window" || echo "Window not found" | |
wait $pid | |
exit | |
fi | |
sleep .1 | |
readlink "$dir" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment