on KDE Plasma on Linux (and BSDs), the Power Management widget or taskbar item has a toggle to Manually Block Sleep and Screen Locking, which prevents time-based and lid-based sleep and locking. in the settings app at System > Power Management you can set what to do when the lid is closed, with separate profiles for when plugged in, on battery, or on low battery. kde is very customizable and fully featured, would recommend
on KDE Plasma on Linux (and BSDs), the Power Management widget or taskbar item has a toggle to Manually Block Sleep and Screen Locking, which prevents time-based and lid-based sleep and locking. in the settings app at System > Power Management you can set what to do when the lid is closed, with separate profiles for when plugged in, on battery, or on low battery. kde is very customizable and fully featured, would recommend
I usually set it so that if it’s plugged in it remains on until I say goto sleep