Configuring your lab terminal to interact with the remote door open utility.

These instructions describe the method for binding a key on your keyboard to a script that will open the lab door remotely.

XEvents: An interesting note

Key presses, mouse-overs, mouse clicks, etc. are all "events" inside the xwindows environment. The program xev will print a running list of every xevent that occurs while it is running to the terminal window from which it was invoked.

Installing xbindkeys and xbindkeys-config

In order to "bind" an action to a certain keypress, we need to install two utilities, xbindkeys and xbindkeys-config. Both are available from aptitude.

  1. Either login as root and invoke aptitude, or use sudo aptitude.
  2. Search for the xbindkeys and xbindkeys_config utilities in the program list.
  3. (Hint: for the above, type in /xbindkeys and /xbindkeys-config).
  4. Mark both packages for install using the + operator, and then press g to start the install.
  5. (Hint: if the install fails because dpkg finds an unknown user in the "statoverride" file, you may need to modify the statoverride file in /var/lib/dpkg/. Make a COPY first!).
  6. (Hint: you may need to press g a couple of times to get the install to run; aptitude may warn you about packages that are being installed to fulfill dependencies or packages that are not being upgraded because of previous commands to that effect).
  7. (Hint: you also may need to tell aptitude that you really do want to install the unsigned software)
  8. Once the packages are installed, exit aptitude and your root privledges (if you used su to become root).

Using the utilities

Once the install of the two utilities has completed, follow the following instructions to bind your key to the door open script. It is suggested that F12 would be a great key to use.

  1. Create a default .xbindkeysrc file by running this command: xbindkeys --defaults > ~/.xbindkeysrc
  2. Open up the xbindkeys-config utility by running that command.
  3. At the bottom of the screen, click "New" to create a new key binding.
  4. In the "Name" field, type in something related to opening the door.
  5. Below the "Key" field, press the "Get Key" button, wait a few seconds for xev to be invoked, and then press the key you want to bind to the door.
  6. In the "Action" field, type /project/sysadmin/door/remoteOpen.
  7. Below the "Action" field, press the "Run Action" button. You should hear the door lock click open.
  8. Click the "Save & Apply & Exit" button.

Reinvoking xbindkeys on startup (Automation)

At this point your F12 key (or whichever key you used) is bound to the remote open script. However, if you log out or reboot, you will need to re-invoke the xbindkeys program. There are two ways to do this:

Using KDE

  1. When KDE starts, it automatically executes scripts in the folder ~/.kde/Autostart .
  2. Create a script named startup in the Autostart folder with the following lines in the body:
     #!/bin/bash

     xbindkeys
  1. The first line is important; it tells KDE to run this script with BASH (or whatever shell you specify). If you do not do this, it will simply open up this script file in a text editor, a rather useless behavior.
  2. The second line invokes xbindkeys, which will automatically source the file we created above, ~/.xbindkeysrc.
  3. Once the script is in place, execute chmod 744 startup to make the script executable.

Using your bashrc file

  1. When you invoke your bash (or other) shell, it sources the .bashrc file to find user-specific configuration information.
  2. Edit your ~/.bashrc file and add the following lines to the end of it:
     #Invoke the X Key bindings
     xbindkeys
  1. As above, the second line invokes xbindkeys, which will automatically source ~/.xbindkeysrc.
  2. The problem with this method is that it will not take effect after you log in until you open a terminal window, invoking bash. The above method is superior, but not everyone is using KDE. If there are similar settings for Gnome, etc, please feel free to add the details in this section.

-- AlexMarschner - 06 Feb 2007

Topic revision: r3 - 14 Feb 2007 - 16:33:09 - LabMemberGroup
 
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback