In a similar, but not duplicate, vein to Listening to music with MacBooks lid closed, I'd like to be able to listen to music with my 2019 MacBook Pro's lid closed. But I can't accept the compromise of losing the automatic screen lock by simply having the MacBook not go to sleep.
In contrast, if I activate screen lock manually (I have it mapped to the Touch Bar, so through whatever mechanism that is), my music keeps playing. I can play/pause it using the touchbar or my Bluetooth headphones and control volume this way too. This is exactly the experience I want to have, but I want to be able to have it with the lid closed.
It would appear that pmset
, which is what lets you disable sleep on lid close, is not the only family of tools I want here, because it is about managing power states and not about monitoring any hardware events per se. I don't really care what power state my MacBook is in when the lid is closed. (I mean I hope it's not hogging the battery too bad just playing some audio, but I don't have any hard drives I'm worried about being in use while moving it around or anything like that - it doesn't need to be asleep and I trust it to not burn itself up that way because this is a nice operating system.) I just want lid close to trigger a screen lock, basically, and also not a sleep.
Under Linux-y type environments this can be achieved (not sure how but I know there are lid events for dbus, which is part of the backbone of all modern Linux display managers), but I'm clueless as to how to achieve this particular thing.