Skip to content

Commit

Permalink
Merge pull request #5 from Prajwal-Prathiksh/feat--simplify-repo-stru…
Browse files Browse the repository at this point in the history
…cture

Feat: simplify repo structure
  • Loading branch information
Prajwal-Prathiksh authored Nov 11, 2024
2 parents e36831a + 0362702 commit 65cd847
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 14 deletions.
8 changes: 4 additions & 4 deletions BreakTheWall_GUI.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ $form.StartPosition = "CenterScreen"
$srcDir = "$env:USERPROFILE\Downloads"

# Setup ps1 script paths
$updateSysParamsScript = "$PSScriptRoot\UpdateSystemParameters.ps1"
$oneTimeChangerScript = "$PSScriptRoot\OneTimeChanger.ps1"
$autoSchedulerScript = "$PSScriptRoot\SafeRunAutoScheduler.ps1"
$resetWallpaperScript = "$PSScriptRoot\ResetWallpaper.ps1"
$updateSysParamsScript = "$PSScriptRoot\Utils\UpdateSystemParameters.ps1"
$oneTimeChangerScript = "$PSScriptRoot\Utils\OneTimeChanger.ps1"
$autoSchedulerScript = "$PSScriptRoot\Utils\SafeRunAutoScheduler.ps1"
$resetWallpaperScript = "$PSScriptRoot\Utils\ResetWallpaper.ps1"

# Check if srcDir\wallpaper.jpg exists
$srcFile = "$srcDir\wallpaper.jpg"
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,31 +27,31 @@ To change your wallpaper using the GUI, you can follow these steps:
1. Run the [`BreakTheWall_GUI.ps1`](BreakTheWall_GUI.ps1) script by right-clicking on it and selecting `Run with PowerShell`. *(For pro-users, you can also run it from the `PowerShell` terminal, but make sure to navigate to the script's location first.)*

## One-time Change
You can use the [`OneTimeChanger.ps1`](OneTimeChanger.ps1) script to change your wallpaper to a custom one, as a one-time change. Here's how you can do it:
You can use the [`Utils/OneTimeChanger.ps1`](Utils/OneTimeChanger.ps1) script to change your wallpaper to a custom one, as a one-time change. Here's how you can do it:
1. Store your desired wallpaper as `wallpaper.jpg` in the `Downloads` directory
> The script currently supports only `.jpg` files. If you have a different format, you can convert it to `.jpg` using an online converter, and the name must follow the format `wallpaper.jpg`.
> If you're unsure about the location of `Downloads` directory, you can find it opening `File Explorer` and typing `%USERPROFILE%\Downloads` in the address bar.
1. Run the `OneTimeChanger.ps1` script.
1. Run the `Utils/OneTimeChanger.ps1` script.

**That's it! Your wallpaper should now be updated to the one you saved! <3**
> Upon restarting your system or changing monitors, the wallpaper might revert to the default one. In such cases, you can re-run the steps above to update it again.
## Scheduled Change
You can use the [`SafeRunAutoScheduler.ps1`](SafeRunAutoScheduler.ps1) script to keep changing your wallpapers at regular intervals automatically, from a set of saved wallpapers. Here's how you can do it:
You can use the [`Utils/SafeRunAutoScheduler.ps1`](Utils/SafeRunAutoScheduler.ps1) script to keep changing your wallpapers at regular intervals automatically, from a set of saved wallpapers. Here's how you can do it:
1. Create a new folder named `custom_wallpapers` in the `Downloads` directory (Eg. `%USERPROFILE%\Downloads\custom_wallpapers`).
1. Store all the wallpapers you want to cycle through in the `custom_wallpapers` folder. **As mentioned before, the files must be in `.jpg` format only, but can have any name.**
1. **[Optional]** If you want to change the interval between wallpaper changes, you can modify the `AutoScheduler.vbs` script. **By default, the interval is set to 1 hour.**
2. Run the `SafeRunAutoScheduler.ps1` script.
2. Run the `Utils/SafeRunAutoScheduler.ps1` script.

**That's it! Your wallpapers will now change automatically at the set interval! <3**
> A log file named `wallpaper_refresh.log` will be created in the root directory of the repository, which will contain the timestamps of each wallpaper change. This can be used to verify the script's working or to debug any issues.
> You can stop the script at any time by opening the `Task Manager` and ending the `Microsoft Windows Based Script Host` process.
## Reset to Default Wallpaper
If it ever becomes necessary for you to revert to the default wallpaper :"(, you can use the [`ResetWallpaper.ps1`](ResetWallpaper.ps1) script to do so. Here's how you can do it:
1. Run the `ResetWallpaper.ps1` script.
If it ever becomes necessary for you to revert to the default wallpaper :"(, you can use the [`Utils/ResetWallpaper.ps1`](Utils/ResetWallpaper.ps1) script to do so. Here's how you can do it:
1. Run the `Utils/ResetWallpaper.ps1` script.

**That's it! Your wallpaper should now be updated to the default one .... :"(**

Expand Down
Binary file modified README.pdf
Binary file not shown.
4 changes: 2 additions & 2 deletions AutoScheduler.vbs → Utils/AutoScheduler.vbs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ Option Explicit
Dim interval, logFile, fso, logStream, rootDir, destDir, transcodedWallpaperPath, srcPath

' Time interval in seconds
interval = 3600
logFile = CreateObject("Scripting.FileSystemObject").GetParentFolderName(WScript.ScriptFullName) & "\wallpaper_refresh.log"
interval = 600
logFile = CreateObject("Scripting.FileSystemObject").GetParentFolderName(CreateObject("Scripting.FileSystemObject").GetParentFolderName(WScript.ScriptFullName)) & "\wallpaper_refresh.log"

Set fso = CreateObject("Scripting.FileSystemObject")

Expand Down
File renamed without changes.
5 changes: 4 additions & 1 deletion OneTimeChanger.ps1 → Utils/OneTimeChanger.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ $rootDir = "$env:APPDATA\Microsoft\Windows\Themes"
$destDir = "$env:APPDATA\Microsoft\Windows\Themes\CachedFiles"
$transcodedWallpaperDir = "$rootDir\TranscodedWallpaper"

# Setup ps1 script path
$updateSystemParametersScript = "$PSScriptRoot\UpdateSystemParameters.ps1"

# Check if the destination path exists; if not, create it
if (-not (Test-Path -Path $destDir)) {
Write-Host "Destination path does not exist, creating path $destDir"
Expand Down Expand Up @@ -89,7 +92,7 @@ if (-not $noCopy) {
# Refresh the desktop to apply the new wallpaper if -nr is not set or noCopy is set
if (-not $nr -or $noCopy) {
Start-Sleep -Seconds 2
.\UpdateSystemParameters.ps1
& $updateSystemParametersScript
Write-Host "Refreshed desktop wallpaper to apply the new image."
}

Expand Down
3 changes: 2 additions & 1 deletion ResetWallpaper.ps1 → Utils/ResetWallpaper.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ $transcodedWallpaperDir = "$rootDir\TranscodedWallpaper"

# Setup ps1 script path
$killAutoSchedulerScript = "$PSScriptRoot\KillAutoScheduler.ps1"
$updateSystemParametersScript = "$PSScriptRoot\UpdateSystemParameters.ps1"

# Run the script to kill the AutoScheduler process
& $killAutoSchedulerScript
Expand All @@ -47,5 +48,5 @@ Write-Host "Removed all files in $destDir"

# Refresh the system parameters to reset the wallpaper
Start-Sleep -Seconds 2
.\UpdateSystemParameters.ps1
& $updateSystemParametersScript
Write-Host "Refreshed desktop to reset wallpaper."
File renamed without changes.
File renamed without changes.

0 comments on commit 65cd847

Please sign in to comment.