I put the following code using the Xcode application into an init.m file that is auto-loaded at startup. I can now turn on WholeCellGroupOpeners using a shortcut. Works great.
FrontEndExecute[
AddMenuCommands[
"DuplicatePreviousOutput", {Delimiter,
MenuItem["OffWholeCellGroupOpener",
FrontEndExecute[
SetOptions[SelectedNotebook[], "WholeCellGroupOpener" -> True]],
MenuKey["w", Modifiers -> {"Control"}],
System`MenuEvaluator -> Automatic]}]]
I would like to make the control more usable by making the same Control+w toggle between True and False states.
I tried substituting in
"WholeCellGroupOpener" -> !CurrentValue@Options[SelectedNotebook[], "WholeCellGroupOpener"]
For some reason this code works as expected inside a regular .nb file but fails to work in the init.m file where I need it. Any ideas? Does it have something to do with global namespaces?