# \[Solved\] Power button not working as intended

**URL:** https://forum.maboxlinux.org/t/solved-power-button-not-working-as-intended/1066
**Category:** Bug reports
**Created:** [August 31, 2022, 4:18pm UTC](https://forum.maboxlinux.org/t/solved-power-button-not-working-as-intended/1066 "2022-08-31T16:18:41Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![M0nst3r](https://forum.maboxlinux.org/user_avatar/forum.maboxlinux.org/m0nst3r/32/1669_2.png) [@M0nst3r](https://forum.maboxlinux.org/u/M0nst3r)
#### Post date: [August 31, 2022, 4:18pm UTC](https://forum.maboxlinux.org/t/solved-power-button-not-working-as-intended/1066/1 "2022-08-31T16:18:41Z")

</div>

Hi, good fellas. After a fresh install of Mabox 22.08.20 and some fiddling, still couldn’t make the power button works the way I need.

In order to avoid data loss and/or unexpected shutdowns after an accidental press of the power button, I always change its configuration into “Asking”. For Mabox is quite straightforward, just visit the Energy options (which invokes **mate-power-preferences** ) and set it on the General tab. The problem is that no matter what you choose, it will _always_ shuts down the computer if you press the power button.

Reading here and there found that installing **xfce4-power-manager** is a common advice to fix the problem in Openbox. In my case, oddly enough, it fixed another issue with the brightness buttons but not the power button. Even if I set it to “Ask” in **xfce4** ’s dialog still does not work, instead, the power button is now being ignored and does nothing at all.

The expected behavior should be a dialog box asking what to do when you press the power button. Any fix or advice please?

Regards.

---

<div class="post-metadata">

### Author: ![M0nst3r](https://forum.maboxlinux.org/user_avatar/forum.maboxlinux.org/m0nst3r/32/1669_2.png) [@M0nst3r](https://forum.maboxlinux.org/u/M0nst3r)
#### Post date: [August 31, 2022, 8:03pm UTC](https://forum.maboxlinux.org/t/solved-power-button-not-working-as-intended/1066/2 "2022-08-31T20:03:19Z")

</div>

Funnily enough, I kept reading and finally came up with a possible solution for this problem:

Edit the _~/.config/openbox/rc.xml_ file and insert the following (I did at line 656):

```auto
<keybind key="XF86PowerOff">
      <action name="Execute">
        <command>mb-jgtools mblogout</command>
      </action>
</keybind>

```

Save, close and reload the config or simply restart your computer. Now, every time you press the power button, the Mabox’s Power menu appears instead. 😁

Pending to improve:

- When pressing the power button again make the menu disappear.
- ✅ Change the menu position from the left side to the center of the screen.

Advice?

---

<div class="post-metadata">

### Author: ![napcok](https://forum.maboxlinux.org/user_avatar/forum.maboxlinux.org/napcok/32/410_2.png) [@napcok](https://forum.maboxlinux.org/u/napcok)
#### Post date: [August 31, 2022, 8:21pm UTC](https://forum.maboxlinux.org/t/solved-power-button-not-working-as-intended/1066/3 "2022-08-31T20:21:34Z")

</div>

```auto
mb-jgtools mblogout

```

Should appear center of the screen.

@M0nst3r do you think it should be configured like that by default?

---

<div class="post-metadata">

### Author: ![M0nst3r](https://forum.maboxlinux.org/user_avatar/forum.maboxlinux.org/m0nst3r/32/1669_2.png) [@M0nst3r](https://forum.maboxlinux.org/u/M0nst3r)
#### Post date: [August 31, 2022, 8:55pm UTC](https://forum.maboxlinux.org/t/solved-power-button-not-working-as-intended/1066/4 "2022-08-31T20:55:29Z")

</div>

Edited my post to reflect your tip. Effectively, changing command from **mb-jgtools mblogout ipc** to **mb-jgtools mblogout** centers the dialog in the screen.

Configuring this as default would be great but as many people surely prefers otherwise and keeping in mind that **mate-power-preferences** doesn’t works in the first place, maybe could be another option in Mabox Control Center. This way would be easier to choose what every power related button does, including the “asking” scenario.

---

<div class="post-metadata">

### Author: ![napcok](https://forum.maboxlinux.org/user_avatar/forum.maboxlinux.org/napcok/32/410_2.png) [@napcok](https://forum.maboxlinux.org/u/napcok)
#### Post date: [August 31, 2022, 9:10pm UTC](https://forum.maboxlinux.org/t/solved-power-button-not-working-as-intended/1066/5 "2022-08-31T21:10:52Z")

</div>

honestly, I do not have any preferences on this subject - I do not use powermanager or these keys. Nor will I spend too much time on this issue. Perhaps it would be best to ask interested users. I can try to create a poll;)  
_Update_  
Here it is → [Power Manager and Power Button for Mabox Istredd?](https://forum.maboxlinux.org/t/power-manager-and-power-button-for-mabox-istredd/1069)

---

<div class="post-metadata">

### Author: ![M0nst3r](https://forum.maboxlinux.org/user_avatar/forum.maboxlinux.org/m0nst3r/32/1669_2.png) [@M0nst3r](https://forum.maboxlinux.org/u/M0nst3r)
#### Post date: [October 4, 2022, 7:04pm UTC](https://forum.maboxlinux.org/t/solved-power-button-not-working-as-intended/1066/6 "2022-10-04T19:04:15Z")

</div>

For the sake of completeness I changed the title because -technically- the most important part was indeed solved. The second detail will be included as soon as I figure out how to do it.

Cheers.

---

<div class="post-metadata">

### Author: ![napcok](https://forum.maboxlinux.org/user_avatar/forum.maboxlinux.org/napcok/32/410_2.png) [@napcok](https://forum.maboxlinux.org/u/napcok)
#### Post date: [October 4, 2022, 7:20pm UTC](https://forum.maboxlinux.org/t/solved-power-button-not-working-as-intended/1066/7 "2022-10-04T19:20:51Z")

</div>

Maybe something like:

```auto
#!/bin/bash
if [$(pidof mb-jgtools)]; then
    killall mb-jgtools
else
mb-jgtools mblogout
fi

```

Didn’t check that 🙂  
PS. You can close any menu, sidepanel or other mabox tool based on jgmenu by hitting Esc

---

<div class="post-metadata">

### Author: ![M0nst3r](https://forum.maboxlinux.org/user_avatar/forum.maboxlinux.org/m0nst3r/32/1669_2.png) [@M0nst3r](https://forum.maboxlinux.org/u/M0nst3r)
#### Post date: [October 4, 2022, 7:33pm UTC](https://forum.maboxlinux.org/t/solved-power-button-not-working-as-intended/1066/8 "2022-10-04T19:33:09Z")

</div>

I’m doing exactly that in the meantime because is not a big deal.

The _rc.xml_ file, for those interested, does not support Shell Script code directly. That means you must create the script above and then point to it inside that file.

---

<div class="post-metadata">

### Author: ![Imnewhere](https://forum.maboxlinux.org/user_avatar/forum.maboxlinux.org/imnewhere/32/3210_2.png) [@Imnewhere](https://forum.maboxlinux.org/u/Imnewhere)
#### Post date: [March 22, 2024, 8:29pm UTC](https://forum.maboxlinux.org/t/solved-power-button-not-working-as-intended/1066/9 "2024-03-22T20:29:18Z")

</div>

I am having this problem currently, no combination of keybindings changes the power buttons action of powering off immediately. The script WAS working as recently as two days ago.
