V4.0.0-beta3 Focus Mode #237
Replies: 6 comments
-
Thanks for your research.... however... in your testing you were not running as Here is the output I got just right now on macOS 13 after enabling DND and then waiting a minute or two.
Fun fact... if you remove the pipe to grep you can actually see exactly what kind of DND they have enabled.
If you can replicate after waiting a few minutes then I would consider re-evaluating that line, but in all of my testing, as long as I wait a few minutes, I can't replicate this issue. |
Beta Was this translation helpful? Give feedback.
-
Hi Kevin, Thanks for reminding me that the script was running as root. The reason I brought this up was I had manually set up Focus mode to test that feature and as the pop-up was still coming up I was looking deeper. I retested as root and gave some time. Monterey again gave a 1 straight away. With Ventura it was time as you said but quite a long time: Turned Focus Mode ON at Wed 11 Oct 2023 08:38:54 AWST itadmin@dep59767 ~ % sudo -s So it finally flipped to 1 after about an hour. The odd thing is that I tried what you suggested and looked at that file, Assertions.json, as root when the command was outputting 0 in another Terminal window: root@dep59767 ~ # date So I was able to read the file with "less" And then when the Focus Mode was reflected in the output as a 1: root@dep59767 ~ # plutil -extract data.0.storeAssertionRecords.0.assertionDetails.assertionDetailsModeIdentifier raw -o - "/Users/${current_user_account_name}/Library/DoNotDisturb/DB/Assertions.json" All very odd This was all on Ventura. I'll continue to look but I've got to get on with a few other things. These Ventura machines are very clean machines but do have our standard build on them. I might try and exclude everything (e.g. config profiles and not install extra software) and test again to eliminate that as a possibility |
Beta Was this translation helpful? Give feedback.
-
So ... park this and I'll get back to you. Logic says it must be something I've done as your experience is different |
Beta Was this translation helpful? Give feedback.
-
I've made an exclusion group and added one of the test machines to that. The exclusion group is in the exclusion tab of each config profile that we've created except for the ones created for super and the ones jamf inserts - MDM Profile, Jamf Notifications. I then wiped and reinstalled Mac OS 13.5. It's in DEP so autoenrolled. No other software was installed. I then flushed the deployment policy for super for the machine and super installed on the next check in. Behaviour of that command plutil -extract data.0.storeAssertionRecords.0.assertionDetails.assertionDetailsModeIdentifier raw -o - "/Users/${current_user_account_name}/Library/DoNotDisturb/DB/Assertions.json" | grep -ic 'com.apple.' is still producing 0 even though it's been in the manual Focus mode which was enabled from the menu bar at the top right of the screen for almost 45 minutes. Ah well. Not a showstopper. If I think of anything more will let you know |
Beta Was this translation helpful? Give feedback.
-
Thanks for your testing... but this behavior has nothing to do with how "clean" the computer is or how it was enrolled. This is just an oddity in how that Assertions.json file is updated by macOS. Ideally there would be a more "formal" approach, but at this point I'm unaware of an alternative method that works consistently in |
Beta Was this translation helpful? Give feedback.
-
Changing this to "help wanted" to indicate that unless another more reliable method is provided, I don't plan to change this method. |
Beta Was this translation helpful? Give feedback.
-
Hi Kevin,
I'm new to super but the Focus behaviour on some of my test machines looks a bit odd. Basically Focus Mode when manually turned on via the menu bar seems to be ignored. This was initially with an intel and M1 machine running Ventura. I reported this in the slack channel but it's just a day so no response yet. So, I dug deeper, turned on verbose mode and looked at what it was saying when I toggled Focus Mode on and off manually.
I looked in the super script and found what appears to be the way you get the Focus status
plutil -extract data.0.storeAssertionRecords.0.assertionDetails.assertionDetailsModeIdentifier raw -o - "/Users/${current_user_account_name}/Library/DoNotDisturb/DB/Assertions.json" | grep -ic 'com.apple.'
I also did a bit of looking and another simpler way is
defaults read com.apple.controlcenter "NSStatusItem Visible FocusModes"
Below are some of my results for several different systems:
Mac OS 13.6
Intel CPU
Focus mode has never been turned on
Focus mode off
itadmin@dep49140 ~ % plutil -extract data.0.storeAssertionRecords.0.assertionDetails.assertionDetailsModeIdentifier raw -o - "/Users/itadmin/Library/DoNotDisturb/DB/Assertions.json" | grep -ic 'com.apple.'
0
itadmin@dep49140 ~ % defaults read com.apple.controlcenter "NSStatusItem Visible FocusModes"
2023-10-10 13:36:14.521 defaults[1336:11478]
The domain/default pair of (com.apple.controlcenter, NSStatusItem Visible FocusModes) does not exist
Now turn on Focus mode
itadmin@dep49140 ~ % defaults read com.apple.controlcenter "NSStatusItem Visible FocusModes"
1
itadmin@dep49140 ~ % plutil -extract data.0.storeAssertionRecords.0.assertionDetails.assertionDetailsModeIdentifier raw -o - "/Users/itadmin/Library/DoNotDisturb/DB/Assertions.json" | grep -ic 'com.apple.'
0
Now turn Off Focus mode
itadmin@dep49140 ~ % defaults read com.apple.controlcenter "NSStatusItem Visible FocusModes"
0
itadmin@dep49140 ~ % plutil -extract data.0.storeAssertionRecords.0.assertionDetails.assertionDetailsModeIdentifier raw -o - "/Users/itadmin/Library/DoNotDisturb/DB/Assertions.json" | grep -ic 'com.apple.'
0
Mac OS 12.7
Intel CPU
Focus Mode Off
plutil -extract data.0.storeAssertionRecords.0.assertionDetails.assertionDetailsModeIdentifier raw -o - "/Users/00068802/Library/DoNotDisturb/DB/Assertions.json" | grep -ic 'com.apple.'
0
defaults read com.apple.controlcenter "NSStatusItem Visible FocusModes"
0
Focus Mode On
is-m-00142:~ 00068802$ plutil -extract data.0.storeAssertionRecords.0.assertionDetails.assertionDetailsModeIdentifier raw -o - "/Users/00068802/Library/DoNotDisturb/DB/Assertions.json" | grep -ic 'com.apple.'
1
is-m-00142:~ 00068802$ defaults read com.apple.controlcenter "NSStatusItem Visible FocusModes"
1
Mac OS 11.7.6
Intel CPU
Focus Mode OFF
Last login: Sun Jan 1 08:22:50 on console
itadmin@is-m-00051 ~ % plutil -extract data.0.storeAssertionRecords.0.assertionDetails.assertionDetailsModeIdentifier raw -o - "/Users/itadmin/Library/DoNotDisturb/DB/Assertions.json" | grep -ic 'com.apple.'
Unknown format specifier: raw
plutil: [command_option] [other_options] file...
The file '-' means stdin
Command options are (-lint is the default):
-help show this message and exit
-lint check the property list files for syntax errors
-convert fmt rewrite property list files in format
fmt is one of: xml1 binary1 json swift objc
note: objc can additionally create a header by adding -header
-insert keypath -type value insert a value into the property list before writing it out
keypath is a key-value coding key path, with one extension:
a numerical path component applied to an array will act on the object at that index in the array
or insert it into the array if the numerical path component is the last one in the key path
type is one of: bool, integer, float, date, string, data, xml, json
-bool: YES if passed "YES" or "true", otherwise NO
-integer: any valid 64 bit integer
-float: any valid 64 bit float
-string: UTF8 encoded string
-date: a date in XML property list format, not supported if outputting JSON
-data: a base-64 encoded string
-xml: an XML property list, useful for inserting compound values
-json: a JSON fragment, useful for inserting compound values
value YES, NO, a number, a date, or a base-64 encoded blob of data
-replace keypath -type value same as -insert, but it will overwrite an existing value
-remove keypath removes the value at 'keypath' from the property list before writing it out
-extract keypath fmt outputs the value at 'keypath' in the property list as a new plist of type 'fmt'
fmt is one of: xml1 binary1 json
-p print property list in a human-readable fashion
(not for machine parsing! this 'format' is not stable)
There are some additional optional arguments that apply to the -convert, -insert, -remove, -replace, and -extract verbs:
-s be silent on success
-o path specify alternate file path name for result;
the -o option is used with -convert, and is only
useful with one file argument (last file overwrites);
the path '-' means stdout
-e extension specify alternate extension for converted files
-r if writing JSON, output in human-readable form
-- specifies that all further arguments are file names
0
itadmin@is-m-00051 ~ % defaults read com.apple.controlcenter "NSStatusItem Visible FocusModes"
2023-01-01 08:37:03.099 defaults[1412:18697]
The domain/default pair of (com.apple.controlcenter, NSStatusItem Visible FocusModes) does not exist
Focus Mode On
itadmin@is-m-00051 ~ % plutil -extract data.0.storeAssertionRecords.0.assertionDetails.assertionDetailsModeIdentifier raw -o - "/Users/itadmin/Library/DoNotDisturb/DB/Assertions.json" | grep -ic 'com.apple.'
Unknown format specifier: raw
plutil: [command_option] [other_options] file...
The file '-' means stdin
Command options are (-lint is the default):
-help show this message and exit
-lint check the property list files for syntax errors
-convert fmt rewrite property list files in format
fmt is one of: xml1 binary1 json swift objc
note: objc can additionally create a header by adding -header
-insert keypath -type value insert a value into the property list before writing it out
keypath is a key-value coding key path, with one extension:
a numerical path component applied to an array will act on the object at that index in the array
or insert it into the array if the numerical path component is the last one in the key path
type is one of: bool, integer, float, date, string, data, xml, json
-bool: YES if passed "YES" or "true", otherwise NO
-integer: any valid 64 bit integer
-float: any valid 64 bit float
-string: UTF8 encoded string
-date: a date in XML property list format, not supported if outputting JSON
-data: a base-64 encoded string
-xml: an XML property list, useful for inserting compound values
-json: a JSON fragment, useful for inserting compound values
value YES, NO, a number, a date, or a base-64 encoded blob of data
-replace keypath -type value same as -insert, but it will overwrite an existing value
-remove keypath removes the value at 'keypath' from the property list before writing it out
-extract keypath fmt outputs the value at 'keypath' in the property list as a new plist of type 'fmt'
fmt is one of: xml1 binary1 json
-p print property list in a human-readable fashion
(not for machine parsing! this 'format' is not stable)
There are some additional optional arguments that apply to the -convert, -insert, -remove, -replace, and -extract verbs:
-s be silent on success
-o path specify alternate file path name for result;
the -o option is used with -convert, and is only
useful with one file argument (last file overwrites);
the path '-' means stdout
-e extension specify alternate extension for converted files
-r if writing JSON, output in human-readable form
-- specifies that all further arguments are file names
0
itadmin@is-m-00051 ~ % defaults read com.apple.controlcenter "NSStatusItem Visible FocusModes"
2023-01-01 08:37:46.727 defaults[1424:19288]
The domain/default pair of (com.apple.controlcenter, NSStatusItem Visible FocusModes) does not exist
itadmin@is-m-00051 ~ %
So looks like both methods don't work on Mac OS 11
Mac OS 13.5
M1 CPU
Focus Mode Off
itadmin@dep59767 ~ % plutil -extract data.0.storeAssertionRecords.0.assertionDetails.assertionDetailsModeIdentifier raw -o - "/Users/itadmin/Library/DoNotDisturb/DB/Assertions.json" | grep -ic 'com.apple.'
0
itadmin@dep59767 ~ % defaults read com.apple.controlcenter "NSStatusItem Visible FocusModes"
0
Focus Mode ON
itadmin@dep59767 ~ % plutil -extract data.0.storeAssertionRecords.0.assertionDetails.assertionDetailsModeIdentifier raw -o - "/Users/itadmin/Library/DoNotDisturb/DB/Assertions.json" | grep -ic 'com.apple.'
0
itadmin@dep59767 ~ % defaults read com.apple.controlcenter "NSStatusItem Visible FocusModes"
1
Mac OS 12.6.8
Intel CPU
Focus Mode OFF
itadmin@is-m-00381 ~ % plutil -extract data.0.storeAssertionRecords.0.assertionDetails.assertionDetailsModeIdentifier raw -o - "/Users/itadmin/Library/DoNotDisturb/DB/Assertions.json" | grep -ic 'com.apple.'
0
itadmin@is-m-00381 ~ % defaults read com.apple.controlcenter "NSStatusItem Visible FocusModes"
2023-10-10 14:26:24.674 defaults[1440:9993]
The domain/default pair of (com.apple.controlcenter, NSStatusItem Visible FocusModes) does not exist
Focus Mode ON
itadmin@is-m-00381 ~ % plutil -extract data.0.storeAssertionRecords.0.assertionDetails.assertionDetailsModeIdentifier raw -o - "/Users/itadmin/Library/DoNotDisturb/DB/Assertions.json" | grep -ic 'com.apple.'
1
itadmin@is-m-00381 ~ % defaults read com.apple.controlcenter "NSStatusItem Visible FocusModes"
1
Focus Mode Off
itadmin@is-m-00381 ~ % plutil -extract data.0.storeAssertionRecords.0.assertionDetails.assertionDetailsModeIdentifier raw -o - "/Users/itadmin/Library/DoNotDisturb/DB/Assertions.json" | grep -ic 'com.apple.'
0
itadmin@is-m-00381 ~ % defaults read com.apple.controlcenter "NSStatusItem Visible FocusModes"
0
So it looks like
plutil -extract data.0.storeAssertionRecords.0.assertionDetails.assertionDetailsModeIdentifier raw -o - "/Users/${current_user_account_name}/Library/DoNotDisturb/DB/Assertions.json" | grep -ic 'com.apple.'
In check_user_focus() on line 3653 works in Mac OS 12 but not 13 or 11
Beta Was this translation helpful? Give feedback.
All reactions