views:

3151

answers:

5

The standalone flashplayer takes no arguments other than a .swf file when you launch it from the command line. I need the player to go full screen, no window borders and such. This can be accomplished by hitting ctrl+f once the program has started. I want to do this programmatically as I need it to launch into full screen without any human interaction.

My guess is that I need to some how get a handle to the window and then send it an event that looks like the "ctrl+f" keystroke.

If it makes any difference, it looks like flashplayer is a gtk application and I have python with pygtk installed.

UPDATE (the solution I used... thanks to ypnos' answer):

./flashplayer http://example.com/example.swf & sleep 3 && ~/xsendkey -window "Adobe Flash Player 10" Control+F

+1  A: 

I've actually done this a long time ago, but it wasn't petty. What we did is use the Sawfish window manager and wrote a hook to recognize the flashplayer window, then strip all the decorations and snap it full screen.

This may be possible without using the window manager, by registering for X window creation events from an external application, but I'm not familiar enough with X11 to tell you how that would be done.

Another option would be to write a pygtk application that embedded the standalone flash player inside a gtk.Socket and then resized itself. After a bit of thought, this might be your best bet.

bmdhacks
+6  A: 

You can use a dedicated application which sends the keystroke to the window manager, which should then pass it to flash, if the window starts as being the active window on the screen. This is quite error prone, though, due to delays between starting flash and when the window will show up.

For example, your script could do something like this: flashplayer *.swf sleep 3 && xsendkey Control+F

The application xsendkey can be found here: http://people.csail.mit.edu/adonovan/hacks/xsendkey.html Without given a specific window, it will send it to the root window, which is handled by your window manager. You could also try to figure out the Window id first, using xprop or something related to it.

Another option is a Window manager, which is able to remember your settings and automatically apply them. Fluxbos for example provides this feature. You could set fluxbox to make the Window decor-less and stretch it over the whole screen, if flashplayer supports being resized. This is also not-so-nice, as it would probably affect all the flashplayer windows you open ever.

ypnos
xprop + xsendkey does the trick. I will post my exact bash command once I get it all the piping and awk stuff figured out to automate it.
ordord00
ordord00
that took a long time :) But thanks for sharing!
ypnos
A: 
nspluginplayer --fullscreen src=path/to/flashfile.swf

which is from the http://gwenole.beauchesne.info//en/projects/nspluginwrapper

A: 

I've done this using openbox using a similar mechanism to the one that bmdhacks mentions. The thing that I did note from this was that the standalone flash player performed considerably worse fullscreen than the same player in a maximised undecorated window. (that, annoyingly is not properly fullscreen because of the menubar). I was wondering about running it with a custom gtk theme to make the menu invisible. That's just a performance issue though. If fullscreen currently works ok, then it's unneccisarily complicated. I was running on an OLPC XO, performance is more of an issue there.

I didn't have much luck with nspluginplayer (too buggy I think).

Ultimately I had the luxury of making the flash that was running so I could simply place code into the flash itself. By a similar token, Since you can embed flash within flash, it should be possible to make a little stub swf that goes fullscreen automatically and contains the target sfw.

Lerc
A: 

you have to use Acton script 3 cmd: stage.displayState = StageDisplayState.FULL_SCREEN;

see Adobe Acstion script 3 ptogramming!

But be carrefull : in full screen, you will loose display performances!

I've got this problem ... more under Linux!!! :(

D.

Daniel