Saagar Jha

> On Jun 10, 2020, at 13:52, Ken Thomases via Cocoa-dev 
> <cocoa-dev@lists.apple.com> wrote:
> 
> On Jun 9, 2020, at 8:11 AM, Gabriel Zachmann <z...@cs.uni-bremen.de> wrote:
>> 
>>> In particular, you're not taking into account the current screen resolution 
>>> (a.k.a. display mode).  The user can select different scaling for a Retina 
>>> display in System Preferences > Displays.
>> 
>> Good point.
>> I wasn't taking that into consideration.
>> 
>> So, what would be a robust way to determine whether or not a window (as 
>> reported by "System Events") has a fullscreen size?
>> 
>> Or is there another way to determine whether or not an app is in fullscreen?
>> 
>>> First, you're going to have to explain exactly what you're planning to do 
>>> with the results of your calculation.  Do you really want the physical 
>>> screen size?  Or do you want the size of the 
>> 
>> I only want to have a little shell script 
>> (or other little utility ) that runs inconspicuously in the background (or 
>> in the top right menu bar) and launches a specific app once the user has 
>> been inactive for a while,
>> UNLESS there is another app running at the moment in fullscreen.
>> 
>> Does anyone have some code they could share?
> 
> You could do, for example:
> 
> python -c 'import AppKit ; print 
> AppKit.NSScreen.screens()[0].frame().size.width'

Note that this will make the Python rocket ship pop into your Dock for a split 
second, so I’m not sure I could call this “inconspicuous” :P

(Also, if you, like me, have another Python installed on your system, make sure 
you’re not using that when trying the code above as it’s unlikely to work.)

> 
> Similarly for height.
> 
> Regards,
> Ken
> 
> _______________________________________________
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/saagar%40saagarjha.com
> 
> This email sent to saa...@saagarjha.com

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to