Windows Keyboard Filter Management

Prev Next

This topic is more technical than most other knowledge base topics; it is recommended that only IT professionals and/or System Administrators utilize the information discussed below.

Sometimes users will want to limit a keyboard’s effectiveness in interacting with a Scala player. One of the approaches that can support this is the use of the Keyboard Filter feature that is available in Windows 10 and 11. Refer to the following Microsoft Learn webpage for details:

https://learn.microsoft.com/en-us/windows/configuration/keyboard-filter/

You can set up the key and/or key combination filtering feature using Windows Management Instrumentation (WMI) providers through the attached PowerShell scripts. These PowerShell scripts include:

  • EnableKeyboardFilter.ps1: enables the keyboard filter for a set of keys and/or key combinations.

  • DisableKeyboardFilter.ps1: removes all the key and/or key combinations filtering on the system.

  • ListKeyboardConfig.ps1: shows the current keyboard configuration.

  • EnableWindowsKey.ps1: enables the Windows Key filtering

  • DisableWindowsKey.ps1: disables the Windows Key filtering

This set contains the following custom key(s) and predefined keys.

Custom Key(s)

The default custom key to be filtered is:

ESCAPE

There are several examples at the end of EnableWindowsKey.ps1 that shows how to filter custom keys such as “Ctrl+V”, “Numpad0”, "Shift+Numpad0", “%”, “Ctrl+Alt+N”, etc. You may create other keys to be filtered by following these examples.

Predefined Key Combinations

The following are known Windows Key Combinations that are disabled by default.

Application keys

The following table contains predefined key combinations for controlling application state:

Key combination

WEKF_PredefinedKey.Id

Blocked behavior

Alt + F4

Alt+F4

Close application.

Ctrl + F4

Ctrl+F4

Close window.

Windows key + F1

Win+F1

Open Windows Help.

Security keys

The following table contains predefined key combinations for OS security:

Key combination

WEKF_PredefinedKey.Id

Blocked behavior

Ctrl + Alt + Delete

Ctrl+Alt+Del

Open the Windows Security screen.

Ctrl + Shift + Esc

Shift+Ctrl+Esc

Open Task Manager.

Windows key + L

Win+L

Lock the device.

Accessibility keys

The following table contains predefined key combinations for accessibility:

Key combination

WEKF_PredefinedKey.Id

Blocked behavior

Left Alt + Left Shift + Print Screen

LShift+LAlt+PrintScrn

Open High Contrast.

Left Alt + Left Shift + Num Lock

LShift+LAlt+NumLock

Open Mouse Keys.

Windows key + U

Win+U

Open Ease of Access Center.

Shell keys

The following table contains predefined key combinations for general UI control:

Key combination

WEKF_PredefinedKey.Id

Blocked behavior

Alt + Spacebar

Alt+Space

Open shortcut menu for the active window.

Ctrl + Esc

Ctrl+Esc

Open the Start screen.

Ctrl + Windows key + F

Ctrl+Win+F

Open Find Computers.

Windows key + Break

Win+Break

Open System dialog box.

Windows key + E

Win+E

Open Windows Explorer.

Windows + F

Win+F

Open Search.

Windows key + P

Win+P

Cycle through Presentation Mode. Also blocks the Windows key + Shift + P and the Windows key + Ctrl + P key combinations.

Windows key + R

Win+R

Open Run dialog box.

Alt + Tab

Alt+Tab

Switch task. Also blocks the Alt + Shift + Tab key combination.

Ctrl + Tab

Ctrl+Tab

Switch window.

Windows key + Tab

Win+Tab

Cycle through Microsoft Store apps. Also blocks the Windows key + Ctrl + Tab and Windows key + Shift + Tab key combinations.

Windows key + D

Win+D

Show desktop.

Windows key + M

Win+M

Minimize all windows.

Windows key + Home

Win+Home

Minimize or restore all inactive windows.

Windows key + T

Win+T

Set focus on taskbar and cycle through programs.

Windows key + B

Win+B

Set focus in the notification area.

Windows key + Minus Sign

Win+-

Zoom out.

Windows key + Plus Sign

Win++

Zoom in.

Windows key + Esc

Win+Esc

Close Magnifier application.

Windows key + Up Arrow

Win+Up

Maximize the active window.

Windows key + Down Arrow

Win+Down

Minimize the active window.

Windows key + Left Arrow

Win+Left

Snap the active window to the left half of screen.

Windows key + Right Arrow

Win+Right

Snap the active window to the right half of screen.

Windows key + Shift + Up Arrow

Win+Shift+Up

Maximize the active window vertically.

Windows key + Shift + Down Arrow

Win+Shift+Down

Minimize the active window.

Windows key + Shift + Left Arrow

Win+Shift+Left

Move the active window to left monitor.

Windows key + Shift + Right Arrow

Win+Shift+Right

Move the active window to right monitor.

Windows key + Spacebar

Win+Space

Switch layout.

Windows key + O

Win+O

Lock device orientation.

Windows key + Page Up

Win+PageUp

Move a Microsoft Store app to the left monitor.

Windows key + Page Down

Win+PageDown

Move a Microsoft Store app to right monitor.

Windows key + Period

Win+.

Snap the current screen to the left or right gutter. Also blocks the Windows key + Shift + Period key combination.

Windows key + C

Win+C

Activate Cortana in listening mode (after user has enabled the shortcut through the UI).

Windows key + I

Win+I

Open Settings charm.

Windows key + K

Win+K

Open Connect charm.

Windows key + H

Win+H

Start dictation.

Windows key + Q

Win+Q

Open Search charm.

Windows key + W

Win+W

Open Windows Ink workspace.

Windows key + Z

Win+Z

Open app bar.

Windows key + /

Win+/

Open input method editor (IME).

Windows key + J

Win+J

Swap between snapped and filled applications.

Windows key + Comma

Win+,

Peek at the desktop.

Windows key + V

Win+V

Cycle through toasts in reverse order.

Setting up Windows Keyboard Filters

The steps to set up keyboard filters for our Windows players are as follows:

  1. Turn on the Windows Keyboard Filter feature on your Windows player.      

    This feature is on by default, but you should verify it as follows:

    1. In the Windows search bar, begin typing “Turn Windows features on or off” until a link by that name appears in the menu. Click the link to open the Windows Features window.

    2. In the Windows Features window, expand the Device Lockdown node, then ensure the checkbox for Keyboard Filter is selected.

    3. If the checkbox is cleared, select the checkbox, then restart your device.

  2. Configure the Keyboard Filter using a PowerShell script EnableKeyboardFilter.ps1 in the KeyboardFilter.zip archive, which contains all the PowerShell scripts to configure and set up the Keyboard Filter. All the files mentioned below come from this archive.

    KeyboardFilter V3
    5.78 KB

    In EnableKeyboardFilter.ps1, we have disabled all the predefined key combinations specified in the Predefined Key Combinations section.

    The Escape key is also disabled

    If you want to disable other custom keys and/or scancodes, you can add additional lines at the end of the script. For example, you may filter:

    • Ctrl+V by entering Enable-Custom-Key "Ctrl+V"

    • END key on the NumPad by entering Enable-Custom-Key "Shift+Numpad0"

    • Ctrl+Alt+N by entering Enable-Scancode "Ctrl+Alt" 49”; 49 is the scan code of N

  3. Set up the Keyboard Filter on our player using Windows Task Scheduler[NM1.1] as follows:      

    1. Open Task Scheduler

    2. Click Create Task

    3. Under the General tab:          

      • Name the task (e.g., “Enable Keyboard Filter for Player account and Disable Keyboard Filter for Config account”)

      • Select the Run only when user is logged on option.

      • Select a specific user in the When running the task, use the following user account field.

      • Optionally, select the Run with Highest privileges checkbox.

    4. Under the Triggers tab:          

      • Click the New… button, then select At logon in the Begin the task: field.

      • Select the Specific user option.

      • Click OK.

    5. Under the Actions tab:          

      • Click the New… button, then select Start a program in the Action field.

      • In the Program/script field, enter powershell.exe.

      • In the Add arguments field, enter:

      -ExecutionPolicy Bypass -File "C:WindowsSystem32GroupPolicyMachineScriptsStartupEnableKeyboardFilter.ps1"

      for the Player account

      -ExecutionPolicy Bypass -File "C:WindowsSystem32GroupPolicyMachineScriptsStartupDisableKeyboardFilter.ps1"

      for the Config account.

In summary, if the above three steps are performed, then the Keyboard Filter feature will be activated with defined custom key(s) and predefined key combinations in EnableKeyboardFilter.ps1 when Scala Player account is logged on, and the filtering will be deactivated when Scala Config account is logged on.

Setting up Linux Keyboard Filters

The steps to set up keyboard filters for our Windows players are as follows:

  1. Installation can be done through its source or using PPA. You may use the following to install it from source:      

    git clone https://github.com/rvaiya/keyd
    cd keyd
    make && sudo make install
    sudo systemctl enable --now keyd

    You could also install it via PPA:

    sudo add-apt-repository ppa:keyd-team/ppa
    sudo apt update
    sudo apt install keyd
    sudo systemctl enable --now keyd
  2. Configuration is done in /etc/keyd/default.conf. Attached “default blockall.conf” and “default blocksome.conf” are two samples to block all the key inputs and block Esc, Ctrl+Shift+t and Alt+F4, respectively. Rename either of them to default.conf and put it under /etc/keyd/. You may use the key names defined in “keyd_key_names.txt” to configure whatever keys or key combinations you want to block.

  3. Start and stop the daemon. Because keyd is a system daemon, we suggest making sudoers with NOPASSWD first in Step 3.a below (otherwise, a password is required to start and stop keyd):      

    1. Edit sudoers to bypass password: Use sudo visudo to edit the /etc/sudoers file. Add the following two lines to it to bypass the password when we start and stop the daemon:          

      config ALL=(ALL) NOPASSWD: /user/bin/systemctl stop keyd
      player ALL=(ALL) NOPASSWD: /user/bin/systemctl restart keyd
    2. Use one of the following procedures          

      • Use Config-Pro to stop and restart keyd by running              

        systemctl stop keyd,
        systemctl restart keyd

        on Config and Player accounts, respectively.

      • Run the daemon automatically when logging on to the Player account and the daemon will stop when the Config account is logged on as follows:              

        1. Put attached keyd-user-launch.sh in /user/local/bin

        2. Make it executable

        3. chmod +x /usr/local/bin/keyd-user-launch.sh

        4. Add attached keyd.desktop to each user’s autostart folder, i.e. /home/config/.config/autostart and /home/plaer/.config/autostart.

Now daemon keyd will run on Player account and stop on Config account.