Re: Points vs pixels in a bash script
Re: Points vs pixels in a bash script
- Subject: Re: Points vs pixels in a bash script
- From: Saagar Jha via Cocoa-dev <email@hidden>
- Date: Wed, 10 Jun 2020 13:56:45 -0700
Saagar Jha
> On Jun 10, 2020, at 13:52, Ken Thomases via Cocoa-dev
> <email@hidden> wrote:
>
> On Jun 9, 2020, at 8:11 AM, Gabriel Zachmann <email@hidden> 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 (email@hidden)
>
> 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:
>
> This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden