I've bought the ROG G551JM Asus laptop which proven to be Ubuntu-compatible. The computer's keyboard is ill-designed with the key "Poweroff" being an ordinary key, placed in the spot, where one usually finds the "End" key. The computer is fine otherwise, so I bought it with the assumption, that I would be able to somehow "fix" the problem, i.e. remap the PowerOff button into the "End" key.

The PowerOff button made wrong (ASUS G551JM): ASUS G551JM

Normally there is an «End» key (ASUS N56VZ): ASUS N56VZ

The "PowerOff" button events are produced by the /dev/input/event2: Power Button device (as reported by evtest) with code 116 (example line from evtest: Event: time 1422895638.246142, type 1 (EV_KEY), code 116 (KEY_POWER), value 1)

The key is also visible to X server, and ultimately Ubuntu can identify key presses as a PowerOff key and launches the "Goodbye user Adam..." semi-transparent dialog box that confirms my will to actually turn the computer off.

The problem is that the binding that binds the PowerOff key press with the routine that displays that confirmation dialog is not visible under dconf-editor and I have no hint where to find it.

Can anyone tell me, where to change (or delete) the default binding for the PowerOff key???

It should be something easy.

edit 21.IX.2016:

There is a way to permanently disable the dialog box, see How do I modify the options for the power button? . I hope that after disabling the power button, it would be possible to re-assign it to something else.

  • Have you solved the issue? It would be very useful if you post an answer here.
    – ezze
    Sep 21, 2016 at 13:28
  • 1
    @Ezze Not really (I am using different computer because of this issue). But I managed to permanently disablethe shutdown dialog produced after pressing the key. OK, I'll update the answer. Sep 21, 2016 at 16:58
  • Related question on Unix & Linux StackExchange.
    – ezze
    Sep 22, 2016 at 9:29
  • 4
    I hate ASUS so much for removing that key. Home and End are the "meta" keys I use the most... :(
    – Matthieu
    Oct 5, 2016 at 11:11

2 Answers 2


I was able to get it working on my ASUS N751JK in Ubuntu 18.04 LTS and Ubuntu 16.04 LTS (tested with Unity desktop environment in both cases and KDE Plasma in 18.04):

  1. First of all, set action of "Power Off" button to nothing.


    Like mentioned in answer of Johano Fierra:

    gsettings set org.gnome.settings-daemon.plugins.power button-power "nothing"

    or alternatively sudo apt install dconf-tools and use dconf-editor to change org.gnome.settings-daemon.plugins.power property (like described here). Reboot or logout is required to make it working.


    Go to "System Settings", select "Power Management" tab in "Hardware" section and then select "Energy Saving" tab, scroll down, find "When power button pressed" dropdown list and change its value to "Do nothing". Click "Apply" button for changes to take an effect.

    Energy saving

  2. Install xdotool:

    sudo apt install xdotool

    This one will allow us to trigger key events.

  3. Next step is to trigger "End" key press on "Power off" button press.

    Ubuntu 18.04

    Create /etc/acpi/events/power file with the following contents:

    action=/etc/acpi/power.sh "%e"

    and create /etc/acpi/power.sh script with the following contents:

    xdotool key End

    and add execution permissions to it:

    sudo chmod +x /etc/acpi/power.sh

    Ubuntu 16.04

    Backup ACPI script used to handle "Power Off" button's event:

    sudo cp /etc/acpi/powerbtn.sh /etc/acpi/powerbtn.sh.backup

    Then edit it, find the following:

    # If logind is running, it already handles power button presses; desktop
    # environments put inhibitors to logind if they want to handle the key
    # themselves.

    and modify the code below so it looks like:

    if pidof systemd-logind >/dev/null; then
        xdotool key End
        exit 0
  4. In order to apply these changes one should run:

    sudo acpid restart

    Thanks to Adam it's possible to restart acpid automatically when a user logs in (on system boot). So instead of manual sudo acpid restart in terminal each time after reboot add the following line:

    session optional    pam_exec.so /usr/sbin/acpid restart

    to the end of /etc/pam.d/common-session file.

  • What about sudo acpid reload instead of restart? Would that work?
    – Byte Commander
    Sep 25, 2016 at 21:16
  • sudo acpid reload also works for me when I run it manually in terminal. But it doesn't help when I place acpid reload in /etc/rc.local or in bash script specified by LightDM's session-setup-script.
    – ezze
    Sep 26, 2016 at 9:09
  • 1
    What solves the acpid restart problem is to add a line session optional pam_exec.so /usr/sbin/acpid restart at the end of /etc/pam.d/common-session. This way the acpid will get restarted just after user login and this is just enough for me. Problem solved at last!! Dec 4, 2016 at 20:32
  • 1
    @rtindru, you should gsettings set instead of gsettings get.
    – ezze
    May 18, 2018 at 22:02
  • 1
    In order to make this work in Kubuntu 18.04, I had to give execution permissions to power.sh: sudo chmod +x /etc/acpi/power.sh @Ezze, maybe you could update your answer to include this.
    – LGenzelis
    Mar 12, 2019 at 19:12

This should do the trick.

Enter in terminal:

gsettings set org.gnome.settings-daemon.plugins.power button-power "nothing"
  • 2
    YES!!! But then there is another thing: how to map it into the «end» key? Feb 2, 2015 at 17:31
  • 1
    Entering uncharted territory here, but I think you could just create a xmodmap file config (${HOME}/.xmodmap) and then put this in it: keycode 116 = End, or enter in terminal: xmodmap -e "keycode 116 = End" Feb 2, 2015 at 17:53
  • Unfortunately, it doesn't help. It disables capturing of "Power off" button as it seen by xev command and prevents xmodmap to remap it. And by the way, "Power off" button's keycode may be different (124 for my ASUS N751JK).
    – ezze
    Sep 21, 2016 at 13:26
  • It should not disable the ability to capture the button... but how about this. Enter in terminal: gsettings set org.gnome.settings-daemon.plugins.power button-power "shutdown" (so pressing the button is captured), then edit /etc/acpi/events/powerbtn and comment out the line #action=/etc/acpi/powerbtn.sh, and then enter in terminal: xmodmap -e "keycode 124 = End" This should prevent the power button from doing anything and in the same time map it to the End key. Sep 22, 2016 at 17:15
  • 1
    It doesn't help too cause "Power off" event is handled not only by powerbtn.sh script but also by (at least) systemd-logind service (probably, it uses button-power setting you mentioned in your answer). You can find if pidof systemd-logind >/dev/null; then...exit 0 line in powerbtn.sh which means that the script lets systemd-logind to handle "Power off" event by itself when desktop session is active. One thing you are right about — changing button-power value doesn't affect the ability to capture the key but it's already captured by some process (systemd-logind or other).
    – ezze
    Sep 26, 2016 at 8:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .