racket/gui fn that returns width of O.S. toolbar?

25 views
Skip to first unread message

Don Green

unread,
Aug 6, 2021, 9:03:20 AM8/6/21
to Racket Users
Is there a racket/gui fn that returns width of an Operating System vertical toolbar?

In linux and I imagine on Windows and macOS, when there exists a vertical OS toolbar the values returned by get-display-size and get-client-size are the same and are insufficient.

So,
Is there a racket/gui fn that returns width of an Operating System vertical toolbar?
Thanks

James Platt

unread,
Aug 6, 2021, 4:35:26 PM8/6/21
to Racket Users
> In linux and I imagine on Windows and macOS, when there exists a vertical OS toolbar the values returned by get-display-size and get-client-size are the same and are insufficient.

The macOS version, at least, is draggable so there can be different widths on different Finder windows at the same time. You can get the info by shelling out to the command line if that's a possibility for you.

$osascript -e 'tell application "Finder" to get the sidebar width of Finder window 1'

or

$osascript -e 'tell application "Finder" to get the sidebar width of front Finder window'

or

$defaults read com.apple.finder | grep SidebarWidth

Note that this gives a list of results but I am not clear on whether they are all default values or values for current windows or, more likely, some of each. The file com.apple.finder is a plist file which is a form of xml so you might even read the file directly into Racket and parse it.

I would not be at all surprised if there are multiple other ways to get the info from the command line.

James
Reply all
Reply to author
Forward
0 new messages