3

To my surprise, there seems to not be a Windows hotkey for enabling/disabling Focus Assist on Windows 11.

Is there a way to force such a hotkey, even if it requires the use of third-party software (such as AutoHotkey)?


Clarification: The acceptable solution should not include any use of the mouse in the end result. I.e., I should be able to enable/disable Focus Assist by simply pressing a key or a combination of keys.

Aventinus
  • 1,542

6 Answers6

3

Firstly, thank you https://superuser.com/users/192857/fred for nearly getting there ...

Win + N then Shift + Tab then Enter or Space

This will:

  • EITHER open (and start) a (30 minute) focus session

  • OR end the focus session (not pause)

AndyS
  • 464
2

AutoHotkey script, first one I've ever done :)

; ^6=Ctrl+6 activates script. #f=Win+F which would take over a builtin hotkey opens Feedback Hub and screenshot
^6::
; Keys sequence: Win+B, Left, Menu/Right-click key, Down 2x, Enter, Down=Priority (2x=Alarm), Enter
; Win+B Sets focus for the Show hidden icons dropdown menu: https://support.microsoft.com/en-us/windows/keyboard-shortcuts-in-windows-dcc61a57-8ff0-cffe-9796-cb9706c75eec
Send, #b
Sleep, 500 ; wait 0.5sec since PC's need a moment to bring up menus sometimes
Send, {Left}{AppsKey}
Sleep, 500
Send, {Down 2}{Enter}{Down}{Enter}{Esc} ; Esc closes notifications bar
; Send, {Down 2}{Enter}{Down 2}{Enter} ; uncomment this line for Alarms only then comment above line
return

; Turn off Windows Focus Assist with Ctrl+0 ^0:: Send, #b Sleep, 500 Send, {Left}{AppsKey} Sleep, 500 Send, {Down 2}{Enter 2}{Esc} return ; VARIATION2: Win+I, focus assist, Down, Enter, Tab 3x=Priority (4x=Alarm), Spacebar, Alt+F4 ; VARIATION3: Win+A, Shift+Tab 3x, Enter, Tab 2x, Down 2x, Right 3x, Enter=Priority Mode, Enter 2x=Alarm

gregg
  • 6,307
2

Windows Key + N then Enter toggles focus sessions on and off. See https://superuser.com/a/1761680/192857

Fred
  • 351
2

On Windows 11:

  1. ⊞ Win + N (To open the Notification Center)
  2. Shift + Tab (To select the Focus button)
  3. Enter or Space (To activate the Focus button)

This will toggle a Focus mode. In other words, it will either:

  • Start a (30-minute) focus session; or
  • End the focus session (not pause).

On Windows 10:

  1. ⊞ Win + A (To open the Action Center)
  2. Shift + Tab (To select the display brightness)
  3. Shift + Tab (To select the last selected button)
  4. Enter or Space (To activate the button)

Notice the caveat on the Windows 10 option: It will active the last used button, which is not necessarily the Focus Assist button. In practice, I find that set of key commands the most useful for toggling Focus Assist on and off throughout a workday. For a more robust solution not dependent on the last selected button, you can do something like this:

  1. ⊞ Win + A (To open the Action Center)
  2. Shift + Tab (To select the display brightness)
  3. Shift + Tab (To select the last selected button)
  4. End (To select last button in presentation order)
  5. ← Left Arrow (To select the second-to-last button in presentation order)
  6. Enter or Space (To activate the button)

However, this still depends on the presentation order of the buttons, which can be easily configured by right clicking anywhere in the Action Center, and activating the "Edit" menu option. You could minimize the number of keystrokes by moving Focus Assist to the first or last position.

The above methods Windows 10 methods will cycle Focus Assist modes. In other words, they will either:

  • Enable Focus Assist, showing priority notifications only; or
  • Enable Focus Assist, showing alarm notification only; or
  • Disable Focus Assist.
1

The policy setting that controls Toast Notifications is particularly difficult to undo. It is controlled by the Local Group Policy Editor at User Configuration > Administrative Templates > Start Menu and Taskbar > Notifications, policy "Turn off toast notifications". It modifies various registry entries, but also several files, one of whom is in binary format, so not user-modifiable. This is why a Microsoft utility is required for setting it.

I will give below two commands for enabling and disabling Toast Notifications. You may put them in two .bat files and assign them hotekeys, or alternatively use AutoHotkey.

Prerequisite

Download the LGPO utility, the Local Group Policy Object Utility, from Microsoft Security Compliance Toolkit 1.0.

When pressing the Download button, select "LGPO.zip" and click Next to download it. Unzip the archive to obtain this utility in LGPO.exe.

Input files

Create two text files as follows (you may use your own file-names):

1. disable_toast_notifications.txt

User
SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\PushNotifications
NoToastApplicationNotification
DWORD:1

2. enable_toast_notifications.txt

User
SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\PushNotifications
NoToastApplicationNotification
DWORD:0

Disable Toast Notifications

Use the following command in Run as Administrator mode:

\path\LGPO.exe /t \path\disable_toast_notifications.txt

Enable Toast Notifications

Use the following command in Run as Administrator mode:

\path\LGPO.exe /t \path\enable_toast_notifications.txt

For more information see the article
How to use LGPO.exe to modify lgpo settings (with lgpo examples).

harrymc
  • 498,455
0

See here an improved solution based on UIAutomation https://tdalon.blogspot.com/2023/09/ahk-focus-assist.html

It has the advantage not only to toggle the focus mode but really set it as you command it.