Xfce Forum

Sub domains
 

You are not logged in.

#1 2022-10-16 10:10:26

BenyaminL
Member
Registered: 2019-10-11
Posts: 70
Website

[SOLVED] Battery button can be mapped to keyboard shortcut...

As the title stated, the question that I has is, how to remap the battery button to not to follow xfce power manager? As I want map it to standby or turn off the screen using script.

IF I put it into do nothing, the battery button literally done nothing even it's mapped using keyboard settings to some script. I have it not to be handled by the power manager.

Is that possible? Thank you

Last edited by BenyaminL (2022-10-21 00:16:33)

Offline

#2 2022-10-16 15:15:21

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,485

Re: [SOLVED] Battery button can be mapped to keyboard shortcut...

If you check your .xsession-errors (or journalctl --user), you'll notice a "Failed to map keycode 124" error message. If you are using a systemd-based distro, this is because systemd is grabbing it. Edit /etc/systemd/logind.conf, uncomment the "HandlePowerKey" line and set it to "ignore".

After reboot, xfsettingsd will be able to grab it and a keyboard shortcut against the Power Key will work.


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#3 2022-10-20 00:56:33

BenyaminL
Member
Registered: 2019-10-11
Posts: 70
Website

Re: [SOLVED] Battery button can be mapped to keyboard shortcut...

ToZ wrote:

If you check your .xsession-errors (or journalctl --user), you'll notice a "Failed to map keycode 124" error message. If you are using a systemd-based distro, this is because systemd is grabbing it. Edit /etc/systemd/logind.conf, uncomment the "HandlePowerKey" line and set it to "ignore".

After reboot, xfsettingsd will be able to grab it and a keyboard shortcut against the Power Key will work.

Hello, there are no such error, but it doesn work for disabling only on POWER KEY make it done nothing, but not on BATTERY KEY, so I wonder, and I skim on the logind.conf, seems there are none on the list as BatteryKey, uhmm, and the battery key still inhibited by systemd.

I'm on Thinkpad X220 7 row keyboard, if that matter. Is there anyway to focus on Battery key? Thanks

Offline

#4 2022-10-20 01:30:04

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,485

Re: [SOLVED] Battery button can be mapped to keyboard shortcut...

Sorry - not sure how or why I read that as power button.

Does the battery button work with xfce4-power-manager when you set it to, for example, ask? Does it bring up the ask dialog?

Does it elicit a code when pressed that is recognized by xev or xbindkeys?

xev | awk -F'[ )]+' '/^KeyPress/ { a[NR+2] } NR in a { printf "%-3s %s\n", $5, $8 }'

...or

xbindkeys -k

And instead of your script, try just setting the keyboard shortcut to start mousepad or xfce4-terminal. Check your ~/.xsession-errors file to see if anything is logged when you try. Maybe post your ~/.xsession-errors log file as well for review.


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#5 2022-10-20 02:07:50

BenyaminL
Member
Registered: 2019-10-11
Posts: 70
Website

Re: [SOLVED] Battery button can be mapped to keyboard shortcut...

ToZ wrote:

Sorry - not sure how or why I read that as power button.

Does the battery button work with xfce4-power-manager when you set it to, for example, ask? Does it bring up the ask dialog?

Does it elicit a code when pressed that is recognized by xev or xbindkeys?

xev | awk -F'[ )]+' '/^KeyPress/ { a[NR+2] } NR in a { printf "%-3s %s\n", $5, $8 }'

...or

xbindkeys -k

And instead of your script, try just setting the keyboard shortcut to start mousepad or xfce4-terminal. Check your ~/.xsession-errors file to see if anything is logged when you try. Maybe post your ~/.xsession-errors log file as well for review.


Nvm, seems there are glitch, so I need to disable it from power manager, and also logind and reboot twice, seems there are glitch on the system, now working as is after I reboot twice.

There are no errors on the xsession-errors, haha hmm anyway thanks for helping!

Offline

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.009 seconds, 8 queries executed - Memory usage: 534.35 KiB (Peak: 535.2 KiB) ]