macos sometimes thinks my M1 Macbook Air has a touch bar
Sometimes MacOS thinks my M1 Macbook Air has a touch bar, and sometimes it doesn't. It's annoying, because I made an app using Automator to created a keyboard shortcut to check/uncheck "Use F1, F2, etc. keys" but the shortcut won't work when the menu title option keeps changing to "Use F1, F2, etc. keys as standard function keys on external keyboards".
Any fix or any ideas as to what causes MacOS to think it has a touch bar?
When MacOS thinks the M1 Macbook Air has a touch bar:
And when MacOS doesn't think the M1 Macbook Air has a touch bar (as it should):
MacBook Air 13″, macOS 11.5