FlyoutAlert.ini:
Code: Select all
[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
[Variables]
[MeterTriggerAlert]
Meter=String
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=Trigger Alert
LeftMouseUpAction=[!ActivateConfig "FlyoutAlert\Flyout" "Flyout.ini"]
Flyout.ini:
Code: Select all
[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
; Constrain the skin to 400 X 150.
SkinWidth=400
SkinHeight=150
; Position the flyout in the lower-right of the primary monitor, above the Windows Taskbar.
OnRefreshAction=[!ZPos "1"][!Move "(#SCREENAREAWIDTH#-400)" "(#WORKAREAHEIGHT#-150)"][!Draggable "0"][!KeepOnScreen "0"][Play "#@#Sounds\NotifySound.wav"][!CommandMeasure MeasureSlider "Execute 1"]
[Variables]
U=[!UpdateMeasure MeasureSlider][!UpdateMeter *][!Redraw]
OffSet=401
MaxOffset=401
DelaySeconds=20
[MeasureScreen]
Measure=Plugin
Plugin=IsFullScreen
; Bypass the alert if a full-screen application has focus.
IfCondition=MeasureScreen=1
IfTrueAction=[!DeactivateConfig]
[MeasureTitleBarRGB]
Measure=Plugin
Plugin=SysColor
; Find the Windows accent (title bar) color.
ColorType=DWM_COLOR
DisplayType=RGB
[MeasureTitleBarRed]
Measure=Plugin
Plugin=SysColor
ColorType=DWM_COLOR
DisplayType=Red
[MeasureTitleBarGreen]
Measure=Plugin
Plugin=SysColor
ColorType=DWM_COLOR
DisplayType=Green
[MeasureTitleBarBlue]
Measure=Plugin
Plugin=SysColor
ColorType=DWM_COLOR
DisplayType=Blue
[MeasureTitleBarLumin]
Measure=Calc
; Calculate the relative "brightness" of the accent color, and set the text to contrast.
Formula=(([MeasureTitleBarRed] * 299) + ([MeasureTitleBarGreen] * 587) + ([MeasureTitleBarBlue] * 114)) / 1000
IfBelowValue=130
IfBelowAction=[!SetVariable TextColor "255,255,255,255"][!UpdateMeter *][!Redraw]
IfAboveValue=129
IfAboveAction=[!SetVariable TextColor "0,0,0,255"][!UpdateMeter *][!Redraw]
DynamicVariables=1
; Slider
[MeasureSlider]
Measure=Plugin
Plugin=ActionTimer
; Slide the meters in and out 15 pixels at a time, 27 times, with a wait of 2 milliseconds between.
; 15 X 27 is 405, but only slide to a Clamp() maximum of #MaxOffset#, or 401, pixels.
ActionList1=Repeat SlideIn, 2, 27
SlideIn=[!SetVariable OffSet "(Clamp(#OffSet#-15,0,#MaxOffset#))"]#U#
ActionList2=Repeat SlideOut, 2, 27 | Wait 300 | Deactivate
SlideOut=[!SetVariable OffSet "(Clamp(#OffSet#+15,0,#MaxOffset#))"]#U#
Deactivate=[!DeactivateConfig]
DynamicVariables=1
; Timer
[MeasureTimer]
Measure=Calc
; Count to #DelaySeconds#, then slide the panel away and deactivate the skin.
Formula=MeasureTimer + 1
IfCondition=MeasureTimer >= #DelaySeconds#
IfTrueAction=[!CommandMeasure MeasureSlider "Execute 2"]
OnUpdateAction=[!SetVariable SecondsLeft "(#DelaySeconds# - [MeasureTimer])"]
DynamicVariables=1
; Meters
[MeterPanel]
Meter=Image
X=#OffSet#
W=400
H=150
SolidColor=[MeasureTitleBarRGB],255
DynamicVariables=1
MouseActionCursor=0
; On a mouse click, slide the panel away and deactivate the skin.
LeftMouseUpAction=[!CommandMeasure MeasureSlider "Execute 2"]
[MeterImage]
Meter=Image
W=32
H=32
X=(20 + #OffSet#)
Y=10
ImageName=#@#Images\warning.png
DynamicVariables=1
[MeterHeader]
Meter=String
X=(66 + #OffSet#)
Y=16
FontSize=17
FontColor=#TextColor#
AntiAlias=1
Text=Alert has been triggered!
DynamicVariables=1
[MeterTitle]
Meter=String
W=360
ClipStringH=100
ClipString=2
X=(20 + #OffSet#)
Y=15R
FontSize=12
FontColor=#TextColor#
AntiAlias=1
InlineSetting=Weight | 700
InlinePattern=for (.*) seconds
Text=The alert has been triggered and will remain here for #SecondsLeft# seconds.#CRLF##CRLF#Click anywhere to dismiss...
DynamicVariables=1
1) IsFullScreen: This will detect if a full-screen application, like a game or movie has "focus". This can be used to stop the alert from happening, as you certainly don't want a flyout to happen while playing Fallout4 or something.
2) SysColor: This retrieves the Windows "accent color", which can be used for the sliding panel. This will make it more closely match the behavior of internal Windows notifications.