From: Tamara Temple Date: 2013-07-11T09:35:43+09:00 Subject: Re: RMagick's #display (focus issues) - off-topic? On Jul 10, 2013, at 7:27 AM, Hal Fulton wrote: > I was playing with a little software idea last night and ran into difficulty. > > Actually, I could start an email with that sentence almost every day. ;) > ' I firmly believe one should strive daily for this sort of perfection. > I wanted a little image-processing tool and felt that Photoshop was > massive overkill (also, I don't have it anymore, and it's expensive). > > So I thought: It might be fun to write a little semi-interactive program > with an old-fashioned interface. > > This is Mac OS X, fwiw. > > The basic logic flow was: > > Read an image file > Loop: > Read a command via gets > Parse and execute the command > Display the resulting image > > Which works "mostly ok" -- but when I do img.display and it > opens a new window... the new window (naturally?) has the > focus -- I would say "steals" the focus from iTerm. > > Thinking about this, I suppose it relates more to the window > manager (and maybe ImageMagick and the OS) than to Ruby... > This is indeed a property of OS/X (or any other similar display manager, such as Windows, X, etc) > Having said that, I wonder if there is a solution to this, other than > constantly re-clicking in my original terminal window? I haven't written any native applications in ruby, but I imagine that after you call img.display from your program, you can steal back the focus in your REPL just before you read a command, but again, I'm not sure how you'd do this specifically. You'd probably need to send some message to raise the iTerm window. I know you could do something in AppleScript to do this, but again, not sure what, specifically. > > Thanks, > Hal >