Re: Maximize/Restore window on OS X (aka Zoom)

From: Rob <ro....at.web.de>
Date: Sun, 22 Feb 2009 02:11:39 -0800 (PST)

Vais,

on OS X I use an Applescript to zoom the frontmost window that came as
a plugin for Quicksilver:

tell application "System Events"
        tell (the first process whose frontmost is true)
                tell window 1
                        click (the first button whose subrole is "AXZoomButton")
                end tell
        end tell
end tell

This works for all app including Firefox, but not for Textadept. Maybe
this helps you.
I would be interested if you find something for Textadept. It would be
nice to have a shortcut to set the window to half screen/maximized.

Robert

On Feb 17, 2:24 am, vais <vsalik....at.gmail.com> wrote:
> Come to think of it, being able to get and set window position from
> Lua would help Alex's issue with having TA always open in the same
> place as last time it was closed. He could then just add another line
> to save_session and load_session to restore previous position. Unless
> it is prohibitively complex, the more scriptability the better IMHO.
>
> Vais
>
> On Feb 16, 2:02 pm, vais <vsalik....at.gmail.com> wrote:
>
> > Nope. Just tried that, no such luck. I think it has to do with the way
> > the GTK top level menu works under OSX - not quite like native apps.
> > This is why I figured rolling my own version of this functionality is
> > more likely to succeed. Here is what I ended up doing - hard-code my
> > screens dimensions and be done with it :)
>
> > Here is the final result that works for my MacBook Pro (I stuck it
> > directly into my key_commands file):
>
> > keys['sam'] = { function()
> >   if textadept.original_size then
> >     textadept.size = textadept.original_size
> >     textadept.original_size = nil
> >   else
> >     textadept.original_size = textadept.size
> >     textadept.size = {1436, 856}
> >   end
> > end }
>
> > Only to realize, of course, that this only works when the window is
> > positioned with the top left corner in the top left corner of the
> > screen :) In other words, this does not work.
>
> > In order to make this work there has to be a way of getting
> > Textadept's window's position on screen as well as the dimensions of
> > the screen.
>
> > I must give up on this for now.
>
> > Thanks,
>
> > Vais
>
> > On Feb 16, 1:43 pm, mitchell <mforal.n....at.gmail.com> wrote:
>
> > > Vais,
>
> > > > It is the "screen.width, screen.height" part that I am not sure how to
> > > > get at. Is this information available? Perhaps there is something like
> > > > this available in GTK that can be exposed to scripting?
>
> > > Oh sorry, I read your question too fast. I don't know if GTK has
> > > access to the screen.
>
> > > I'm not sure how OSX handles key commands, but since keys.am is
> > > assigned to multiple line editing, maybe re-assigning it will let OSX
> > > handle apple+m?
>
Received on Sun 22 Feb 2009 - 05:11:39 EST

This archive was generated by hypermail 2.2.0 : Thu 08 Mar 2012 - 11:37:27 EST