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
will print a running list of every xevent that occurs while it is running to the terminal window from which it was invoked.
In order to "bind" an action to a certain keypress, we need to install two utilities,
. Both are available from
- Either login as root and invoke
aptitude, or use
- Search for the
xbindkeys_config utilities in the program list.
- (Hint: for the above, type in
- Mark both packages for install using the
+ operator, and then press
g to start the install.
- (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!).
- (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).
- (Hint: you also may need to tell
aptitude that you really do want to install the unsigned software)
- 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.
- Create a default
.xbindkeysrc file by running this command:
xbindkeys --defaults > ~/.xbindkeysrc
- Open up the
xbindkeys-config utility by running that command.
- At the bottom of the screen, click "New" to create a new key binding.
- In the "Name" field, type in something related to opening the door.
- 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.
- In the "Action" field, type
- Below the "Action" field, press the "Run Action" button. You should hear the door lock click open.
- Click the "Save & Apply & Exit" button.
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:
- When KDE starts, it automatically executes scripts in the folder ~/.kde/Autostart .
- Create a script named
startup in the Autostart folder with the following lines in the body:
- 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.
- The second line invokes
xbindkeys, which will automatically source the file we created above,
- Once the script is in place, execute
chmod 744 startup to make the script executable.
- When you invoke your bash (or other) shell, it sources the
.bashrc file to find user-specific configuration information.
- Edit your
~/.bashrc file and add the following lines to the end of it:
#Invoke the X Key bindings
- As above, the second line invokes
xbindkeys, which will automatically source
- 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.
- 06 Feb 2007