You are not logged in.

#1 2015-09-17 21:11:20

rabarrett
Member
Registered: 2012-07-05
Posts: 99

Acer c720 Laptop: How to turn power key into delete key?

Can anyone help me figure out how to do this or is it not possible?


I was hoping I could make it function as delete key (but long press and hold would still power down).

I'm not sure if I would use xmodmap or something else.

Last edited by rabarrett (2015-09-17 21:12:02)

Offline

#2 2015-12-26 18:22:39

Oliver_RA
Member
Registered: 2014-08-26
Posts: 3

Re: Acer c720 Laptop: How to turn power key into delete key?

The answer depends on whether you want this to work in X, console or both. I am currently trying to get both working.

In either case, you have to change the

/etc/systemd/logind.conf

to ignore the powerkey keypress, and restart the systemd-logind.service: https://wiki.archlinux.org/index.php/Ch … h_handling

In X, you can use ~/.Xmodmap, in this case we have keycode 124.

keycode 124 = Delete

I don't know how to make holding down the power key add the extra functionality of shutting down, but I made Ctrl-Alt-Backspace take me to the openbox logout screen. I am able to logout of X, reboot, etc. from there. I did this by adding something like this to

~/.config/openbox/rc.xml
<keyboard>
  <keybind key="C-A-BackSpace">
    <action name="Execute">
      <startupnotify>
	<enabled>false</enabled>
	<name>Logout</name>
	<name>Logout</name>
      </startupnotify>
      <command>oblogout</command>
    </action>
  </keybind>
</keyboard>

This does not seem to work for Ctrl-Alt-Delete key, either using

<keybind key="C-A-Delete">

or

<keybind key="C-A-0x7c">

where 0x7c is the hex form of keycode 124 that openbox can read, which I got by running the command

printf "0x%x\n" 124

If anyone has input on why this doesn't work for the Delete key, please let me know.

As for console, it seems that the keycode 116, which corresponds to the power key is registering two key press events for each physical press, as shown in showkey:

$ showkey
kb mode was UNICODE
[ if you are trying this under X, it might not work
since the X server is also reading /dev/console ]

press any key (program terminates 10s after last keypress)...
keycode  28 release
keycode 116 press
keycode 116 press
keycode 116 release
keycode 116 release

I am able to configure keycode 116 as Delete and Ctrl-Alt-Delete as reboot by doing the following in a custom keymap file:

keycode 116 = Remove           Remove               Remove              
	control	keycode 116 = Remove              
	shift	control	keycode 116 = Remove              
	altgr	control	keycode 116 = Boot
	alt	keycode 116 = Remove              
	shift   alt	keycode 116 = Remove              
	control	alt	keycode 116 = Boot

But this results in two characters being deleted instead of one, due to the above mentioned problem. I hope someone knows the solution to this!

Offline

#3 2016-12-07 20:40:08

rabarrett
Member
Registered: 2012-07-05
Posts: 99

Re: Acer c720 Laptop: How to turn power key into delete key?

Oliver_RA wrote:

The answer depends on whether you want this to work in X, console or both. I am currently trying to get both working.

In either case, you have to change the

/etc/systemd/logind.conf

to ignore the powerkey keypress, and restart the systemd-logind.service: https://wiki.archlinux.org/index.php/Ch … h_handling

Thank you for responding even after the delay in time.  I'm glad not everyone has a phobia of delayed conversation, some of which can still be quite useful.  (Perhaps they're trying to save the massive amount of HD space storing these characters costs.)

So I tried the change you suggested above (with the link).  It doesn't seem to change the response I get (powering off) from my power button.  I've restarted systemd-logind service, and for that matter I've rebooted several times, but the power button still works.

When I look to see what is happening, I get

systemctl status systemd-logind
● systemd-logind.service - Login Service
   Loaded: loaded (/usr/lib/systemd/system/systemd-logind.service; static; vendor preset: disabled)
   Active: active (running) since Wed 2016-12-07 14:32:27 CST; 6min ago
     Docs: man:systemd-logind.service(8)
           man:logind.conf(5)
           http://www.freedesktop.org/wiki/Software/systemd/logind
           http://www.freedesktop.org/wiki/Software/systemd/multiseat
 Main PID: 1091 (systemd-logind)
   Status: "Processing requests..."
    Tasks: 1 (limit: 4915)
   CGroup: /system.slice/systemd-logind.service
           └─1091 /usr/lib/systemd/systemd-logind

Dec 07 14:32:27 acer720 systemd-logind[1091]: [/etc/systemd/logind.conf:20] Failed to parse handle action setting, ignoring: ignor
Dec 07 14:32:27 acer720 systemd[1]: Started Login Service.
Dec 07 14:32:27 acer720 systemd-logind[1091]: New seat seat0.
Dec 07 14:32:27 acer720 systemd-logind[1091]: Watching system buttons on /dev/input/event5 (Power Button)
Dec 07 14:32:27 acer720 systemd-logind[1091]: Watching system buttons on /dev/input/event6 (Video Bus)
Dec 07 14:32:27 acer720 systemd-logind[1091]: Watching system buttons on /dev/input/event2 (Power Button)
Dec 07 14:32:27 acer720 systemd-logind[1091]: Watching system buttons on /dev/input/event1 (Lid Switch)
Dec 07 14:32:27 acer720 systemd-logind[1091]: Watching system buttons on /dev/input/event3 (Sleep Button)
Dec 07 14:32:27 acer720 systemd-logind[1091]: Watching system buttons on /dev/input/event4 (Sleep Button)
Dec 07 14:32:27 acer720 systemd-logind[1091]: New session c1 of user rabarrett.

Any ideas why the change doesn't seem to be taking?

Last edited by rabarrett (2016-12-07 20:41:10)

Offline

Board footer

Powered by FluxBB