3

I have a little script that needs executing every time I open a wine program. The script is pretty simple:

#!/bin/bash
xdotool windowmove 67108871 1440 0

How do I get PlayOnLinux to run this script every time I open a certain program?

1
  • Have you tried devilspie? IF you find the exact window or application name you should be able to perform many actions like maximising or positioning it, as I discuss in this answer.
    – user76204
    May 7, 2013 at 16:15

2 Answers 2

0

I don't use PlayOnLinux, but maybe a generic approach will be of some use.

The basic idea is to replace the invoking script - the one that runs your program now - with a new one that runs your your new script before or after running the invoking script (whichever best suits what you want to accomplish - probably after, in your case).

If your script can run before your program, then all you have to do is find the script or program that invokes your program and replace it by another script (with a different name, if possible, so as not to cause confusion or worse).

The new script would run your setup script and then run the original script to invoke your program (using the full path to the invoking script if your new script has the same name as the original one - to avoid an infinite loop.)

If your script has to run after your program has started (as it might in your case), that's a lot trickier. I have no idea how to do that, but I'd start looking by getting the program's process number and seeing if I could look up the window from the process number. (I have not used xdotool, but looking at its description suggests that maybe using xdotool search or xdotool getactivewindow windowmove ... might be useful. It looks like you can do anything you want as long as you know the window's unique name.)

If you can get that to work, then invoking it would just involve invoking the original script and then your script. To do that, your new invoking script would invoke the original script then your new script. But, your invoking script probably won't relinquish control back to your script until your program is completely finished and it's too late to run your new script.

If you can run your invoking script with an & after it to let it run in background, then control will come right back to your script and you can immediately run your new script to modify the window. If this works, then $! will contain the process number of your invoking script, if that helps.

HTH

0

Try this :
Assuming file name of program to launch is birds.exe from C:\Program Files\
In the beginning of bash script copy this code (with modified file name).

while ! ( ps aux |grep -v 'grep' | grep 'Birds.exe' >/dev/null ); do echo 'waiting for pgm to start...'; sleep 1; done; echo "Program 'Birds.exe' stared'"  

Change Birds.exe to correct file name. Thus the rest of script is executed only if the program started.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .