It is currently March 29th, 2024, 1:18 am

FlyoutAlert

Skins that control functions in Windows or Rainmeter
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

FlyoutAlert

Post by jsmorley »

This is an example skin that shows how you might create a "flyout" notification with Rainmeter. This closely resembles the flyout notifications you get from Windows, although it has nothing to do with the Action Center.
FlyoutAlert_1.0.rmskin
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"]
This is just an example. With a little thought, you can have anything you want trigger the alert, maybe a new gmail, or some new item from a feed you are watching, or who knows what. Just be careful that you have logic that doesn't just trigger the alert over and over... That can be the tricky bit.


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
Click to animate:
GIF.gif
This uses two 3rd-party plugins. They are included, and the 32bit and 64bit .dll files are in @Resources in case you want to use them in your own distributed .rmskins.

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.
You do not have the required permissions to view the files attached to this post.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: FlyoutAlert

Post by balala »

Good idea and a well done skin, as usually. However a flyout notification can be created, using the trayballoon command reference of the nircmd app: ["#@#nircmd\nircmd.exe" trayballoon "Title" "Ballon Text" "shell32.dll,277" "20000"]
The last parameter is the amount of time (in milliseconds) that the panel remains on the screen, while the previous one is the used icon.

jsmorley, I'm not saying your skin wouldn't be good. It definitely is and it has a few advantages (like easier customization). However when I saw your post, this idea came immediately in my mind and wanted to share. I hope you don't mind...
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: FlyoutAlert

Post by jsmorley »

balala wrote:Good idea and a well done skin, as usually. However a flyout notification can be created, using the trayballoon command reference of the nircmd app: ["#@#nircmd\nircmd.exe" trayballoon "Title" "Ballon Text" "shell32.dll,277" "20000"]
The last parameter is the amount of time (in milliseconds) that the panel remains on the screen, while the previous one is the used icon.

jsmorley, I'm not saying your skin wouldn't be good. It definitely is and it has a few advantages (like easier customization). However when I saw your post, this idea came immediately in my mind and wanted to share. I hope you don't mind...
Not a bit.

I particularly like that it forces an advertisement for nircmd on the flyout, cause that's what Rainmeter is all about, advertising! ;-)

I know it's not really an advertisement, but rather a pretty reasonable "what app sent this notification?" indication, but still kinda annoying in the world of Rainmeter.
F!.OW
Posts: 22
Joined: April 1st, 2018, 12:42 pm

Re: FlyoutAlert

Post by F!.OW »

This would be great for something like a Pomodoro Timer which I'm trying to figure out how to create. I like the fact that you can design it to match your skin's aesthetic instead. Another skin for my sandbox! :thumbup: