Skip to content

Commit

Permalink
1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
benwa committed Dec 15, 2020
1 parent 882015b commit 6f3faab
Show file tree
Hide file tree
Showing 6 changed files with 8,522 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# These are supported funding model platforms

github: benwa
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.exe
*.bgi
*.vbs
63 changes: 63 additions & 0 deletions BgInfo-Helper.ahk
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
;@Ahk2Exe-SetCopyright Bennett Blodinger
;@Ahk2Exe-SetDescription Quality of life improvements for Sysinternal's BgInfo
;@Ahk2Exe-SetLanguage 0x0409
;@Ahk2Exe-SetName BgInfo-Helper
;@Ahk2Exe-SetVersion 1.0.0

;@Ahk2Exe-IgnoreBegin
#Warn
;@Ahk2Exe-IgnoreEnd
/*@Ahk2Exe-Keep
#NoTrayIcon
ListLines Off
*/
#NoEnv
#Persistent
#SingleInstance, Force

Process, Priority, , Low

#Include, %A_ScriptDir%\Lib\Gdip_All.ahk

global executable, global parameters

; Get bitness
if (A_Is64bitOS) {
executable := "BgInfo64.exe"
} else {
executable := "BgInfo.exe"
}

; Parse arguments
For Each, argument In A_Args {
parameters .= (parameters <> "" ? A_Space : "") . argument
}

; Convert unsupported image formats
ConvertWallpaper(format:="bmp") {
RegRead, currentWallpaper, HKEY_CURRENT_USER\Control Panel\Desktop, WallPaper
SplitPath, currentWallpaper, currentWallpaper_outFileName, currentWallpaper_outDir, currentWallpaper_outExtension, currentWallpaper_outNameNoExt, currentWallpaper_outDrive
StringUpper, currentWallpaper_outExtension, currentWallpaper_outExtension
If (!RegExMatch(currentWallpaper_outExtension, "^(?i:BMP|JPG|GIF)$")) {
If (pToken0 := Gdip_Startup()) {
convertedWallpaper := A_Temp . "\" . currentWallpaper_outNameNoExt . "." . format
pBitmap0 := Gdip_CreateBitmapFromFile(currentWallpaper)
Gdip_SaveBitmapToFile(pBitmap0, convertedWallpaper)
Gdip_DisposeImage(pBitmap0)
Gdip_Shutdown(pToken0)
}
DllCall("SystemParametersInfo", Int, 0x14, Int, 0, Str, convertedWallpaper, Int, 3)
}
}

; Refresh BgInfo at startup
WM_DISPLAYCHANGE(0, 0)

; Listen for resolution changes
OnMessage(0x7E, "WM_DISPLAYCHANGE")

WM_DISPLAYCHANGE(wParam, lParam) {
ConvertWallpaper("bmp")
Run, %executable% %parameters%
DllCall("SetProcessWorkingSetSize", Int, -1, Int, -1, Int, -1)
}
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [1.0.0] - 2020-12-15
### Added
- Initial release
- Refresh on resolution changes
- Convert wallpaper to supported format

[Unreleased]: compare/v1.0.0...HEAD
[1.0.0]: releases/tag/v1.0.0
Loading

0 comments on commit 6f3faab

Please sign in to comment.