Skip to content

Commit

Permalink
Improvement: blinking Scroll Lock
Browse files Browse the repository at this point in the history
  • Loading branch information
r57zone committed Mar 5, 2021
1 parent 62446f7 commit bcd645f
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 8 deletions.
3 changes: 3 additions & 0 deletions README.RU.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
# Центр уведомлений
Альтернативный центр уведомлений для Windows. Совместимо с [уведомлениями для программ](https://github.com/r57zone/notifications).

## Настройка
Для включения мигания светодиодом клавиатуры (Scroll Lock-ом), изменить параметр `ScrollBlink` на `1` в файле "Config.ini".

## Скриншоты
![](https://user-images.githubusercontent.com/9499881/36250925-cb506156-1258-11e8-8c31-e52e8bbed1fa.png)

Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
# Notification center
Alternative notification center for Windows. Compatible with [notifications for programs](https://github.com/r57zone/notifications).

# Setup
To enable blinking of the keyboard LED (Scroll Lock), change the `ScrollBlink` parameter to` 1` in the "Config.ini" file.

## Screenshots
![](https://user-images.githubusercontent.com/9499881/36250978-fbbba1c0-1258-11e8-8ef8-c3ec62ac554f.png)

Expand Down
5 changes: 3 additions & 2 deletions Source/Unit1.dfm
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ object Main: TMain
Left = 104
Top = 8
Bitmap = {
494C010101000400040010001000FFFFFFFFFF00FFFFFFFFFFFFFFFF424D3600
494C010101000400040010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600
0000000000003600000028000000400000001000000001002000000000000010
000000000000000000000000000000000000000000FF000000FF000000FF0000
00FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF0000
Expand Down Expand Up @@ -198,7 +198,8 @@ object Main: TMain
FC3F000000000000F81F00000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
FFFF000000000000FFFF000000000000}
FFFF000000000000FFFF00000000000000000000000000000000000000000000
000000000000}
end
object ItemsPopupMenu: TPopupMenu
Left = 72
Expand Down
40 changes: 34 additions & 6 deletions Source/Unit1.pas
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ TMain = class(TForm)
procedure BlockBtnClick(Sender: TObject);
procedure ShowBtnClick(Sender: TObject);
procedure ChangeIconTimer(Sender: TObject);
procedure PressScroll;
private
procedure WMCopyData(var Msg: TWMCopyData); message WM_COPYDATA;
procedure WMNCHITTEST(var Msg: TMessage); message WM_NCHITTEST;
Expand All @@ -62,6 +63,7 @@ TMain = class(TForm)
IDS_NOTIFICATIONS, IDS_DELETE_ALL, IDS_UNKNOWN_APP, IDS_BLOCK_QUESTION, IDS_LAST_UPDATE: string;
RunOnce: boolean;
NotifyIndex: integer;
ScrollBlink, ScrollState: boolean;

implementation

Expand Down Expand Up @@ -121,7 +123,15 @@ procedure TMain.IconMouse(var Msg: TMessage);
begin
case Msg.LParam of
WM_LBUTTONDOWN:
if IsWindowVisible(Main.Handle) then NotificationCenterHide else NotificationCenterShow;
begin
if IsWindowVisible(Main.Handle) then
NotificationCenterHide
else
NotificationCenterShow;

if ScrollState then
PressScroll;
end;

WM_RBUTTONDOWN:
PopupMenu.Popup(Mouse.CursorPos.X, Mouse.CursorPos.Y);
Expand Down Expand Up @@ -187,11 +197,14 @@ procedure TMain.FormCreate(Sender: TObject);
Reg: TRegistry;
begin
Ini:=TIniFile.Create(ExtractFilePath(ParamStr(0)) + 'Config.ini');
ScrollBlink:=Ini.ReadBool('Main', 'ScrollBlink', false);
IconIndex:=Ini.ReadInteger('Main', 'NewMessages', 0);

//Âêëþ÷àåì "àíèìàöèþ" èêîíêè
if IconIndex = 1 then
if IconIndex = 1 then begin
ChangeIcon.Enabled:=true;
PressScroll;
end;

if Ini.ReadBool('Main', 'FirstRun', true) then begin
Ini.WriteBool('Main', 'FirstRun', false);
Expand Down Expand Up @@ -340,6 +353,8 @@ procedure TMain.WMCopyData(var Msg: TWMCopyData);
'5': NotifyColor:='#8b0094';
'6': NotifyColor:='#ac193d';
'7': NotifyColor:='#222222';
else
NotifyColor:='#018399';
end;

//Èñêëþ÷àåì èñêëþ÷åííûå ñîîáùåíèÿ
Expand All @@ -350,6 +365,7 @@ procedure TMain.WMCopyData(var Msg: TWMCopyData);
Tray(3);
//Âêëþ÷àåì "àíèìàöèþ" èêîíêè
ChangeIcon.Enabled:=true;
PressScroll;
Notifications.SaveToFile(ExtractFilePath(ParamStr(0)) + 'Notifications.txt');
end;

Expand Down Expand Up @@ -377,6 +393,8 @@ procedure TMain.FormDestroy(Sender: TObject);
ExcludeList.Free;
Tray(2);
IconFull.Free;
if ScrollState then
PressScroll;
end;

procedure TMain.DefaultHandler(var Message);
Expand All @@ -388,10 +406,10 @@ procedure TMain.DefaultHandler(var Message);

procedure TMain.AboutBtnClick(Sender: TObject);
begin
Application.MessageBox(PChar(Application.Title + ' 0.7.4' + #13#10
+ IDS_LAST_UPDATE + ' 25.12.2020' + #13#10
+ 'http://r57zone.github.io' + #13#10 + 'r57zone@gmail.com'),
PChar(AboutBtn.Caption), MB_ICONINFORMATION);
Application.MessageBox(PChar(Application.Title + ' 0.7.5' + #13#10 +
IDS_LAST_UPDATE + ' 05.03.2021' + #13#10 +
'https://r57zone.github.io' + #13#10 +
'r57zone@gmail.com'), PChar(AboutBtn.Caption), MB_ICONINFORMATION);
end;

procedure TMain.ExitBtnClick(Sender: TObject);
Expand Down Expand Up @@ -442,7 +460,17 @@ procedure TMain.ChangeIconTimer(Sender: TObject);
IconIndex:=1
else
IconIndex:=0;
PressScroll;
Tray(3);
end;

procedure TMain.PressScroll;
begin
if ScrollBlink = false then
Exit;
keybd_event(VK_SCROLL, VK_SCROLL, KEYEVENTF_EXTENDEDKEY, 0);
keybd_event(VK_SCROLL, VK_SCROLL, KEYEVENTF_EXTENDEDKEY or KEYEVENTF_KEYUP, 0);
ScrollState:=not ScrollState;
end;

end.

0 comments on commit bcd645f

Please sign in to comment.