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

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

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

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

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

Re: Points vs pixels in a bash script

2020-06-09 Thread Alex Zavatone via Cocoa-dev
Don’t you need to find out what the pixels per inch of the display is first? At 72 dpi or ppi, a pixel = a point. Can you get that info first? > On Jun 8, 2020, at 4:43 PM, Gabriel Zachmann via Cocoa-dev > wrote: > > I know this mailing list might not be the perfect fit for my question,

Re: Points vs pixels in a bash script

2020-06-09 Thread Gabriel Zachmann via Cocoa-dev
> you're not taking into account the current screen resolution (a.k.a. display > mode). The user > [...] > necessarily have to build a C utility for it. You can invoke the Swift > interpreter to execute Thanks a lot for your hints, but unfortunately , I don't have the time to learn Swift

Re: Points vs pixels in a bash script

2020-06-09 Thread Gabriel Zachmann via Cocoa-dev
> 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

Re: Points vs pixels in a bash script

2020-06-09 Thread Gabriel Zachmann via Cocoa-dev
> > I don’t have an answer to your question, but to add some clarity Points are > scale factor independent unit of measurement. On a retina display there are > 2 pixels per point. On a non-retina display there is 1 pixel per point. Say > Apple comes out with a display with a scale Thanks

Re: Points vs pixels in a bash script

2020-06-08 Thread Ken Thomases via Cocoa-dev
Except that Apple specifically says they're not. From High Resolution Guidelines for OS X

Re: Points vs pixels in a bash script

2020-06-08 Thread Jeff Younker via Cocoa-dev
Just as an aside, points are not Apple-specifc. They are a typesetting unit equivalent to 1/72 of an inch. It's the same unit used for font sizes. -jeff On Mon, Jun 8, 2020 at 2:43 PM Gabriel Zachmann via Cocoa-dev < cocoa-dev@lists.apple.com> wrote: > I know this mailing list might not be the

Re: Points vs pixels in a bash script

2020-06-08 Thread Carl Hoefs via Cocoa-dev
Note that your AppleScript returns the size of ALL monitors combined. With four 1920x1080 monitors in a 2x2 arrangement it shows: 0, 0, 3840, 2160 -Carl > On Jun 8, 2020, at 3:44 PM, Marco S Hyman via Cocoa-dev > wrote: > > Using >> system_profiler SPDisplaysDataType >> I can retrieve

Re: Points vs pixels in a bash script

2020-06-08 Thread Steve Christensen via Cocoa-dev
I don’t have an answer for your question, and I know that this doesn’t actually answer it below, but it may still provide some info to help you move forward. The windowing system is always working in points from a coordinates point of view. So window.frame and view.frame are in points, not

Re: Points vs pixels in a bash script

2020-06-08 Thread Marco S Hyman via Cocoa-dev
Using > system_profiler SPDisplaysDataType > I can retrieve the size of a Mac's display in pixels. > > However, the command > > tell application "System Events" to get the size of every window of every > process tell application “Finder” set screen_resolution to bounds of window of

Re: Points vs pixels in a bash script

2020-06-08 Thread Ken Thomases via Cocoa-dev
On Jun 8, 2020, at 4:43 PM, Gabriel Zachmann via Cocoa-dev wrote: > > I have a problem converting points (I think) to pixels in a bash script. > I'd rather not write an extra C/Cocoa utility for that. > > Using > system_profiler SPDisplaysDataType > I can retrieve the size of a Mac's display

Re: Points vs pixels in a bash script

2020-06-08 Thread Rob Petrovec via Cocoa-dev
I don’t have an answer to your question, but to add some clarity Points are scale factor independent unit of measurement. On a retina display there are 2 pixels per point. On a non-retina display there is 1 pixel per point. Say Apple comes out with a display with a scale factor of 17. That

Points vs pixels in a bash script

2020-06-08 Thread Gabriel Zachmann via Cocoa-dev
I know this mailing list might not be the perfect fit for my question, but maybe someone has an idea. I have a problem converting points (I think) to pixels in a bash script. I'd rather not write an extra C/Cocoa utility for that. Using system_profiler SPDisplaysDataType I can retrieve the