Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open Notifications + Calendar Command by default #74

Open
Eichen97 opened this issue Mar 8, 2025 · 1 comment
Open

Open Notifications + Calendar Command by default #74

Eichen97 opened this issue Mar 8, 2025 · 1 comment

Comments

@Eichen97
Copy link

Eichen97 commented Mar 8, 2025

I wanted to do this for a while, so i created a .vbs file that opens the action center, and closes it in case it was already open. it depends of a .txt file on the same route to check the notification center status because it's snappy enough for me and works great as is, but you could probably adapt it to a powershell script to be able to check it natively and skip the .txt file and add it as another built in functionality in a future update.

Dim fso, statusFile, status
Set fso = CreateObject("Scripting.FileSystemObject")

' Check if the NotificationStatus.txt file exists
If Not fso.FileExists("NotificationStatus.txt") Then
    ' If it doesn't exist, create it and write "closed" to it
    Set statusFile = fso.CreateTextFile("NotificationStatus.txt", True)
    statusFile.WriteLine "closed"
    statusFile.Close
End If

' Read the current status from NotificationStatus.txt
Set statusFile = fso.OpenTextFile("NotificationStatus.txt", 1)
status = statusFile.ReadLine
statusFile.Close

' Check if the status is "open" or "closed"
If status = "open" Then
    ' If the status is "open", send an Escape keystroke to close notifications
    Set wshell = CreateObject("WScript.Shell")
    wshell.SendKeys "{ESCAPE}"
    
    ' Update the status to "closed"
    Set statusFile = fso.CreateTextFile("NotificationStatus.txt", True)
    statusFile.WriteLine "closed"
    statusFile.Close
Else
    ' If the status is "closed", open the Action Center
    Set wshell = CreateObject("WScript.Shell")
    wshell.Run "ms-actioncenter:"
    
    ' Update the status to "open"
    Set statusFile = fso.CreateTextFile("NotificationStatus.txt", True)
    statusFile.WriteLine "open"
    statusFile.Close
End If

@vhanla
Copy link
Owner

vhanla commented Mar 8, 2025

Are you perhaps talking about Windows 10's Calendar that can be shown using hotkey Win+Alt+D?

If so, you can use this method, which consists of finding out the classname of the calendar/clock notification window and its title to detect it in order to escape otherwise trigger the hotkey Win+Alt+D, for that I'm using Spy tool from AutoHotkey to get the hovered window's classname and title and create the command for hotkeys as follows:

#[Windows.UI.Core.CoreWindow,The Title in your Windows locale given to this window]:(escape)?(_win+_alt+d)

i.e. #[class,title]:(hotkey if found)?(hotkey if not found)

ShowCalendarWin10.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants