Re: zoomed attribute of tabbed fullscreen windows


2551phil
 


On 15 Oct 2017, at 15:05, 2551phil <2551phil@...> wrote:

It correctly returned the full screen windows for all my running apps.


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




On 15 Oct 2017, at 15:05, 2551phil <2551phil@...> wrote:


On 14 Oct 2017, at 18:41, Jean-Christophe Helary <jean.christophe.helary@...> wrote:

I think I found a simple solution


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

Join applescript@apple-dev.groups.io to automatically receive all group messages.