Skip to content

Instantly share code, notes, and snippets.

@TheLexoPlexx
Last active April 4, 2024 10:34
Show Gist options
  • Select an option

  • Save TheLexoPlexx/3974b8538eea66e3cc0567612d375703 to your computer and use it in GitHub Desktop.

Select an option

Save TheLexoPlexx/3974b8538eea66e3cc0567612d375703 to your computer and use it in GitHub Desktop.
Work from Home Oled Mode Windows 10
# For all you people out there who occasionally work from home on an OLED but want to keep the wallpapers in the office.
#
# > Creates a file in your Userprofile named oled-mode-enabled (and deletes it later)
# > Sets the background to black and reverts it to the path you gave it. (See below)
# > Sets the screen timeout to 3 Minutes
# > Stops Explorer for a restart to take effect
#
# You might need to manually set the background to black once.
#
# DO NOT RUN UNCHECKED CODE FROM THE INTERNET.
# USE AT YOUR OWN RISK
# I AM NOT RESONSBILE FOR DAMAGE OR BURN-IN TO YOUR MONITOR, YOU OR YOUR CAT.
#
# ONLY TESTED IN WINDOWS 10
$oledModeFile = "$env:USERPROFILE\oled-mode-enabled"
if (Test-Path $oledModeFile) {
Remove-Item $oledModeFile
} else {
New-Item -Path $oledModeFile -ItemType File
}
$wallpaper_reg = @{Path = 'HKCU:\Control Panel\Desktop'; Name = 'Wallpaper'}
$wallpaper_filepath = "SET_YOUR_WALLPAPER_PATH_HERE___CHECK_THE_REGEDIT_AND_COPY_PATH_FROM_THERE_IF_YOU_ARE_LAZY"
if (Test-Path $oledModeFile) {
Set-ItemProperty @wallpaper_reg ''
}else {
Set-ItemProperty @wallpaper_reg $wallpaper_filepath
}
$location = @{Path = 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\StuckRects3'; Name = 'Settings'}
$value = Get-ItemPropertyValue @location
$value[8] = if ($value[8] -Eq 122) {123} Else {122}
Set-ItemProperty @location $value
if (Test-Path $oledModeFile) {
# Set shutoff time to 3 minutes
powercfg /change monitor-timeout-ac 3
powercfg /change monitor-timeout-dc 3
} else {
# Set shutoff time to never
powercfg /change monitor-timeout-ac 0
powercfg /change monitor-timeout-dc 0
}
Stop-Process -Name Explorer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment