3

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.

Emanuel Berg
  • 6,763
  • 7
  • 43
  • 65
  • 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? –  Jun 07 '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 07 '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 'SO- stop being evil' Jun 08 '12 at 00: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 08 '12 at 10:04

1 Answers1

3

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.

Chris Down
  • 122,090
  • 24
  • 265
  • 262
  • 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 07 '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 01:05