Re: Points vs pixels in a bash script

2020-06-10 Thread Gabriel Zachmann via Cocoa-dev

> 
> python -c 'import AppKit ; print 
> AppKit.NSScreen.screens()[0].frame().size.width'
> 


Thanks a million! that even works for multi-monitor setups correctly.


>> tells me the resolution of the screen in the same units (of course) as
> 
> This will not work if you have multiple monitors attached.
> 

Thanks a lot for the hint - you are right, of course.

Best, G.



smime.p7s
Description: S/MIME cryptographic signature
___

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


Re: Points vs pixels in a bash script

2020-06-10 Thread Saagar Jha via Cocoa-dev

Saagar Jha

> On Jun 10, 2020, at 13:52, Ken Thomases via Cocoa-dev 
>  wrote:
> 
> On Jun 9, 2020, at 8:11 AM, Gabriel Zachmann  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


Re: Points vs pixels in a bash script

2020-06-10 Thread Ken Thomases via Cocoa-dev
On Jun 9, 2020, at 8:11 AM, Gabriel Zachmann  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'

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/archive%40mail-archive.com

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


Re: Points vs pixels in a bash script

2020-06-10 Thread Clark Cox via Cocoa-dev



> On Jun 10, 2020, at 12:06 PM, Gabriel Zachmann via Cocoa-dev 
>  wrote:
> 
> For the record: I believe I have found a solution:
> 
>  tell application "Finder" to get bounds of window of desktop
> 
> tells me the resolution of the screen in the same units (of course) as

This will not work if you have multiple monitors attached.

For example, on my machine, at the moment, it returns:

"{-1792, -366, 6720, 1890}"


> 
>  tell application "System Events" to get the title of every window of every 
> process
> 
> lateron.
> 
> Thanks again to everyone who chimed in.
> 
> 
> ___
> 
> 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/clarkcox3%40gmail.com
> 
> This email sent to clarkc...@gmail.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


Re: Points vs pixels in a bash script

2020-06-10 Thread Gabriel Zachmann via Cocoa-dev
For the record: I believe I have found a solution:

  tell application "Finder" to get bounds of window of desktop

tells me the resolution of the screen in the same units (of course) as

  tell application "System Events" to get the title of every window of every 
process

lateron.

Thanks again to everyone who chimed in.




smime.p7s
Description: S/MIME cryptographic signature
___

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


How to sample MTLPixelFormatR32Float in Metal buffers and/or textures?

2020-06-10 Thread Demitri Muna via Cocoa-dev
Hi,

I have float array data that I want to use to create images in Metal. My plan 
is to apply one or more shaders to the data, then render it into a new RGB 
texture and continue from there. I’m using MTLPixelFormatR32Float as the source 
pixel format with success.

In all the kernel examples I see the sampler returns a float4, which is 
appropriate for an RGBA format. But my source data/format has no color. What is 
the equivalent for sampling single float values?

I’m currently putting the source data into a 2D texture. Given the use case 
above, does it make sense to use a MTLBuffer instead and then render that into 
a new 2D MTLTexture?

Thanks!
Demitri

___

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