Advertisement
aveyo

steam_silent

Apr 19th, 2018 (edited)
18,358
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 4.09 KB | None | 0 0
  1. @echo off &color 0f &mode 80,1 &title Steam minigameslist silent startup replacement shortcut
  2. :: [2019.11.12]:  goes straight to systray icon, and will switch new Library to mini mode
  3. :: [2021.04.27]:  added -cef-single-process to limit steamwebhelper processes to 2 (host + content)
  4. :: [2022.02.06]:  removed -cef-single-process as it started breaking Library (Large) at some point
  5.  
  6. rem get STEAMPATH
  7. for /f "skip=2 tokens=2*" %%R in ('reg query HKCU\SOFTWARE\Valve\Steam /v SteamPath') do set "STEAMPATH=%%S"
  8. if defined STEAMPATH for %%S in ("%STEAMPATH%") do set "STEAMPATH=%%~fS"
  9.  
  10. rem kill steam
  11. taskkill /im Steam.exe /t /f >nul 2>nul & timeout /t 1 >nul & del /f /q "%STEAMPATH%\.crash" >nul 2>nul
  12.  
  13. rem restore View - Small Mode main menu entry - not needed anymore (restored by valve)
  14. ::set ".=%STEAMPATH%\resource\menus\steam.menu"
  15. ::findstr hydra "%.%" >nul 2>nul && (goto inserted1) || (goto insert1)
  16. :::ins1
  17. ::(if "%1"=="BigPictureMode" >>"%.%" echo     hydra { text="#steam_menu_minimode" shellcmd="steam://open/minigameslist" }) &exit/b
  18. :::insert1
  19. ::ren "%.%" steam.menu_ & for /f "delims=" %%S in ('type "%.%_"') do call :ins1 %%S & >>"%.%" echo %%S
  20. ::del /f /q "%.%_" >nul 2>nul
  21. :::inserted1
  22.  
  23. rem top shelf
  24. set .="%STEAMPATH%\steamui\css\libraryroot.css"
  25. ::findstr hydra %.% >nul 2>nul && (set AD=) || (set AD=1)
  26. ::for /f "delims=" %%S in ('findstr .libraryhome_WhatsNewContainer_ %.% 2^>nul') do set "hydra=%%S"
  27. ::if defined AD >>%.% echo(
  28. ::if defined AD >>%.% echo(%hydra%
  29. ::if defined AD >>%.% echo(  display : none; /*hydra*/}
  30.  
  31. rem switch new Library to minigameslist on startup
  32. set .="%STEAMPATH%\steamui\index.html"
  33. findstr hydra %.% >nul 2>nul && (set AD=) || (set AD=1)
  34. setlocal disableDelayedExpansion
  35. if defined AD  >%.% echo(^<^!doctype html^>
  36. setlocal enableDelayedExpansion
  37. if defined AD >>%.% echo(!"! <html style='width: 100%%; height: 100%%'><head><title>Steam</title>
  38. if defined AD >>%.% echo(!"! <meta charset='utf-8'><link href='/css/library.css' rel='stylesheet'><script>
  39. if defined AD >>%.% echo(!"! localStorage.setItem('hydra',0);
  40. if defined AD >>%.% echo(!"! function miniOnStartup(){ if(document.visibilityState == 'visible'){
  41. if defined AD >>%.% echo(!"!   window.location.href='steam://open/minigameslist';
  42. if defined AD >>%.% echo(!"!   document.removeEventListener('visibilitychange',miniOnStartup,true);
  43. if defined AD >>%.% echo(!"! }}
  44. ::if defined AD >>%.% echo(!"! document.addEventListener('visibilitychange',miniOnStartup,true);
  45.  
  46. rem uncomment the 7 lines below to also switch whenever window minimizes / focus changes
  47. ::if defined AD >>%.% echo(!"! function miniOnFocus(){ if(document.visibilityState == 'visible'){
  48. ::if defined AD >>%.% echo(!"!     localStorage.setItem('hydra',Number(localStorage.getItem('hydra'))+2);
  49. ::if defined AD >>%.% echo(!"!   } else localStorage.setItem('hydra',Number(localStorage.getItem('hydra'))-1);
  50. ::if defined AD >>%.% echo(!"!   if(Number(localStorage.getItem('hydra')) == 2){
  51. ::if defined AD >>%.% echo(!"!     localStorage.setItem('hydra',0); window.location.href='steam://open/minigameslist';
  52. ::if defined AD >>%.% echo(!"! }}
  53. ::if defined AD >>%.% echo(!"! document.addEventListener('visibilitychange',miniOnFocus,true);
  54.  
  55. if defined AD >>%.% echo(!"! </script></head>
  56. if defined AD >>%.% echo(!"! <body class='ClientUIControls' style='width: 100%%; height: 100%%; margin: 0; overflow: hidden;'>
  57. if defined AD >>%.% echo(!"! <div id='root' style='height:100%%; width: 100%%'></div><div style='display:none'></div>
  58. if defined AD >>%.% echo(!"! <script src='/libraries/libraries.js'></script><script src='/libraries/libraries_cm.js'></script>
  59. if defined AD >>%.% echo(!"! <script src='/library.js'></script></body></html>
  60. endlocal
  61.  
  62. rem restart steam silently with parameters
  63. set [1]=-console -forceservice -single_core -windowed -manuallyclearframes 0 -skipinitialbootstrap -skipstreamingdrivers -vrskip
  64. set [2]=-nodircheck -norepairfiles -noverifyfiles -nocrashmonitor -nocrashdialog -nofriendsui -oldlib +"@AllowSkipGameUpdate 1 -
  65. start "Steam" "%STEAMPATH%\Steam.exe" -silent -websocketignorecertissues %[1]% %[2]%
  66. ; AveYo: done!
  67.  
  68.  
  69.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement