PhantomGamers / SteamFriendsPatcher

EnableNewSteamFriendsSkin, now with a GUI and auto scanning!
MIT License
199 stars 8 forks source link

Update library on libraryroot.custom.css change #4

Open JotaFaD opened 4 years ago

JotaFaD commented 4 years ago

Currently, every time I make a change to the libraryroot.custom.css file, a steam restart is required for the changes to be shown. Can this be automated?

PhantomGamers commented 4 years ago

We should be able to utilize the file system watcher to watch libraryroot.custom.css for changes and then refresh the patched libraryroot.css to trigger Steam to detect the changes, however in the future the client might require a restart when even the original is changed.

I'll look at implementing this though, good suggestion! Thanks

JotaFaD commented 4 years ago

Thanks PhantomGamers. Great job on the patcher.

UrSok commented 4 years ago

@Jose-Paulo-FaD You can edit libraryroot.css and save it and then edit it back to normal to update the steam ui without restarting.

PhantomGamers commented 4 years ago

Yes, this works but ideally the patcher would do this automatically if it's running. I've been busy but this is still on my to-do list.

GentlePuppet commented 4 years ago

I made a batch file to add @import to load a custom css override for skinning the library, there is a readme included. https://cdn.discordapp.com/attachments/537866809311756289/657239229390258197/EnableNewSteamLibrarySkin.zip

PhantomGamers commented 4 years ago

@GentlePuppet ...but why?

GentlePuppet commented 4 years ago

At the time this tool didn't have the option to make a custom css for the library, I made this batch before the beta first came out, via the leaked beta files around june, and I didn't know there was an update to this tool that added the library css until after my comment before I downloaded the updated version (I was still using 1.2.4.0 the command prompt version :P) A mix of misunderstanding the issue and the old comment before finishing, so you can safely ignore me.

zingmars commented 4 years ago

For those who want this effect before it's implemented, I "wrote" (basically copied from here) a powershell script that monitors a folder and appends to a file in the steamui directory (since that seems to be enough to trigger a refresh). My watch path and steamui path is different since my custom css files are symlinked to a version-tracked directory, but it should work just as well if you adjust the filter to *.css files in order to avoid an infinite loop. Also powershell seems a bit finnicky, so if it doesn't seem to do anything try running it using the ISE or dot sourcing it.

$changefile = "C:\Program Files (x86)\Steam\steamui\licenses.txt"
$watcher = New-Object System.IO.FileSystemWatcher
$watcher.Path = "Path\To\Your\CSS\Path"
$watcher.Filter = "*.*"
$watcher.IncludeSubdirectories = $true
$watcher.EnableRaisingEvents = $true  

$action = { 
  $path = $Event.SourceEventArgs.FullPath
  $changeType = $Event.SourceEventArgs.ChangeType
  Write-Host "$(Get-Date), $changeType, $path"
  Add-content $changefile -value "." 
}

"Registering events";
#Register-ObjectEvent $watcher "Created" -Action $action
Register-ObjectEvent $watcher "Changed" -Action $action
#Register-ObjectEvent $watcher "Deleted" -Action $action
#Register-ObjectEvent $watcher "Renamed" -Action $action

"Listening to changes"
while ($true) {sleep 1}