forward/backward buttons on T40 in ubuntu (gusty)

Solaris, RedHat, FreeBSD and the like
Post Reply
Message
Author
Pyroraptor
Freshman Member
Posts: 57
Joined: Tue May 15, 2007 1:46 am
Location: Washington, NC
Contact:

forward/backward buttons on T40 in ubuntu (gusty)

#1 Post by Pyroraptor » Sat Nov 10, 2007 9:09 am

Has anyone yet gotten these buttons working in ubuntu or any distro of linux? All I need them for is a webbrowser, I found how to get them working in music players for the most part, but I can't find any options to make them work as backwards and fowards buttons in firefox.
IBM Lenovo R61i 1.5GHz c2d T5250 | 1GB RAM | 80GB SATA | X3100 | WXGA | Win XPpro
IBM T40 2374-14U | (sold)
http://dectop.co.nr

GomJabbar
Moderator
Moderator
Posts: 9765
Joined: Tue Jun 07, 2005 6:57 am

#2 Post by GomJabbar » Sat Nov 10, 2007 9:23 am

I haven't tried this yet, but it seems like it should work.

http://www.thinkwiki.org/wiki/How_to_ge ... ys_to_work
DKB

Pyroraptor
Freshman Member
Posts: 57
Joined: Tue May 15, 2007 1:46 am
Location: Washington, NC
Contact:

#3 Post by Pyroraptor » Sat Nov 10, 2007 12:07 pm

Hmmmm, I hadn't seen that before.

Well, I know that tbp does not work with the forwards and backwards buttons due to previous testing, but I have not tested xmodmap before. Do you know if xmodmap can map one key to two other keys, like, I could set the forwards key to do the same thing as alt-left, and backwards could be alt-right. Time to look for documentation on xmodmap I suppose...
IBM Lenovo R61i 1.5GHz c2d T5250 | 1GB RAM | 80GB SATA | X3100 | WXGA | Win XPpro
IBM T40 2374-14U | (sold)
http://dectop.co.nr

K0LO
Senior Member
Senior Member
Posts: 659
Joined: Wed Sep 07, 2005 12:14 pm
Location: State College, PA, USA

#4 Post by K0LO » Sat Nov 10, 2007 12:07 pm

Here's how I do it with Firefox in Kubuntu. Steps 4 and 5 are for key mapping; you can ignore the first 3 steps if you prefer to use the version of Firefox in the Ubuntu repository. I prefer to download the latest versions directly from Mozilla.
Firefox Installation Notes
9/15/2006
MJW

1. Download the latest Firefox package and expand to the /opt/firefox directory.

2. Modify the simlink for the firefox executable to point to the new installation:
cd /usr/bin
sudo ln -s /opt/firefox/firefox firefox
sudo ln -s /opt/firefox/firefox mozilla-firefox

3. Link to your plugins:
cd /opt/firefox/plugins
sudo ln -s /usr/lib/mozilla-firefox/plugins/* .

4 To map the browser "Forward" and "Back" keys, create the file /~/.Xmodmap
add the following two key mappings to the file:
keycode 234 = F19
keycode 233 = F20
Then create the file /~/.kde/Autostart/startup and add the following:
#! /bin/sh
# Startup script executed whenever kde starts
# Load the keymap for browser forward/back keys
xmodmap ~/.Xmodmap
exit 0
Then go to Go to KMenu > System > Control Center > Regional & Accessibility > Keyboard Shortcuts and locate the settings for browser forward/back.
Change them to be F19 (back) and F20 (forward).

Then to map the buttons in Firefox, follow the directions in the ThinkWiki:

5. To have Firefox make use of the browser keys you need to modify one of its files. To do this you will first need to extract it from the browser.jar archive. Do...

cd <firefox-directory>/chrome
sudo unzip browser.jar

The file of interest is content/browser/browser.xul. Edit it...
sudo nano content/browser/browser.xul

Look for the <keyset id="mainKeyset"> section and add the following lines within...
<key id="goBackKb" keycode="VK_F19" command="Browser:Back" />
<key id="goForwardKb" keycode="VK_F20" command="Browser:Forward" />

Now save the file and repackage the browser.jar archive...
sudo zip -rDu browser.jar content

(This replaces the changed file browser.xul in the zip archive)
-r = recursively search the starting folder (/content)
-D = don't include directory entries in the zip archive
-u = update only new or changed files

That's it.

Check about:plugins in firefox to see if java, flash, and adobe pdf plugins are recognized.
You would need to modify step 4 for a Gnome distro like Ubuntu.
Mark

X61T 7764-CTO, Core 2 Duo L7500 LV 1.6 GHz, 4 GB RAM, 120 GB Intel X25M SSD
Multiboot w/Grub4DOS -- Windows 10, MustangPE, PartedMagic
My ex: X41T (2005 - 2009)

awong
Freshman Member
Posts: 78
Joined: Thu Jul 26, 2007 2:05 pm
Location: Tampa, Florida
Contact:

#5 Post by awong » Sat Nov 10, 2007 3:47 pm

on my r31, the back and forward keys worked in kubuntu, but not in ubuntu, it may be the same,

GomJabbar
Moderator
Moderator
Posts: 9765
Joined: Tue Jun 07, 2005 6:57 am

#6 Post by GomJabbar » Sat Nov 10, 2007 11:35 pm

I finally got the Forward and Back browser keys to work in Mandriva. I don't know why it took this n00b so long to do it, other than the fact that I was reading so much conflicting information which applied to various versions and distros. I have been at it for several hours. :roll:

It seems that basically at least, k0lo has the right method. I am using KDE 3.5.6.

I had to create the following file .Xmodmap in the /home/userid directory.

Code: Select all

! This works with ThinkPad T42 keyboard
! Use ! for comments

keycode 77 = Num_Lock
keycode 159 = XF86LaunchA
keycode 227 = F35
keycode 233 = F19
keycode 234 = F20
Note; I only have tried configuring the Forward (F19) and Back (F20) browser keys in KDE so far. I discovered that NumLk is working already. XF86LaunchA is the blue Access IBM button, and F35 is the Fn button.

I had to create the following file xmodmap in the /home/userid/.kde/Autostart directory.

Code: Select all

#!/bin/sh
# Startup script executed whenever kde starts
# Load the keymap for browser forward/back keys
/usr/bin/xmodmap /home/dkb/.Xmodmap
exit 0
I had to open Konsole and log in as superuser, then navigate to /home/userid/.kde/Autostart and type in chmod a+x xmodmap and hit Enter.

Here is what to do next:
Go to System > Configuration > KDE > Region & Accessibility > Keyboard Shortcuts. Click on the Application Shortcuts tab and scroll down to Navigation, double-click on Back and click on the X to the right of Alternate shortcut, then press your back browser button. You should see F20 displayed. Scroll down to Forward and do the same, pressing the forward browser button.

In Opera, go to Tools > Preferences > Advanced > Shortcuts, and in bottom window (for keyboard) keyboard setup, expand Applications and scroll down to Forward (on right side under Actions), click on Edit, type in F19 and press Enter, then scroll down to Back (on right side under Actions), click on Edit, type in F20 and press Enter. Click on OK and OK.

For Firefox - good luck. You don't have near the configuration options that you do in Opera. I am not even going to mess with it. Try what k0lo wrote.

EDIT: Well, maybe I will mess with Firefox, but that will be another day.
DKB

K0LO
Senior Member
Senior Member
Posts: 659
Joined: Wed Sep 07, 2005 12:14 pm
Location: State College, PA, USA

#7 Post by K0LO » Sat Nov 10, 2007 11:55 pm

GomJabbar wrote:For Firefox - good luck. You don't have near the configuration options that you do in Opera. I am not even going to mess with it. Try what k0lo wrote.

EDIT: Well, maybe I will mess with Firefox, but that will be another day.
Glad to hear you got something working. If you do mess with Firefox, keep a copy of what you did in a text file somewhere because every time that a Firefox update is released you will have to repeat the above steps with the new version.
Mark

X61T 7764-CTO, Core 2 Duo L7500 LV 1.6 GHz, 4 GB RAM, 120 GB Intel X25M SSD
Multiboot w/Grub4DOS -- Windows 10, MustangPE, PartedMagic
My ex: X41T (2005 - 2009)

GomJabbar
Moderator
Moderator
Posts: 9765
Joined: Tue Jun 07, 2005 6:57 am

#8 Post by GomJabbar » Sun Nov 11, 2007 8:05 am

Got the browser keys working in Firefox!
[It was a piece of cake compared to getting the browser keys working in the first place.]

K0lo's instructions were right on. The browser.jar file was located at /usr/lib/firefox-2.0.0.8/chrome on my system. I copied the file to another directory and then copied it again to a subdirectory (for editing purposes). I edited the file with KWrite (a standard text editor) running as superuser (or is it subsitute user as I saw someone else refer to SU -?).

So I still have a copy of the original browser.jar file in the directory I first copied it to. I have the modified file in its subdirectory and in /usr/lib/firefox-2.0.0.8/chrome. I had to close Firefox and then reopen it again for the browser keys to work.
DKB

GomJabbar
Moderator
Moderator
Posts: 9765
Joined: Tue Jun 07, 2005 6:57 am

Re: forward/backward buttons on T40 in ubuntu (gusty)

#9 Post by GomJabbar » Sat May 16, 2009 4:07 pm

I am now running Mandriva 2009.1 which uses KDE 4.2.2. The browser keys work out of the box in Firefox, but I can't seem to get them to work in Opera. I used the above method with .Xmodmap and xmodmap, but that doesn't seem to work with KDE 4. I have read some other posts where xmodmap doesn't function as expected (or maybe at all) in KDE 4.

I have tried a number of things to map the forward/backward buttons to F20 & F19 without avail. Any ideas?
DKB

GomJabbar
Moderator
Moderator
Posts: 9765
Joined: Tue Jun 07, 2005 6:57 am

Re: forward/backward buttons on T40 in ubuntu (gusty)

#10 Post by GomJabbar » Sat May 30, 2009 7:09 am

I finally had a little more time to look at this and found the solution (for Opera)! :D

For some strange reason, the keycodes are different in Mandriva 2009.1 KDE 4.2 than they were in Mandriva 2008.1 KDE 3.4.

Previously I used in /home/<user>/.Xmodmap
keycode 233 = F19
keycode 234 = F20

Now I use in /home/<user>/.Xmodmap
keycode 166 = F19
keycode 167 = F20

EDIT: Here are the two files I created as normal user for Mandriva 2010.
/home/<user>/.Xmodmap

Code: Select all

keycode 166 = F19
keycode 167 = F20
/home/<user>/.kde4/Autostart/xmodmap Change permissions on this file to make it executable.

Code: Select all

#!/bin/sh
# Startup script executed whenever kde starts
# Load the keymap for browser forward/back keys
/usr/bin/xmodmap /home/<user>/.Xmodmap
exit 0
Of course you need to replace <user> with your own user login id.
I made the file executable from Dolphin, but you can do that from terminal as root: chmod +x /home/<user>/.kde4/Autostart/xmodmap
DKB

Post Reply
  • Similar Topics
    Replies
    Views
    Last post

Return to “Linux Questions”

Who is online

Users browsing this forum: No registered users and 2 guests