Skip to content

AHK2 library for window overlay and notification popups using HTML.

License

Notifications You must be signed in to change notification settings

mfaizsyahmi/WindowNotifyOverlay_AHK2

Repository files navigation

WindowNotifyOverlay.ahk

AHK2 library for window overlay and notification popups using HTML.

Creates a window overlay using HTML/CSS, which is then used to display notifications within the window's client area. Works on both AHK Gui window and other windows, including the desktop. The Popup class implements method chaining, like good old jQuery.

Example

#Requires AutoHotKey v2.0
#Include WindowNotifyOverlay.ahk

; 1) Creating an overlay
myGui := Gui()
myOverlay := WindowNotifyOverlay(myGui)
/* add controls here... */
myGui.Show()

; OR create overlay over any other window
otherWinHWND := WinGetID("A")
otherOverlay := WindowNotifyOverlay(otherWinHWND)

; 2) Create a simple popup
myOverlay.PopupSimple("Hello!")

; 3) Create and manage a popup through method chaining
(myPopup := myOverlay("Hello world!","Announcement"))
.InsertAt("tl")     ; places popup at top left corner of myGui
.Show("in-slide-l") ; shows popup with animation sliding from left
.After(5000, (p)=>p.Hide("out-zoom"))
                    ; hides popup with zoom out animation 5s after the call

A sandbox example is available in Example/GuiWithOverlay.ahk.

Requirements

  1. AutoHotkey v2.0+

Features

  • Creates overlays and popup notifications over any window, not just the desktop.
  • Layout uses HTML/CSS and can be freely configured.
  • Simple and configurable popups using method chaining.
  • Supports URL and local file as icons.
  • Select icons from the Visual Studio 2022 Image Library included in a separate file. Include both scripts to use it. See Icons.md for the list of icons.
  • Supports HTML markup for title and text content.
  • CSS stylings for the whole document, the whole popup, or its sub-element.
  • Contextual popup themes: info (blue), message (green), warning (yellow), error (red), as well as a default.
  • A few popup animations built into the CSS.
  • Click and LinkClick event callbacks.

demo positions
6 popup positions

demo themes
contextual themes

demo icons
Select icons (available by importing WindowNotifyOverlay_icons.ahk)

Known issues

  • Currently doesn't support HICON and HBITMAP icons.
  • Since the whole overlay is a single Gui window, there can be only one opacity value for the whole overlay.
  • Some CSS animations don't work properly.
  • Translucency in any part of the HTML may cause it to blend into the trans color and form a halo.
  • The HtmlDocument ActiveX control uses the old mshtml library (equivalent to IE~10) so modern web features post-IE e.g. shadow DOM aren't supported.
  • Due to the nature of AutoHotKey and its lack of true multithreading, a lot of the methods in the method chain are blocking. It is advised to use SetTimer to create and manage popups.

Class documentation

See Classes.md for documentation on classes in WindowNotifyOverlay.ahk.

Changelog

2024-06-01 [v1.1.0]

  • Added ability to create WindowNotifyOverlay as a standalone Gui with no parent.
  • Better handling of TransColor setting.
  • Modified Popup OnEvent() handling to allow for multiple callbacks to be assigned to the same event name, in line with how it's done in vanilla AHKV2.
  • Added convenience properties to get/set popup titles/content/side sub-elements.
  • Fixed Popup static defaults not being applied to instances.
  • Fixed major bug with colliding popup IDs... hopefully ??

2024-05-31 [v1.0.0]

  • Initial release

License

See LICENSE.txt for full text.

About

AHK2 library for window overlay and notification popups using HTML.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published