The power button on a laptop is one of the most important, yet most underrated controls. By default, it performs a standard function: it starts the system or turns it off when held for a long time. However, few people know that this button can be reconfigure to suit your needs - for example, make it put the device into sleep mode, lock the screen, or even launch a specific application.
In this article we will look at all the possible ways to change the behavior of the power button on laptops with Windows, Linux And macOS. You will learn how to set up the response to short and long presses, what tools you will need for this, and what hidden BIOS/UEFI functions may affect the result. And also what risks should be taken into account so as not to turn the experiment into an expensive repair.
Why reassign the power button and what functions can be assigned
At first glance, changing the default behavior of the power button may seem pointless. However, there are a few scenarios where this becomes really useful:
- 🔄 Quick sleep mode — if you are often away from your laptop, but don’t want to turn it off completely.
- 🔒 Instant screen lock — convenient for protecting confidential data in the office or public places.
- 🚀 Launching the application - for example, opening Spotify or Steam with one click.
- ⚡ Emergency shutdown — if the system is frozen and standard methods do not work.
- 🔧 Diagnostic mode - some manufacturers (for example, Lenovo or Dell) allow you to assign a button to run hardware tests.
It is important to understand that not all functions are available at the operating system level. For example, launching applications usually requires third-party software, while changing diets can be configured in standard settings Windows or Linux. It is also worth considering that on some laptops (especially gaming ones, like ASUS ROG or MSI) the power button may be hard-wired to hardware functions, and reassigning it would require intervention. BIOS/UEFI.
- Only for on/off
- To put into sleep mode
- To lock the screen
- Other (write in comments)
Remapping the power button in Windows 10 and 11
B Windows changing the behavior of the power button is done through Control panel or Options. This method works on most laptops (HP, Acer, Lenovo etc.), but does not affect hardware functions such as forced shutdown when frozen.
To change what the power button does:
- Open
Start → Settings → System → Power and Sleep. - From the right menu select
Additional power options. - In the left column, click
What the power buttons do. - Click
Change settings that are currently unavailable(Administrator rights required). - In the section
Shutdown Optionsselect action for:- 🔘
Power button(short press) - 🔘
Sleep button(if any)
- 🔘
Available options:
| Option | Description | Applicability |
|---|---|---|
Shutdown |
Complete shutdown of the laptop | All models |
Dream |
Putting to sleep mode while saving the session | All models |
Hibernation |
Saving state to disk and shutting down | Requires hibernation to be enabled on the system |
Lock |
Lock the screen without logging out | Windows 10/11 Pro and Enterprise |
No action |
Ignoring clicks | Not recommended for power button |
⚠️ Attention: If you choose No action for the power button, then if the system freezes, you will have to remove the battery or hold the button for more than 10 seconds to force shutdown. This may be inconvenient on laptops with a non-removable battery (for example, MacBook or Dell XPS).
Create a system restore point
Check for driver updates
Make sure the laptop is connected to the network (not on battery)
Write down the current settings in case of a rollback-->
Reassigning a button on Linux laptops (Ubuntu, Fedora, Arch)
B Linux reconfiguring the power button is done through configuration files or utilities like acpid. This method is more flexible than Windows, but requires working with a terminal.
Main methods:
- 📝 Via
logind.conf— changes behavior at the system level. - 🛠️ Via
acpid— allows you to assign your own scripts. - 🖥️ Through the desktop environment (For example, GNOME or KDE).
Consider the method with logind.conf (works on most distributions):
- Open a terminal and enter:
sudo nano /etc/systemd/logind.conf - Find the lines:
#HandlePowerKey=poweroff#HandleSleepKey=suspendand uncomment them, replacing the values with the ones you need. Available options:
poweroff- shutdown;reboot- reboot;halt— stopping the system;suspend- sleep;hibernate- hibernation;hybrid-sleep- hybrid sleep;ignore- no action;lock— screen lock (requires additional settings).
Ctrl+O, then Enter) and close the editor (Ctrl+X).sudo systemctl restart systemd-logind
For appointment arbitrary actions (for example, running a script) use acpid:
- Install
acpidif it is not installed:sudo apt install acpid # Для Debian/Ubuntusudo dnf install acpid # Для Fedora - Create an event file in
/etc/acpi/events/, for example:sudo nano /etc/acpi/events/powerbtnand add:
event=button/poweraction=/path/to/your/script.sh - Restart the service:
sudo systemctl restart acpid
⚠️ Attention: On some distributions (for example, Arch Linux) acpid may conflict with systemd-logind. In this case, disable one of the services or configure them to work together via udev.
Example script to launch Spotify using the power button
#!/bin/bash
# Check if Spotify is running
if pgrep -x "spotify" > /dev/null; then
# If running, close it
pkill spotify
else
# If not running, open it
spotify &
fi
Remapping a button on MacBook (macOS)
On laptops Apple The options for remapping the power button are extremely limited. Unlike Windows or Linux, macOS does not provide built-in tools to change its behavior. However there are workarounds:
- 🔄 Usage BetterTouchTool — allows you to assign actions to key combinations, but not to the power button itself.
- 🔧 Change through
pmset— controls the reaction to closing the lid, but not to the button. - 🚫 Hardware limitations - on new ones MacBook (with chips M1/M2) the power button is hardwired to
Secure Bootand cannot be reassigned.
The only working method for older models (MacBook Pro until 2018, MacBook Air until 2017) - use pmset to change the reaction to retention buttons:
- Open
Terminal. - Enter the command to view the current settings:
pmset -g - To change the button hold action (default is force off), use:
sudo pmset -a powerbutton 0where
0— disables the reaction (but not recommended), and1- returns standard behavior.
For appointment arbitrary actions (for example, launching an application) you will need:
- Install Karabiner-Elements or BetterTouchTool.
- Create a rule for a key combination (for example,
Ctrl+Cmd+Power). - Assign the desired action (script, application, etc.) to this combination.
⚠️ Attention: On MacBook with Touch Bar power button integrated into the chip T2 or Apple Silicon, and its reassignment may lead to loss of warranty or unstable system operation. Apple does not officially support such changes.
If you need to quickly lock your MacBook, use the combination Ctrl+Cmd+Q - it's safer than experimenting with the power button.
Reassigning a button via BIOS/UEFI: risks and opportunities
Some laptop manufacturers (Lenovo ThinkPad, Dell Latitude, HP EliteBook) allow you to change the behavior of the power button directly in BIOS/UEFI. This is the lowest level method, but also the riskiest - incorrect settings can make the laptop inoperable.
What can be configured in the BIOS:
- 🔌 Power Button Behavior - choice between
Instant Off(instant shutdown) andSleep(transition to sleep). - 🔄 Wake on Power Button — allow or disable turning on the laptop with the power button.
- 🛡️ Secure Boot Override - on some models the power button can be used to reset Secure Boot.
- 🔧 Diagnostic Mode — running hardware tests (for example, Lenovo Diagnostics or Dell ePSA).
How to enter BIOS/UEFI and change settings:
- Restart your laptop and press the BIOS enter key (usually
F2,Del,EscorF12- depends on the manufacturer). - Find a section
Power ManagementorAdvanced. - Look for options related to
Power ButtonorPower Options. - Change the value and save the settings (
F10).
⚠️ Attention: If there is an option in the BIOS Fast Boot, her must be disabled before changing the power button settings. Otherwise, the laptop may ignore new settings or boot with errors.
| Manufacturer | BIOS entry key | Section with button settings |
|---|---|---|
| Lenovo ThinkPad | F1 or Enter + F1 |
Config → Power |
| Dell Latitude/XPS | F2 |
Advanced → Power Management |
| HP EliteBook/Spectre | F10 or Esc → F10 |
System Configuration → Built-In Device Options |
| ASUS ROG/ZenBook | F2 or Del |
Advanced → APM Configuration |
Changes to the BIOS/UEFI are applied at the hardware level and are retained even after reinstalling the operating system. This means that incorrect settings can render the laptop inoperable until the CMOS is reset (BIOS settings are reset).
Third party programs for advanced remapping
If standard means Windows or Linux is not enough, you can use specialized utilities. They allow you to assign the power button any actions - from running scripts to emulating keystrokes.
Popular programs:
- 🖱️ PowerToys (Windows) — a tool from Microsoft with a module
PowerToys Awake, which can intercept power button events. - 🔧 AutoHotkey (Windows) - allows you to create scripts to remap buttons, including the power button (requires administrator rights).
- 🐧 xbindkeys (Linux) - a utility for binding actions to keys and buttons.
- 🍎 Karabiner-Elements (macOS) - Advanced keyboard and button controls (limited power button support).
Example script for AutoHotkey, which locks the screen when you press the power button:
#NoEnv#SingleInstance Force
SetTitleMatchMode, 2
; Перехват события кнопки питания (требует запуска от администратора)
$PowerButton::
{
Run, rundll32.exe user32.dll,LockWorkStation
return
}
For Linux with xbindkeys:
- Install
xbindkeysAndxte:sudo apt install xbindkeys xautomation - Create a config:
xbindkeys --defaults > $HOME/.xbindkeysrc - Add the line to the file:
"xte 'key XF86ScreenSaver'"m:0x0 + c:124(where
c:124— power button code may differ). - Run
xbindkeys.
⚠️ Attention: Third-party programs that intercept hardware buttons may conflict with the manufacturer's drivers. For example, on laptops Lenovo with utility Lenovo Vantage AutoHotkey may not work correctly. In this case, you will have to disable the manufacturer’s standard services.
Common problems and their solutions
When remapping the power button, users often encounter unexpected difficulties. Let's look at the most common of them and how to eliminate them.
Problem 1: The laptop does not respond to changes in Windows.
- 🔹 Check if the settings are overriding power plan your changes. Go to
Control Panel → Power Options → Plan Settings → Change Advanced Settingsand make sure the button options don't conflict. - 🔹 Update your chipset drivers and ACPI through Device Manager.
- 🔹 If the laptop Lenovo or Dell, remove proprietary power management utilities (for example, Lenovo Energy Management).
Problem 2: After changing the BIOS, the laptop does not turn on.
- 🔹 Complete reset BIOS - remove the battery (if removable) and turn off the power, then hold the power button for 30 seconds.
- 🔹 Some motherboards have a jumper
CLR_CMOS- close it for 10 seconds. - 🔹 If the laptop HP, try the combination
Win+B+hold power buttonto reset.
Problem 3: The power button works unpredictably (it works, sometimes it doesn’t).
- 🔹 Check it out button contacts - she may be physically damaged.
- 🔹 Disable all third-party power management programs.
- 🔹B Linux check the logs
acpid:journalctl -u acpid -b
Problem 4: On MacBook The power button is not reassigned.
- 🔹 On models with Apple Silicon (M1/M2) this is a hardware limitation - there is no way to bypass it.
- 🔹 On old ones MacBook try resetting
SMC:sudo shutdown -h now# После выключения удерживайте Shift+Ctrl+Option + кнопка питания 10 секунд
If after the changes the laptop stops turning on, do not panic - in 90% of cases, resetting the BIOS or removing the battery helps. Contact the service center only if these methods do not work.
FAQ: Answers to frequently asked questions
Is it possible to reassign the power button to launch a game or program?
Yes, but only with the help of third-party utilities like AutoHotkey (Windows) or xbindkeys (Linux). On macOS this is not possible without workarounds (such as binding to a key combination).
Example for AutoHotkey:
$PowerButton::{
Run, "C:\Program Files\Steam\steam.exe"
return
}
Please note: the script must be run with administrator rights.
Why does the power button sometimes not work after remapping?
This can happen for several reasons:
- Conflict with manufacturer drivers (for example, Lenovo Hotkey Driver).
- Unstable work
ACPI(check the logs inEvent Viewer → System Logs). - Physical wear of the button (often found on older ASUS or Acer).
Solution: update the drivers, test the button on another laptop (if it’s removable) or return the default settings.
Is it possible to make the power button work like Touch ID on a MacBook?
No, this is a hardware limitation. Power button on MacBook with Touch ID integrated into the security system Apple T2 or Apple Silicon, and its reassignment is blocked at the firmware level.
However, you can assign another fingerprint scanner (if it is connected via USB) to lock the screen via System Settings → Touch ID.
How to reset the power button to default settings?
The method depends on where you made the changes:
- Windows: Return the parameters to
Control Panel → Power Options → What the Power Buttons Do. - Linux: Return default values to
/etc/systemd/logind.confor delete custom rulesacpid. - BIOS: Perform a factory reset (
Load Default Settings). - Third party programs: Remove scripts or disable startup utilities.
Is it safe to remap the power button on a dual OS (dual boot) laptop?
Yes, but with reservations:
- Settings Windows will not affect Linux, and vice versa.
- Changes in
BIOS/UEFIwill apply to all operating systems. - If you use GRUB or another bootloader, make sure it doesn't conflict with your power settings.
Recommendation: configure the button separately in each OS, without touching the BIOS.