[Solved] Power button not working as intended

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.

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):

<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. :grin:

Pending to improve:

  • When pressing the power button again make the menu disappear.
  • :white_check_mark: Change the menu position from the left side to the center of the screen.

Advice?

1 Like
mb-jgtools mblogout

Should appear center of the screen.

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

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.

1 Like

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?

1 Like

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.

1 Like

Maybe something like:

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

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

1 Like

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.