Dear @eskimo,
I got your point, and I'm going to change my mindset with the alternative solution below:
I have tried to use the UserDefault to get its information (dock orientation) :
if let defaults = UserDefaults(suiteName: "com.apple.dock"),
let orientation = defaults.string(forKey: "orientation")
But It is not reliable. Sometimes It got, sometime it didn't.
I have double-checked with the Terminal:
[Restored 1 Mar 2024 at 09:06:03]
(base) macos ~ % defaults read com.apple.dock
{
"mod-count" = 1035;
}
(base) macos ~ % defaults read com.apple.dock autohide
2024-03-01 09:07:28.641 defaults[24181:525841]
The domain/default pair of (com.apple.dock, autohide) does not exist
(base) macos ~ % defaults read com.apple.dock
{
mineffect = genie;
"mod-count" = 1040;
orientation = bottom;
}
(base) macos ~ % defaults read com.apple.dock autohide
2024-03-04 10:13:44.931 defaults[38656:1061252]
The domain/default pair of (com.apple.dock, autohide) does not exist
I expect not to use scripts as little as possible.
Topic:
App & System Services
SubTopic:
Core OS
Tags: