Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'd like to run some applications in fullscreen. Even though they don't have an explicit such option, it is possible with the metacity Alt-F11 command.

So, I thought I could create such an input like this:

full.txt:

KeyStrPress Alt_L
KeyStrPress F11
KeyStrRelease F11
KeyStrRelease Alt_L

and then:

xmacroplay "$DISPLAY" < full.txt (in my case, the same as xmacroplay :0.0 < full.txt)

But, it works in the terminal where it is run. How do I send it to the stdin of some other process?

Edit: I found a better way to do this: wmctrl -r urxvt -b toggle,fullscreen (for urxvt). Check out my answer to this question for (a bit) more on that.

share|improve this question
    
Wouldn't sending something to stdin of some process require that process to read from stdin? What applications are you trying to run fullscreen? You are using GNOME I assume? –  Herman Torjussen Jun 7 '12 at 14:01
    
For example, urxvt, emacs and iceweasel. I am sort of using GNOME but I log in from tty, then xinit with metacity last in .xinitrc, so I guess a lot of the GNOME stuff is not there, but some might be. I got the Alt-F11 command from metacity and gconf-editor. –  Emanuel Berg Jun 7 '12 at 17:17
    
Sending keystrokes to metacity seems like a very roundabout way to make it perform an action. Doesn't metacity have a way to feed it commands? –  Gilles Jun 8 '12 at 0:12
    
I agree 100%, look at the command in my comment below, "roundabout" to say the least! But... man metacity is like one A4 and there is nothing there about commands. Do you know where else to look? –  Emanuel Berg Jun 8 '12 at 10:04
add comment

1 Answer

up vote 3 down vote accepted

You need to focus the window that you want to recieve these keystrokes. wmname provides such functionality, you can probably find it in your package manager. wmctrl -ai "$windowID" ; xmacroplay "$DISPLAY" < full.txt (where $windowID is the window ID as determined through xwininfo, et al) is probably what you want.

share|improve this answer
    
Yes, this works. It doesn't look very robust with the sleep, and it will not work if you have several instances, but I guess it is OK for applications you only start once at start up. (emacs &) ; sleep 1 ; wmctrl -a emacs ; xmacroplay "$DISPLAY" < full.txt 1> /dev/null 2> /dev/null –  Emanuel Berg Jun 7 '12 at 17:12
    
This: wmctrl -r emacs -b toggle,fullscreen is better, than what I wrote in my comment above. –  Emanuel Berg Nov 10 '12 at 1:05
add comment

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.