-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add persistent and rollback, let's call this V1.0
- Loading branch information
1 parent
7b8c1bd
commit b95be35
Showing
5 changed files
with
138 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
# USAGE: | ||
# Win + R: | ||
# powershell -w h -c ". ([Scriptblock]::Create((([System.Text.Encoding]::ASCII).getString((Invoke-WebRequest -Uri "https://juanbanpar.github.io/GRADLOVE/amor.ps1").Content))))" | ||
# Powershell: | ||
# . ([Scriptblock]::Create((([System.Text.Encoding]::ASCII).getString((Invoke-WebRequest -Uri "https://juanbanpar.github.io/GRADLOVE/amor.ps1").Content)))) | ||
|
||
$Data = @{ | ||
WallpaperURL = "https://juanbanpar.github.io/GRADLOVE/files/wall.jpg" | ||
DownloadDirectory = "C:\amor" | ||
} | ||
|
||
$WallpaperDest = $($Data.DownloadDirectory + "\Wallpaper." + ($Data.WallpaperURL -replace ".*\.")) | ||
|
||
# Function of LOVE | ||
Function Set-WallPaper { | ||
|
||
<# | ||
.SYNOPSIS | ||
Applies a specified wallpaper to the current user's desktop | ||
.PARAMETER Image | ||
Provide the exact path to the image | ||
.PARAMETER Style | ||
Provide wallpaper style (Example: Fill, Fit, Stretch, Tile, Center, or Span) | ||
.EXAMPLE | ||
Set-WallPaper -Image "C:\Wallpaper\Default.jpg" | ||
Set-WallPaper -Image "C:\Wallpaper\Background.jpg" -Style Fit | ||
#> | ||
|
||
param ( | ||
[parameter(Mandatory=$True)] | ||
# Provide path to image | ||
[string]$Image, | ||
# Provide wallpaper style that you would like applied | ||
[parameter(Mandatory=$False)] | ||
[ValidateSet('Fill', 'Fit', 'Stretch', 'Tile', 'Center', 'Span')] | ||
[string]$Style | ||
) | ||
|
||
$WallpaperStyle = Switch ($Style) { | ||
|
||
"Fill" {"10"} | ||
"Fit" {"6"} | ||
"Stretch" {"2"} | ||
"Tile" {"0"} | ||
"Center" {"0"} | ||
"Span" {"22"} | ||
|
||
} | ||
|
||
If($Style -eq "Tile") { | ||
|
||
New-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name WallpaperStyle -PropertyType String -Value $WallpaperStyle -Force | ||
New-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name TileWallpaper -PropertyType String -Value 1 -Force | ||
|
||
} | ||
Else { | ||
|
||
New-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name WallpaperStyle -PropertyType String -Value $WallpaperStyle -Force | ||
New-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name TileWallpaper -PropertyType String -Value 0 -Force | ||
|
||
} | ||
|
||
Add-Type -TypeDefinition @" | ||
using System; | ||
using System.Runtime.InteropServices; | ||
public class Params | ||
{ | ||
[DllImport("User32.dll",CharSet=CharSet.Unicode)] | ||
public static extern int SystemParametersInfo (Int32 uAction, | ||
Int32 uParam, | ||
String lpvParam, | ||
Int32 fuWinIni); | ||
} | ||
"@ | ||
|
||
$SPI_SETDESKWALLPAPER = 0x0014 | ||
$UpdateIniFile = 0x01 | ||
$SendChangeEvent = 0x02 | ||
|
||
$fWinIni = $UpdateIniFile -bor $SendChangeEvent | ||
|
||
$ret = [Params]::SystemParametersInfo($SPI_SETDESKWALLPAPER, 0, $Image, $fWinIni) | ||
} | ||
|
||
# Sets LOVE images | ||
Set-WallPaper -Image $WallpaperDest -Style Fit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
|
||
WallpaperURL="https://juanbanpar.github.io/GRADLOVE/files/wall.jpg" | ||
DownloadDirectory="/home/$USER/amor" | ||
WallFile=$(basename "$WallpaperURL") | ||
|
||
# Sets LOVE images | ||
gsettings set org.gnome.desktop.background picture-uri file:///${DownloadDirectory}/${WallFile} |