WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: How to create a user defined keyboard function?  (Read 3246 times)

Offline bigpcman

  • Hero Member
  • *****
  • Posts: 719
How to create a user defined keyboard function?
« on: August 27, 2009, 10:08:50 PM »
A new day and a new problem. Since switching over to a netbook computer, I can't find a way to turn the screen back on after executing  " dpms off".
My previous laptop reactivated the screen when the screen was lowered to a closed position followed by reopening it.

By way of background I use dpms to turn the screen back light off after logging out of tc. Otherwise it will stay on forever. I logout to the linux prompt using:
Code: [Select]
sudo killall Xvesa 2>&1 > /dev/null
sudo vbetool dpms off 2>&1 > /dev/null &
sudo /usr/local/bin/pkill -KILL -u tc 2>&1 > /dev/null

From this point to get the screen back on I either have to reboot or access tc through an ssh connection and execute "dpms on".

I would prefer to have an "alt/cnt/key" defined that would execute a script. I though I could do this in acpi /acpid but I'm not getting anywhere with that. There must be an easier way. Ideas?
big pc man

Offline junan

  • Jr. Member
  • **
  • Posts: 88
Re: How to create a user defined keyboard function?
« Reply #1 on: August 27, 2009, 11:28:43 PM »
if u using jwm , you can modify it at '/home/tc/.jwmrc-keys' file
or maybe add a button in the tray by modify '/home/tc/.jwmrc-tray' file
fun and fearless ...

Offline bigpcman

  • Hero Member
  • *****
  • Posts: 719
Re: How to create a user defined keyboard function?
« Reply #2 on: August 28, 2009, 10:40:18 AM »
if u using jwm , you can modify it at '/home/tc/.jwmrc-keys' file
or maybe add a button in the tray by modify '/home/tc/.jwmrc-tray' file

Unfortunately I'm trying to respond to "keys" while at the linux login prompt.

What I need is similar handling of "cnt/alt/del" except instead of reboot the screen is turned on. So how is  "cnt/alt/del" handled by the linux system. Is this a "compiled" in function within the kernel or the keybaord driver?
big pc man

Offline Lee

  • Hero Member
  • *****
  • Posts: 645
    • My Core wiki user page
Re: How to create a user defined keyboard function?
« Reply #3 on: August 28, 2009, 12:00:55 PM »
If you wanted to hijack Ctrl/Alt/Del, you could modify /etc/inittab (next-to-last-line).  I don't know if you can add other key combinations there or if Ctrl/Alt/Del is special (perhaps because of the NMI?).

Some of us who still have to use Windows get all irritated when we walk up to the key board and, out of habit, give it the 3-fingered salute (to log in or return from screen saver) and the system reboots.  Still, there's probably some good reason to leave Ctrl/Alt/Del the way it is.
32 bit core4.7.7, Xprogs, Xorg-7.6, wbar, jwm  |  - Testing -
PPR, data persistence through filetool.sh          |  32 bit core 8.0 alpha 1
USB Flash drive, one partition, ext2, grub4dos  | Otherwise similar

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11044
Re: How to create a user defined keyboard function?
« Reply #4 on: August 28, 2009, 04:35:03 PM »
Init can only capture ctrl-alt-del, but there are tons of daemons exactly for the issue. A lot of people needed something executed in different environments, and seems each made their own ;)

I don't remember the name of even a single one right now though, sorry.
The only barriers that can stop you are the ones you create yourself.

Offline bigpcman

  • Hero Member
  • *****
  • Posts: 719
Re: How to create a user defined keyboard function?
« Reply #5 on: August 28, 2009, 07:46:03 PM »
Init can only capture ctrl-alt-del, but there are tons of daemons exactly for the issue. A lot of people needed something executed in different environments, and seems each made their own ;)

I don't remember the name of even a single one right now though, sorry.

I googled for daemons but it's not clear to me if any of them will work at the linux tty level. I'm trying to link a "key combo" to a script when at the linux login prompt.

Since I now know how to get acpid working and it too is a daemon I'm wondering if the other keyboard specific daemons like the "ESE Key Daemon" are going to offer any advantages? What I was hoping I could do is bind a key combo to a command like cnlaltdel and not have to run any daemon at all.
big pc man

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11044
Re: How to create a user defined keyboard function?
« Reply #6 on: August 29, 2009, 04:09:51 AM »
You can bind a command to ctrl-alt-del just by editing /etc/inittab (would require a remaster, since the file is read before anything else happens).

I just googled a bit, seems most of these daemons work in X (because capturing keys there is so much easier) but I did find one that works in console: actkbd
The only barriers that can stop you are the ones you create yourself.