You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

无额外鼠标按键时,如何将Caps Lock键映射为失效的鼠标中键(MMB)功能

无额外鼠标按键时,如何将Caps Lock键映射为失效的鼠标中键(MMB)功能

Hey there! Sorry to hear your middle mouse button is busted—mapping Caps Lock to take its place is totally doable without any extra mouse buttons. Let’s break down how to do this across different operating systems:

Windows系统

The easiest way here is to use AutoHotkey (a free, lightweight tool perfect for custom key mappings):

  • Download and install AutoHotkey from its official site (no extra bloat, promise)
  • Right-click on your desktop, go to New > AutoHotkey Script
  • Open the script file with Notepad, replace the default text with this line:
    CapsLock::Send {MButton}
  • Save the file, then double-click it to run. Now pressing Caps Lock will trigger a middle mouse button click!
  • To make this run automatically when you start your PC, right-click the script file and select Create Shortcut, then move that shortcut into your Startup folder (press Win + R, type shell:startup, hit Enter to open it).

Linux系统

Depending on whether you’re using X11 or Wayland, the steps differ a bit:

For X11 (most traditional Linux desktops like GNOME/Xfce/KDE)

  • Open a terminal and run this command to disable Caps Lock’s default "lock" function and map it to middle click:
    xmodmap -e "clear Lock" -e "keycode 66 = Pointer_Button2"
    Note: 66 is the standard keycode for Caps Lock—if this doesn’t work, run xev in terminal, press Caps Lock, and look for the "keycode" value to use instead.
  • To make this setting stick after reboot, create a file named .Xmodmap in your home directory, paste those two commands (one per line), then add xmodmap ~/.Xmodmap to your desktop’s startup applications.

For Wayland (modern GNOME, KDE Plasma 5.25+, etc.)

  • If you’re on GNOME, open GNOME Tweaks (install it via your software center if you don’t have it), go to the Keyboard & Mouse tab, click Additional Layout Options, expand Caps Lock behavior, and select Caps Lock acts as Middle Click.
  • For other Wayland desktops, you can use tools like wev to identify the Caps Lock key and use ydotool to create a mapping, or check your desktop’s built-in keyboard customization settings—many now support this natively.

macOS系统

Apple’s default settings don’t support this directly, but Karabiner-Elements (a free, powerful key remapping tool) makes it simple:

  • Download and install Karabiner-Elements
  • Open the app, go to the Complex Modifications tab, click Add rule
  • Search for "Caps Lock to Middle Mouse Button" in the list, enable the rule, and you’re done!
  • Alternatively, if you prefer terminal commands, you can use hidutil, but Karabiner’s GUI is way more user-friendly for this task.

All these methods let you use Caps Lock exactly like a middle mouse button—whether you need to click, scroll, or paste text (depending on your system’s middle click behavior). Hope this gets your setup working smoothly again!

备注:内容来源于stack exchange,提问作者Lalka Palka

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.17 13:08:13