Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Would like to open all avi and mpeg files from folders in nautilus into a script that opens the file and moves the window using wmctrl.

Basically, I need to open all media files with a script that brings up totem and opens the file then moves it 135 pixels over.

Was thinking something like

#! bin/bash

totem $1 & 
sleep 1 &&
wmctrl -r "totem" -e 1,135,0,800,600

I tried this but got no sound, and it doesn't resize either.

Can anyone see anything obvious I'm doing wrong?

share|improve this question
    
Did you fix it yet? Sound is working? –  Bruno Pereira Oct 10 '11 at 14:33

2 Answers 2

I think wmctrl is looking for a title bar text and not the name of the program it self, so if you are opening "myvideo.mkv" in totem the title bar will read "myvideo.mkv" not "totem" so you have to change the "totem" search parameter to the name of the video.

Have a look at how the title bar changes and you should be able to control ti with 'wmctrl'

enter image description here

share|improve this answer
    
I appreciate the response i'm still pretty new at these kinds of scripts. setting -r to "$1" should ensure that the command sticks –  BorgDomination Oct 9 '11 at 22:14

There are at least three errors in your script:

  1. the shebang miss a /, it should read #!/bin/bash
  2. you should quote your parameter: "$1", it is not uncommon to have spaces in filenames
  3. use the filename to match the window (-r "$1"), as you can see the totem windows do not have the string "totem" in its name
share|improve this answer
    
That does not explain the apparent issues with audio though? –  Jo-Erlend Schinstad Oct 9 '11 at 21:24
    
Hey thanks for the response!! so $1 does bring in the argument request from nautilus to input the file name into the program? That's one of the things I was confused about. Also, thanks for pointing out the missing / –  BorgDomination Oct 9 '11 at 22:13

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.