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
- Never had Focus mode on before
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
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