Date
1 - 11 of 11
zoomed attribute of tabbed fullscreen windows
2551phil
We can use origin and position instead, so long as you have only one monitor, this should work. If you have an external display connected, you’ll have to test for the orig/pos of that display as well. set wps to {} set fs to "" set fsList to {} set msg to "" tell application "Terminal" repeat with i from 1 to count of its windows set this_win to item i of its windows if this_win's position is {0, 0} then if this_win's origin is {0, 0} then set fs to this_win's name set end of fsList to fs end if end if set end of wps to {this_win's origin, this_win's position} end repeat end tell repeat with i from 1 to count of fsList set msg to msg & fs & return end repeat display dialog msg with title "Terminal Full Screen Windows" buttons "OK" default button "OK" Best Phil @sqwarq |
|
2551phil
A slightly less-rough ’n’ ready version: set fs to "" set fsList to {} set msg to "No windows in full screen." tell application "Terminal" repeat with i from 1 to count of its windows set this_win to item i of its windows if this_win's position is {0, 0} then if this_win's origin is {0, 0} then set fs to this_win's name set end of fsList to fs end if end if end repeat end tell if (count of fsList) is greater than 0 then set msg to "" repeat with i from 1 to count of fsList set msg to msg & fs & return end repeat end if display dialog msg with title "Terminal Full Screen Windows" buttons "OK" default button "OK" Best Phil @sqwarq |
|
2551phil
Cool, but I’d like to explore this is a bit further as it’s a specific example of a more general problem that could do with a solution: how to determine which apps/windows are in full screen across multiple displays? As a proof of concept, the following works here on a dual display setup with multiple spaces. It correctly returned the full screen windows for all my running apps. It also appears to cope with split screen situations, too. I’m sure Shane or others can improve upon my sloppy scripting style though. :p use AppleScript version "2.4" -- Yosemite (10.10) or later use scripting additions ####################### -->> VARIABLES ####################### set fullScreenApps to {} set msg to "None" ####################### -->> HANDLERS ####################### on hasFullScreen:theApp forWindow:aWin set theReply to {false, 0, missing value} tell application theApp try set yPos to item 2 of (get bounds of window aWin) on error set yPos to 1 end try if yPos is 0 then try set winName to window aWin's name on error set winName to missing value end try set theReply to {true, aWin, winName} end if end tell return theReply end hasFullScreen:forWindow: on getVisibleProcs() set visibleProcs to {} tell application "System Events" set procs to every application process repeat with i from 1 to count of procs set this_proc to item i of procs try if this_proc's visible is true then set end of visibleProcs to this_proc's name end if end try end repeat end tell return visibleProcs end getVisibleProcs ####################### -->> COMMANDS ####################### set currentApps to getVisibleProcs() repeat with a from 1 to count of currentApps set this_app to currentApps's item a try tell application this_app set wc to count of its windows repeat with w from 1 to wc set hasFs to (my hasFullScreen:this_app forWindow:w) if hasFs's item 1 is true then set end of fullScreenApps to {this_app, hasFs's item 2, hasFs's item 3} end if end repeat end tell end try end repeat if (count of fullScreenApps) is greater than 0 then set msg to "" repeat with i from 1 to count of fullScreenApps set this_item to item 1 of item i of fullScreenApps as text set this_item to this_item & "'s Window " & item 2 of item i of fullScreenApps as text set this_item to this_item & ": " & item 3 of item i of fullScreenApps as text set msg to msg & this_item & return end repeat end if display dialog msg with title "Windows that are in full screen" buttons "OK" default button "OK" Best Phil @sqwarq |
|
2551phil
With the exception of Script Debugger and Script Editor, I see now. Interestingly, both these have item 1 of their bounds set to 0 when in Full Screen rather than item 2. I’ll need to do a bit more testing, but perhaps testing for either item 1 or item 2 being 0 might solve that, so long as it’s not possible for either to be 0 when not in full screen. Best Phil @sqwarq
|
|
2551phil
Back to the drawing board. Looks like BBEdit doesn’t play by the 0 bounds rule for either position.
toggle quoted message
Show quoted text
|
|
2551phil
Yes, I see that now. I have my Dock set vertically on the left hand side and that prevented me from seeing the false positives. One could test for the size of the display and the size of the window and see fi there’s a regular correlation across apps in full screen, as well as whether the Dock is visible or not.
toggle quoted message
Show quoted text
I’ll have a bit more of a play around with it later. Best Phil @sqwarq
|
|
2551phil
Yes, I noticed that yesterday, but I assume that property changes depending on which window is front most. I haven’t had a look at the SO page yet, but thanks for pointing it out. I’ll look into it later on. Best Phil @sqwarq |
|
2551phil
AXFullScreen isn’t much use to use for reasons the poster points out - it’s too limited. I don’t see anything else in the scripts there that we haven’t already established here. It may well be that a full answer here is going to have to combine all the various different strategies that we’ve been discussing, including using NSScreen to get the display size(s) and comparing that to window frame sizes. Best Phil @sqwarq |
|
2551phil
This returns 0,0 only when in full screen here: tell application "BBEdit" window 1's position end tell Best Phil @sqwarq |
|
Jean-Christophe Helary <jean.christophe.helary@...>
You're right. It looks like there is a lag between the moment the window changes status and the moment Script Debugger's Explorer gets the value, at leat on my machine... Jean-Christophe |
|
Jean-Christophe Helary <jean.christophe.helary@...>
On Oct 15, 2017, at 20:54, Jean-Christophe HelaryWell, it looks like I was either wrong or not looking at the right thing, or maybe SB was busy and did not update the values right away, but now that I am checking, there is no significant lag between the modification and the display...You're right. It looks like there is a lag between the moment the window changes status and the moment Script Debugger's Explorer gets the value, at leat on my machine...BBEdit's weirdness: regardless of whether the window is new (default size) or fullscreen BBEdit's windows keep the same bounds ({0, 22, 1009, 800} on my screen). Position is thus {0, 22} regardless of the state of the window.This returns 0,0 only when in full screen here: Jean-Christophe |
|