Created
January 19, 2023 01:34
-
-
Save xanderificnl/ed06f2656ece3a1593aa5c26da4856bf to your computer and use it in GitHub Desktop.
Keep a transparent window on top and remove titlebar
This file contains hidden or 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
| #SingleInstance Force | |
| ;;; | |
| ; Toggle on top + titlebar + transparency of window under mouse. | |
| #j:: { | |
| ; WS_THICKFRAME (WS_BORDER + WS_DLGFRAME + WS_SIZEBOX) | |
| WS_THICKFRAME := "0xC40000" | |
| ; Active mouse window | |
| MouseGetPos(,, &ActiveWindow) | |
| ; Toggle the frame | |
| WinSetStyle("^" WS_THICKFRAME, ActiveWindow) | |
| ; Avoid split state | |
| state := WinGetStyle(ActiveWindow) & WS_THICKFRAME | |
| ; Toggle transparency (invisible [0 - 255] visible) | |
| transperancy := (state) ? 255 : 100 | |
| WinSetTransparent(transperancy, ActiveWindow) | |
| ;; Setting the transparency level to 255 before using "Off" might avoid window | |
| ;; redrawing problems such as a black background. | |
| if (transperancy == 255) { | |
| WinSetTransparent("Off", ActiveWindow) | |
| } | |
| ; Toggle on top | |
| WinSetAlwaysOnTop((state) ? 0 : 1, ActiveWindow) | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment