Question / Help OBS Prevents screen sleep, any work around?

sta

New Member
I use OBS for the Replay Buffer function, so OBS was always running and preventing sleep.

If you have the 64 bit version the solution I found was to open the Command Prompt as administrator and use this command:
powercfg -requestsoverride process obs64.exe display system awaymode

You'll know if you did it right if you use powercfg -requestsoverride and see
"obs64.exe DISPLAY SYSTEM AWAYMODE" under [PROCESS]

Hope this helps.
Hello,

Thank you. Solved my issue. Happy New year!
 

risacher

New Member
I had a similar problem, but on MacOS (12.7.1), and have been annoyed by this for the past 2 years. Today I had ChatGPT write me the following simple program, which I call "mac-idler":
Swift:
import Foundation
import CoreGraphics

// Function to execute 'pmset displaysleepnow'
func putDisplayToSleep() {
    let task = Process()
    task.launchPath = "/usr/bin/pmset"
    task.arguments = ["displaysleepnow"]
    task.launch()
}

// Main
if CommandLine.argc < 2 {
    print("Usage: DisplaySleepMonitor <idle time in seconds>")
    exit(1)
}

guard let thresholdSeconds = Double(CommandLine.arguments[1]) else {
    print("Invalid number format for idle time.")
    exit(1)
}

// Timer to check the idle time every second
Timer.scheduledTimer(withTimeInterval: 1.0, repeats: true) { _ in
    let idleTime = CGEventSource.secondsSinceLastEventType(.combinedSessionState, eventType: CGEventType(rawValue: UInt32.max)!)
    if idleTime >= thresholdSeconds {
        putDisplayToSleep()
    }
}

// Run the main loop
RunLoop.current.run()
 

Luuukie

New Member
I use OBS for the Replay Buffer function, so OBS was always running and preventing sleep.

If you have the 64 bit version the solution I found was to open the Command Prompt as administrator and use this command:
powercfg -requestsoverride process obs64.exe display system awaymode

You'll know if you did it right if you use powercfg -requestsoverride and see
"obs64.exe DISPLAY SYSTEM AWAYMODE" under [PROCESS]

Hope this helps.
This solution caused the video replay buffer to not save the video, how can I get it back?
 

raiy

New Member
I use OBS for the Replay Buffer function, so OBS was always running and preventing sleep.

If you have the 64 bit version the solution I found was to open the Command Prompt as administrator and use this command:
powercfg -requestsoverride process obs64.exe display system awaymode

You'll know if you did it right if you use powercfg -requestsoverride and see
"obs64.exe DISPLAY SYSTEM AWAYMODE" under [PROCESS]

Hope this helps.

Dude, i was looking for a solution for this for AGES, i previously tried something similar in CMD to override it but it must have been a different command and didn't work, but with yours it works pretty well.

I can now have the PC sleep automatically if i'm AFK for specific duration of time, and when i resume the replay buffer still works albeit somewhat slower, to fix this one can simply restart replay buffer manually. Windows own sleep function does not seem to work, so i use a AutoHotkey script instead.
 

RubberDuckyDJ

New Member
I use OBS for the Replay Buffer function, so OBS was always running and preventing sleep.

If you have the 64 bit version the solution I found was to open the Command Prompt as administrator and use this command:
powercfg -requestsoverride process obs64.exe display system awaymode

You'll know if you did it right if you use powercfg -requestsoverride and see
"obs64.exe DISPLAY SYSTEM AWAYMODE" under [PROCESS]

Hope this helps.
You are fr my hero
I made this account just so I could thank you.
 
Top