-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rewrite dock detection and handling #22
Comments
Here's something weird: If you use set prefsFile to ((path to preferences from user domain) as text) & "com.apple.dock.plist"
tell application "System Events"
set _dockSize to (value of property list item "tilesize" of property list file prefsFile)
end tell I'd be happy to take this issue on and try out some different solutions to rework the dock handling :) |
Oh wow, that looks awesome! But, it returns 64 for me, while my dock has 80px 😕 Anyway, if there's any way to convert this number to true pixel values, then the whole thing is nearly solved! |
The value is different because it's an icon size as far as I can see. We have to figure out whether the remaining 16px is constant or not. I've also found this snippet: tell application "System Events" to tell process "Dock"
set dock_dimensions to size in list 1
set dock_width to item 1 of dock_dimensions
set dock_height to item 2 of dock_dimensions
end tell which works perfectly, but requires assistive access. |
@ezig Let's move the discussion here. I've done some measurements and put them in google spreadsheet. I hope that they're consistent across screen proportions. What kind of mac do you have @ezig? https://docs.google.com/spreadsheets/d/1eScVnzvKZINspm_4Ky6FmtYpubE6Svci-0DDAscTixw/edit?usp=sharing It looks promising. If it's similar on different resolutions then we can just use some kind of a lookup table. I can write a script to make it even more fine grained later. The blue line was recorded in 1440x900, the orange one is 1920x1200, and the red one is what was read from .plist preferences (it was consistent across resolutions). |
I'm using a 2013 15" Macbook Pro with retina. A lookup table seems like it would work if there was enough data, as long as things are pretty consistent for different resolutions. It seems like there should be an easier way to do this (without needing accessibility), but we haven't found it yet 😕 . |
I now think that the lookup table might not be such a good idea, because the number of icons in the dock affects it's size too... It doesn't seem reliable (unless we find a formula - the icons are listed in plist file as well). |
It seems like the Objective-C utility might be the most reliable things we have for now? The AppleScript alternatives we've found don't seem any more reliable. |
I have no idea why, but suddenly |
I think that modifying the dock properties with AppleScript somehow messes up the values of |
I've changed a bit in 9e9ac33 and it seems to be better now. I'm getting much more consistent behaviour now. What's left to be done is to write a better fallback in case something goes wrong. |
The whole dock logic has to be rewritten. It's too hacky now. There are too many magic constants and unreliable ways of detecting it's position.
@ezig I'd be grateful for any hints 😊 Thanks for your help with all these issues!
The text was updated successfully, but these errors were encountered: