I decided to install the ubuntu-desktop metapackage on top of my existing Ubuntu Server system. Since the tower is already hooked up to a KVM, I sometimes find it useful to sit down in front of it and use it as a desktop instead of connecting via ssh.
Unfortunately, sound did not work out of the box, despite the fact that ubuntu-desktop has dependencies on ALSA and PulseAudio. I was pleased to find that the solution was relatively easy. I only had to fire up alsamixer, unmute PCM, and raise the volume. My next task is to get Music Player Daemon (MPD) working.
Showing posts with label X11. Show all posts
Showing posts with label X11. Show all posts
Thursday, July 09, 2009
Sunday, September 23, 2007
Refreshingly Simple: SyncMastery Achieved
About a week ago, I noticed that my monitor, a Dell 1703FP I've had for almost five years, would flicker when returning from power-save mode. I decided I would rather start shopping for a replacement immediately than wait for it to die altogether.
After some deliberation, I chose a Samsung SyncMaster 932B, a 19" TFT-LCD with a maximum supported resolution of 1280 × 1024 @ 75 Hz. The picture looks gorgeous, and the brightness presets have already proven useful. As I anticipated, it presented a small challenge when configuring X.
The monitor's manual states its recommended refresh rate is 60 Hz, but X seemed determined to use the highest available rate. Thinking this must be hard on the monitor, I looked up the supported frequency ranges in the manual and manually added them to my xorg.conf. To edit the file, do
Before I added those lines, X insisted on pushing the monitor to 75 Hz and wouldn't acknowledge other possibilities. I searched until I found an informative how-to and downloaded the GTF modeline generator from the link it provided. To compile the generator, I did the following:
I wanted to be able to run gtf from any working directory, so I moved the executable to /usr/bin:
Problem solved!
After some deliberation, I chose a Samsung SyncMaster 932B, a 19" TFT-LCD with a maximum supported resolution of 1280 × 1024 @ 75 Hz. The picture looks gorgeous, and the brightness presets have already proven useful. As I anticipated, it presented a small challenge when configuring X.
The monitor's manual states its recommended refresh rate is 60 Hz, but X seemed determined to use the highest available rate. Thinking this must be hard on the monitor, I looked up the supported frequency ranges in the manual and manually added them to my xorg.conf. To edit the file, do
sudo vi /etc/X11/xorg.confand add the appropriate ranges to the "Monitor" section. Mine looks like this:
Section "Monitor"HorizSync is measured in kHz and VertRefresh in Hz. DPMS stands for Display Power Management Signaling, and you should enable it if your hardware supports it. I'll explain the last two lines in a moment. They turned out to be essential for getting X to use the monitor's optimum refresh rate.
Identifier "Samsung SyncMaster 932B"
Option "DPMS"
HorizSync 30-81
VertRefresh 56-75
# 1280x1024 @ 60.00 Hz (GTF) hsync: 63.30 kHz; pclk: 108.88 MHz
Modeline "1280x1024_60.00" 108.88 1280 1360 1496 1712 1024 1025 1028
1060 -Hsync +Vsync
EndSection
Before I added those lines, X insisted on pushing the monitor to 75 Hz and wouldn't acknowledge other possibilities. I searched until I found an informative how-to and downloaded the GTF modeline generator from the link it provided. To compile the generator, I did the following:
gcc gtf.c -o gtf -lm -WallInitially GCC warned me
gtf.c: In function ‘parse_command_line’:I've seen that warning before; it usually means you forgot to explicitly include the header file for some C library function—in this case, strcmp, which string.h defines. So I did
gtf.c:665: warning: implicit declaration of function ‘strcmp’
vi gtf.cand added
#include <string.h>after the other includes. As expected, the warning disappeared.
I wanted to be able to run gtf from any working directory, so I moved the executable to /usr/bin:
sudo mv gtf /usr/binI ran it with the desired resolution and refresh rate as arguments:
gtf 1280 1024 60This produced two lines, which I added to the end of the "Monitor" section above. I also needed to change every occurrence of "1280x1024" in the "Screen" section to "1280x1024_60.00" to match the modeline. Then I saved the file, logged out and restarted X with Ctrl+Alt+Backspace.
Problem solved!
Saturday, August 04, 2007
Domo arigato, ISO-10646-1
A friend gave me a couple of Japanese CDs, which I added to my music collection. When I opened up an XTerm and listed out the directories, I found that the Japanese filenames weren't displayed correctly. Where the characters should have been, there were only empty boxes. Clearly this was a font issue.
As far as I can tell, you only need to add two lines to your .Xresources file:
XTerm*locale: true
XTerm*font: -misc-fixed-medium-r-normal-*-18-120-100-100-c-90-iso10646-1
You could also set the wideFont resource, but I didn't bother. By default, XTerm will simply double the width of the font you specified. For example, the font above has an average width of 90. So the wide font gets a width of 180.
If you want to see which fonts you have at your disposal, run xfontsel and play around with the various pull-down menus.
Then you merge the updated file
xrdb -merge ~/.Xresources
and you're good to go. The next XTerm you open will display Japanese characters perfectly.
As far as I can tell, you only need to add two lines to your .Xresources file:
XTerm*locale: true
XTerm*font: -misc-fixed-medium-r-normal-*-18-120-100-100-c-90-iso10646-1
You could also set the wideFont resource, but I didn't bother. By default, XTerm will simply double the width of the font you specified. For example, the font above has an average width of 90. So the wide font gets a width of 180.
If you want to see which fonts you have at your disposal, run xfontsel and play around with the various pull-down menus.
Then you merge the updated file
xrdb -merge ~/.Xresources
and you're good to go. The next XTerm you open will display Japanese characters perfectly.
Thursday, February 01, 2007
Dapper worthy of long-term support
I decided to upgrade my desktop OS to Ubuntu 6.06 LTS "Dapper Drake." The LTS stands for long-term support. That is, Canonical has pledged to provide support for Dapper for three years from its release date. I guess, with Dapper, they knew they had a keeper.
Set aside for a moment the fact that the install CD includes a video of an interview with Nelson Mandela, in which he expounds on the meaning of "ubuntu." It's over the top, if you ask me.
This is solid distro. The CD includes all the necessary packages for a working GNOME desktop environment, plus a wisely limited selection of popular applications. This design decision stands in sharp contrast to the one manifest in Debian, in which the list of basic desktop packages is horribly bloated. (That this is a long-standing criticism of Debian doesn't make it less valid.) I was pleasantly surprised to find that Ubuntu installed the desktop environment and only a small handful of applications, giving me the opportunity to choose what else, if anything, to install.
What's more, the hardware detection went almost flawlessly. I added aic7xxx=no_probe to the boot options, and it "just worked." I didn't even have to edit my xorg.conf with the horizontal sync and vertical refresh rates. The optimal settings for my monitor, a Dell 1703FP, are 1280 x 1024 @ 60Hz. It's set at 75Hz, but I'm fine with that.
It was also easy to add repositories. I went to UbuntuGuide.org and overwrote my sources.list with the one provided there. It worked like a charm; I got all the packages I needed and then some.
Last but not least, I can access the shared files/folders on the other desktop on our network, which runs Windows XP. I connect to smb://guest@HOSTNAME/SHARENAME. The hostname can be replaced with the server's IP address. This has been reported to work in some situations where the hostname isn't recognized. It works both ways on my network. There must be a way to connect using a password-protected account, but I haven't investigated this thoroughly.
So I'm feeling quite satisfied. However, to be fair, I do have a small handful of grievances with this release, which I may as well air here (in bullet points because I'm short on time):
Image from Nuxified.org
Set aside for a moment the fact that the install CD includes a video of an interview with Nelson Mandela, in which he expounds on the meaning of "ubuntu." It's over the top, if you ask me.
This is solid distro. The CD includes all the necessary packages for a working GNOME desktop environment, plus a wisely limited selection of popular applications. This design decision stands in sharp contrast to the one manifest in Debian, in which the list of basic desktop packages is horribly bloated. (That this is a long-standing criticism of Debian doesn't make it less valid.) I was pleasantly surprised to find that Ubuntu installed the desktop environment and only a small handful of applications, giving me the opportunity to choose what else, if anything, to install.
What's more, the hardware detection went almost flawlessly. I added aic7xxx=no_probe to the boot options, and it "just worked." I didn't even have to edit my xorg.conf with the horizontal sync and vertical refresh rates. The optimal settings for my monitor, a Dell 1703FP, are 1280 x 1024 @ 60Hz. It's set at 75Hz, but I'm fine with that.
It was also easy to add repositories. I went to UbuntuGuide.org and overwrote my sources.list with the one provided there. It worked like a charm; I got all the packages I needed and then some.
Last but not least, I can access the shared files/folders on the other desktop on our network, which runs Windows XP. I connect to smb://guest@HOSTNAME/SHARENAME. The hostname can be replaced with the server's IP address. This has been reported to work in some situations where the hostname isn't recognized. It works both ways on my network. There must be a way to connect using a password-protected account, but I haven't investigated this thoroughly.
So I'm feeling quite satisfied. However, to be fair, I do have a small handful of grievances with this release, which I may as well air here (in bullet points because I'm short on time):
- I didn't see option to set the root password during the install process. I need to look into this because I'm worried the default is something asinine like "admin". Luckily the installer adds your first user account to the list of sudoers, so you're still able to edit system internals.
- If you decide not to partition your hard drive manually, the automatic partitioning scheme available puts everything—except the swap, of course—on a single ext3 partition. By contrast, Debian lets you choose between three schemes: a single partition, a separate home partition and separate partitions for almost everything.
- The Ubuntu splash screen displays at some weird resolution, like 720 x 400. It doesn't seem to matter how you tell the live CD to set it. If you can specify a resolution for the splash when running from the CD, there must be a way to do it when running from the hard drive. This is a relatively low priority, though.
- Emacs still isn't included in the desktop packages. This is an almost trivial issue, but one that continues to irk me.
Image from Nuxified.org
Monday, June 19, 2006
X11 marks the spot
Over the past year, I've grown fond of my Linux box and sorely miss it when I'm using my PowerBook on the go. Luckily a couple of computer science professors introduced me to two invaluable tools. Now I can run my favorite programs without going through the hassle of installing a separate OS.
The first tool is Fink. This project ports Unix software to Darwin and Mac OS X. It also allows you to manage your packages with dpkg and apt-get, one of the most attractive and celebrated features of Debian. Download Fink from the SourceForge project site and install it. Installation instructions are available there. I ran into trouble because I already had a .profile and .Xresources file. I moved these files to another path and ran pathsetup.sh again. After that, everything went smoothly. Once you have Fink installed, you can use dselect and apt-get on the command line—which I'm sure makes you very happy if you're a Debian vet.
Now you'll want to install Apple's X11 or XDarwin. When you're running X11 within Mac OS X, it probably makes more sense to choose Apple's X11, even though it doesn't have quite the same features as XDarwin does. Supposedly it is available on the third Panther CD. (Since I only have the first two Panther CDs, I can't confirm this.) I downloaded it from the Apple web site. The installation was easy.
Before you start your X server for the first time, you should configure it to initialize Fink. You'll need a file named .xinitrc in your home directory for this. I copied an existing one and modified it to suit my needs.
$ cp /private/etc/X11/xinit/xinitrc ~/.xinitrc
Open the copy in your favorite editor.
$ sudo emacs .xinitrc
Now add the following line to the top of the file. This will tell the X server to initialize Fink before anything else. In my copy, I added three more lines at the end of the file to start the KDE window manager.* You can do other cool things, but I'll leave it at that for this example.
. /sw/bin/init.sh
export KDEWM=kwin
quartz-wm --only-proxy &
/sw/bin/startkde > /tmp/kde.log 2>&1
Once you've saved the file, you can begin using your X11 environment. To start Apple's X11, go to the Utilities folder (Command + Shift + U in Finder) and double-click X11. You need to change your preferences to run in full screen mode. Full screen mode is toggled with the Command + Option + A shortcut. Once the X server has initialized you have a UNIX-like environment for your computing pleasure.
* Note that you don't have to use KDE. I chose it because it seems to be the most fully supported window manager for Fink.
The first tool is Fink. This project ports Unix software to Darwin and Mac OS X. It also allows you to manage your packages with dpkg and apt-get, one of the most attractive and celebrated features of Debian. Download Fink from the SourceForge project site and install it. Installation instructions are available there. I ran into trouble because I already had a .profile and .Xresources file. I moved these files to another path and ran pathsetup.sh again. After that, everything went smoothly. Once you have Fink installed, you can use dselect and apt-get on the command line—which I'm sure makes you very happy if you're a Debian vet.
Now you'll want to install Apple's X11 or XDarwin. When you're running X11 within Mac OS X, it probably makes more sense to choose Apple's X11, even though it doesn't have quite the same features as XDarwin does. Supposedly it is available on the third Panther CD. (Since I only have the first two Panther CDs, I can't confirm this.) I downloaded it from the Apple web site. The installation was easy.
Before you start your X server for the first time, you should configure it to initialize Fink. You'll need a file named .xinitrc in your home directory for this. I copied an existing one and modified it to suit my needs.
$ cp /private/etc/X11/xinit/xinitrc ~/.xinitrc
Open the copy in your favorite editor.
$ sudo emacs .xinitrc
Now add the following line to the top of the file. This will tell the X server to initialize Fink before anything else. In my copy, I added three more lines at the end of the file to start the KDE window manager.* You can do other cool things, but I'll leave it at that for this example.
. /sw/bin/init.sh
export KDEWM=kwin
quartz-wm --only-proxy &
/sw/bin/startkde > /tmp/kde.log 2>&1
Once you've saved the file, you can begin using your X11 environment. To start Apple's X11, go to the Utilities folder (Command + Shift + U in Finder) and double-click X11. You need to change your preferences to run in full screen mode. Full screen mode is toggled with the Command + Option + A shortcut. Once the X server has initialized you have a UNIX-like environment for your computing pleasure.
* Note that you don't have to use KDE. I chose it because it seems to be the most fully supported window manager for Fink.
Friday, January 20, 2006
Brown paper Fluxboxes tied up with string
Fluxbox is a window manager for X. Its chief advantage over Metacity—the window manager with which you'll be familiar if you use GNOME—is its streamlined design; it runs much faster. For this reason, distros like DSL use it as their default window manager. It can also be customized by editing a few text files. Users often set up impressive Fluxbox themes (see below). Unfortunately it didn't "just work" on my Debian system.
Several FAQs on setting up Fluxbox mention an executable called fluxbox-generate_menu. When run, it's supposed to take an inventory of your applications and generate corresponding items in the Fluxbox menu, which initially lists nothing but a launcher for xterm and the options to restart Fluxbox or logout. It isn't the best tool; it tends to clutter your menu with items you never actually use and omit ones you do. But I consider it more efficient to run it and then adjust the menu accordingly, rather than track down every application and add them to ~/.fluxbox/menu. There was one problem: installing the fluxbox package didn't seem to install fluxbox-generate_menu as promised. I had to search for a while before I found the solution.
It's kind of dopey. Apparently there's a bug in the package, and consequently the archive containing fluxbox-generate_menu doesn't get decompressed and copied to /usr/bin during the installation. So we have to do it manually. It's not tough.
# cd /usr/share/doc/fluxbox
# gunzip fluxbox-generate_menu.gz
# cp fluxbox-generate_menu /usr/bin
# chmod a+x /usr/bin/fluxbox-generate_menu
Let's go line by line. The cd command changes your working directory. Then the gunzip command decompresses or "unzips" the archive. You could alternately use gzip -d here. We use the cp command to copy the executable to the appropriate directory. The chmod a+x command gives all users permission to run it; otherwise only the root user could. It can be used with other options for different effects.
These commands should all be run as the root user. You can become root by entering sudo su at the command line or by logging in with user name "root" and the root password (not your user password, which may be different).
I'm still having a problem with fluxbox-generate_menu, but that's a discussion for another day.
Several FAQs on setting up Fluxbox mention an executable called fluxbox-generate_menu. When run, it's supposed to take an inventory of your applications and generate corresponding items in the Fluxbox menu, which initially lists nothing but a launcher for xterm and the options to restart Fluxbox or logout. It isn't the best tool; it tends to clutter your menu with items you never actually use and omit ones you do. But I consider it more efficient to run it and then adjust the menu accordingly, rather than track down every application and add them to ~/.fluxbox/menu. There was one problem: installing the fluxbox package didn't seem to install fluxbox-generate_menu as promised. I had to search for a while before I found the solution.
It's kind of dopey. Apparently there's a bug in the package, and consequently the archive containing fluxbox-generate_menu doesn't get decompressed and copied to /usr/bin during the installation. So we have to do it manually. It's not tough.
# cd /usr/share/doc/fluxbox
# gunzip fluxbox-generate_menu.gz
# cp fluxbox-generate_menu /usr/bin
# chmod a+x /usr/bin/fluxbox-generate_menu
Let's go line by line. The cd command changes your working directory. Then the gunzip command decompresses or "unzips" the archive. You could alternately use gzip -d here. We use the cp command to copy the executable to the appropriate directory. The chmod a+x command gives all users permission to run it; otherwise only the root user could. It can be used with other options for different effects.
These commands should all be run as the root user. You can become root by entering sudo su at the command line or by logging in with user name "root" and the root password (not your user password, which may be different).
I'm still having a problem with fluxbox-generate_menu, but that's a discussion for another day.
Saturday, January 14, 2006
Little Debbie
About a week ago, I noticed that the music I have on my second 80GB hard drive doesn't fill even half the space. So I did what any self-respecting geek would do; I installed Debian in the free space. As usual, I had a couple of false starts before I got going.
Debian proved to be challenging to install and configure. This may have been due, in part, to the quirks of my Dell GX270. (Linux has historically had trouble handling the USB controllers in certain Dell machines.)
Initially I installed the 2.4 kernel. But when I discovered I could have chosen the 2.6 kernel instead, I decided to try it. It didn't work so well. Every time it reached a certain point in the boot sequence—presumably the point at which the USB controllers are probed—it would encounter a "control timeout on ep0in". The Xserver wouldn't start. I searched all over the Internet but was unable to find any information on this error. I found more users with the same problem, but no one had a solution. Frustrated, I decided it wasn't worth the trouble. The earlier kernel didn't support a hardware abstraction layer (HAL), but at least it didn't break my Xserver.
Having finally settled on the 2.4 kernel, I realized Debian doesn't have the same set of packages as Ubuntu does. This wasn't a huge surprise per se, but I was annoyed to find that many of the packages I easily installed via Synaptic in Ubuntu 5.10 were nowhere to be found. In particular, the NVIDIA drivers were absent. Luckily Andrew Schulman, a statistician and programmer at the EPA, wrote step-by-step instructions for installing the drivers in Debian. The key point I gleaned from reading them was that the drivers aren't available in the same kind of monolithic package found in the Ubuntu repositories. With Ubuntu, I didn't have to choose between different kernel modules; there was one package called "nvidia-glx" and that was what I installed. Debian has a different package for each kernel (e.g. nvidia-kernel-2.4.27-2-386 for the 2.4 kernel on the Intel 386 architecture) plus the nvidia-kernel-common package. Once I realized that, I had no problem installing the drivers.
Maybe this is just my machine, but sometimes the Xserver doesn't seem to start with the correct display settings. It happened in Ubuntu as well. I hear the sound telling me the login screen has loaded, but I see only a blank screen. When that happens, pressing Ctrl+Alt+Backspace to restart the Xserver usually fixes it.
I should have mentioned this right up front, but installing playback support for proprietary multimedia formats is a pain in the rear in Debian. Either rip all your music in Ogg Vorbis—or FLAC, if you have a small collection or a large hard drive—or get used to the idea of installing a ton of unstable and/or experimental packages from unofficial sources such as Christian Marillat and RareWares. Getting AAC support in XMMS was, by far, the most difficult task. It seems I've almost completely repressed the unpleasant memories. I do recall the necessary plugin being in a package called something like "xmms-aac" or "xmms-faad".
After fussing with the AAC plugin, I didn't feel like doing much else. I downloaded a Debian wallpaper I like better than the default one. Now I'm eyeing a different one, though. But these decisions are hardly momentous.
I'm impressed with Debian, but I don't think I'd give up Ubuntu for it. Ubuntu makes it easier to add the features I want without jumping through a lot of hoops. Even so, I imagine there's a reason so many university CS labs use Debian systems—I just haven't found it yet.
Debian proved to be challenging to install and configure. This may have been due, in part, to the quirks of my Dell GX270. (Linux has historically had trouble handling the USB controllers in certain Dell machines.)
Initially I installed the 2.4 kernel. But when I discovered I could have chosen the 2.6 kernel instead, I decided to try it. It didn't work so well. Every time it reached a certain point in the boot sequence—presumably the point at which the USB controllers are probed—it would encounter a "control timeout on ep0in". The Xserver wouldn't start. I searched all over the Internet but was unable to find any information on this error. I found more users with the same problem, but no one had a solution. Frustrated, I decided it wasn't worth the trouble. The earlier kernel didn't support a hardware abstraction layer (HAL), but at least it didn't break my Xserver.
Having finally settled on the 2.4 kernel, I realized Debian doesn't have the same set of packages as Ubuntu does. This wasn't a huge surprise per se, but I was annoyed to find that many of the packages I easily installed via Synaptic in Ubuntu 5.10 were nowhere to be found. In particular, the NVIDIA drivers were absent. Luckily Andrew Schulman, a statistician and programmer at the EPA, wrote step-by-step instructions for installing the drivers in Debian. The key point I gleaned from reading them was that the drivers aren't available in the same kind of monolithic package found in the Ubuntu repositories. With Ubuntu, I didn't have to choose between different kernel modules; there was one package called "nvidia-glx" and that was what I installed. Debian has a different package for each kernel (e.g. nvidia-kernel-2.4.27-2-386 for the 2.4 kernel on the Intel 386 architecture) plus the nvidia-kernel-common package. Once I realized that, I had no problem installing the drivers.
Maybe this is just my machine, but sometimes the Xserver doesn't seem to start with the correct display settings. It happened in Ubuntu as well. I hear the sound telling me the login screen has loaded, but I see only a blank screen. When that happens, pressing Ctrl+Alt+Backspace to restart the Xserver usually fixes it.
I should have mentioned this right up front, but installing playback support for proprietary multimedia formats is a pain in the rear in Debian. Either rip all your music in Ogg Vorbis—or FLAC, if you have a small collection or a large hard drive—or get used to the idea of installing a ton of unstable and/or experimental packages from unofficial sources such as Christian Marillat and RareWares. Getting AAC support in XMMS was, by far, the most difficult task. It seems I've almost completely repressed the unpleasant memories. I do recall the necessary plugin being in a package called something like "xmms-aac" or "xmms-faad".
After fussing with the AAC plugin, I didn't feel like doing much else. I downloaded a Debian wallpaper I like better than the default one. Now I'm eyeing a different one, though. But these decisions are hardly momentous.
I'm impressed with Debian, but I don't think I'd give up Ubuntu for it. Ubuntu makes it easier to add the features I want without jumping through a lot of hoops. Even so, I imagine there's a reason so many university CS labs use Debian systems—I just haven't found it yet.
Monday, October 10, 2005
Kernel Sanders
Although it may be too late to prevent you from making the same mistake I did, I should warn all users of NVIDIA cards that the latest version of the Ubuntu kernel lacks support for the official "nvidia" driver. After the update, I couldn't start the X server. I had to edit /etc/fstab to use the "nv" driver, which leaves me with noticeably decreased performance. Until I did, X complained of not having usable configurations and subsequently claimed I had "no screens." I'm too busy with my work to figure out a way to revert to an earlier version, so I'll just bear with it until another version is released.
Thursday, August 11, 2005
amixer is afriend
For whatever reason, I have to adjust the PCM track in order to change volume in GNOME; the Master track does nothing. I suspect it's something specific to my sound card. It isn't especially inconvenient as long as I want to use the volume control built into the GNOME panel. I just right-clicked on the speaker icon, selected Preferences and told it to control the PCM track. Unfortunately adjusting the volume using multimedia keys has proven more difficult.
GNOME 2 provides a utility to bind an action to a key or keys. It can be accessed from the terminal with the command gnome-keybinding-properties or from the GNOME Desktop (System -> Preferences -> Keyboard Shortcuts). However, if you want to perform an unlisted action, you'll have to use the Configuration Editor. In my case, I wanted to adjust the PCM track volume.
The GNOME Configuration Editor can run from the terminal with the command gconf-editor or from the GNOME Desktop (Applications -> System Tools -> Configuration Editor). I used it to set key bindings for Metacity.
Using Xev and Editing Xmodmap
Before I could begin I needed to know if the keys to which I wanted to bind actions already had keysyms—symbolic names for keys on the keyboard—assigned to them. I opened the terminal and entered xev.
Xev prints the contents of X events. According to its manual, "Xev creates a window and then asks the X server to send it events whenever anything happens to the window…" This includes typing. So pressing a multimedia key should return something like this.
KeyPress event, serial 29, synthetic NO, window 0x3000001,
root 0x8e, subw 0x0, time 412303, (-458,206), root:(527,303),
state 0x10, keycode 160 (keysym 0x0, NoSymbol), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
We're interested in the third line. "NoSymbol" indicates that there isn't a keysym assigned to keycode 160. Therefore I had to add them to my X keyboard map. First I exported the existing map to a file in my home directory (/home/josh on my system).
xmodmap -pke > xmodmap.conf
I added the missing keysyms for the corresponding keycodes. There's a specific set of names you must use, listed in /usr/lib/X11/XKeysymDB. I saved and closed the file. Then I applied the changes.
xmodmap xmodmap.conf
At this point, you could actually read ahead and bind actions to the keysyms to see if they work. Of course, the new keyboard map isn't just for this session. We want to load it when X starts. Following the advice of Corey Burger, I added it to the PostLogin script of gdm.
sudo cp xmodmap.conf /etc/xmodmap.conf
cd /etc/X11/gdm/PostLogin
sudo cp Default.sample Default
sudo gedit Default
We need to add the line xmodmap /etc/xmodmap.conf to the end of the file. Now we're ready to use the Configuration Editor.
GNOME Configuration Editor
Run the Configuration Editor and navigate to /apps/metacity/global_keybindings. There should be 12 keys with "run_command" in their names. Right-click on any of them and select "Edit Key…" from the popup menu. Enter the keysym of the desired multimedia key in the "Value" field. Repeat these steps for each multimedia key you want to use. Next we'll tell Metacity which command to run when these keys are pressed.
The ALSA mixer can be controlled from the command line with amixer. To mute/unmute the PCM track, you would enter amixer -q sset PCM,0 toggle. To lower or raise the PCM track volume by 10 percent, you would enter amixer -q sset PCM,0 10%-,10%- unmute or amixer -q sset PCM,0 10%+,10%+ unmute respectively. These commands become the values for the appropriate keys. The changes take effect immediately, so you can verify that the commands work as expected before you close the Configuration Editor. If you used the values I did, you should now be able to control the PCM track volume from your keyboard.
GNOME 2 provides a utility to bind an action to a key or keys. It can be accessed from the terminal with the command gnome-keybinding-properties or from the GNOME Desktop (System -> Preferences -> Keyboard Shortcuts). However, if you want to perform an unlisted action, you'll have to use the Configuration Editor. In my case, I wanted to adjust the PCM track volume.
The GNOME Configuration Editor can run from the terminal with the command gconf-editor or from the GNOME Desktop (Applications -> System Tools -> Configuration Editor). I used it to set key bindings for Metacity.
Using Xev and Editing Xmodmap
Before I could begin I needed to know if the keys to which I wanted to bind actions already had keysyms—symbolic names for keys on the keyboard—assigned to them. I opened the terminal and entered xev.
Xev prints the contents of X events. According to its manual, "Xev creates a window and then asks the X server to send it events whenever anything happens to the window…" This includes typing. So pressing a multimedia key should return something like this.
KeyPress event, serial 29, synthetic NO, window 0x3000001,
root 0x8e, subw 0x0, time 412303, (-458,206), root:(527,303),
state 0x10, keycode 160 (keysym 0x0, NoSymbol), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
We're interested in the third line. "NoSymbol" indicates that there isn't a keysym assigned to keycode 160. Therefore I had to add them to my X keyboard map. First I exported the existing map to a file in my home directory (/home/josh on my system).
xmodmap -pke > xmodmap.conf
I added the missing keysyms for the corresponding keycodes. There's a specific set of names you must use, listed in /usr/lib/X11/XKeysymDB. I saved and closed the file. Then I applied the changes.
xmodmap xmodmap.conf
At this point, you could actually read ahead and bind actions to the keysyms to see if they work. Of course, the new keyboard map isn't just for this session. We want to load it when X starts. Following the advice of Corey Burger, I added it to the PostLogin script of gdm.
sudo cp xmodmap.conf /etc/xmodmap.conf
cd /etc/X11/gdm/PostLogin
sudo cp Default.sample Default
sudo gedit Default
We need to add the line xmodmap /etc/xmodmap.conf to the end of the file. Now we're ready to use the Configuration Editor.
GNOME Configuration Editor
Run the Configuration Editor and navigate to /apps/metacity/global_keybindings. There should be 12 keys with "run_command" in their names. Right-click on any of them and select "Edit Key…" from the popup menu. Enter the keysym of the desired multimedia key in the "Value" field. Repeat these steps for each multimedia key you want to use. Next we'll tell Metacity which command to run when these keys are pressed.
The ALSA mixer can be controlled from the command line with amixer. To mute/unmute the PCM track, you would enter amixer -q sset PCM,0 toggle. To lower or raise the PCM track volume by 10 percent, you would enter amixer -q sset PCM,0 10%-,10%- unmute or amixer -q sset PCM,0 10%+,10%+ unmute respectively. These commands become the values for the appropriate keys. The changes take effect immediately, so you can verify that the commands work as expected before you close the Configuration Editor. If you used the values I did, you should now be able to control the PCM track volume from your keyboard.
Sunday, August 07, 2005
GeForce4 from Navarone
It's about time I installed a driver for my NVIDIA GeForce4 MX 440 video card. I've been relying on the nv drivers automatically selected during the install process. I don't know what they are, but I can probably get better performance with the nvidia-glx driver. First we need to get the appropriate packages, nvidia-glx and nvidia-settings. The latter is an optional package that provides a control panel.
sudo apt-get install nvidia-glx
sudo apt-get install nvidia-settings
Next we'll enable the driver.
sudo nvidia-glx-config enable
Later we can modify xorg.conf to improve performance. For now, we must restart our X session. Log out, hit Ctrl+Alt+Backspace and log in again. You should see the NVIDIA splash screen before the login screen reappears. With any luck, you'll notice a considerable increase in performance once you get back into GNOME. We're not finished, though. Let's check the status of the new driver.
cat /proc/driver/nvidia/agp/status
On my machine, it displayed the following.
Status: Enabled
Driver: AGPGART
AGP Rate: 8x
Fast Writes: Disabled
SBA: Enabled
Everything looks normal. Now let's edit the xorg.conf file. As usual, we'll make a backup copy before we begin.
sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf.bak
sudo gedit /etc/X11/xorg.conf
Find the section called "Module" and comment out the line that loads the dri module.
#Load "dri"
Add the following lines in the "Device" section.
Option "NoDCC"
Option "VideoOverlay" "on"
Option "OpenGLOverlay" "off"
Option "RenderAccel" "false"
Option "Coolbits" "1"
VideoRam 65536
The VideoRam number corresponds to your NVIDIA card's RAM, expressed in bytes. To convert from megabytes (MB) to bytes, multiply by 1024. My card has 64MB of video RAM, so I entered 65536. Please note that we're turning off render acceleration because of a bug. If this bug has been fixed, then there's no need to disable it. To be honest, I'm not sure what the rest of the options do. I'm just assuming the information on the wiki page is correct. I omitted the "NoLogo" option because I prefer to see the NVIDIA splash screen, as an extra assurance that all's well with my video card. While we're editing xorg.conf we should make sure it has the correct specifications for the monitor.
I visited the manufacturer's web site to get the technical specs on my monitor. It's most important to know the horizontal and vertical scan ranges, as they aren't detected by the Ubuntu installer. For me, the horizontal is 31 to 80 kHz, and the vertical is 56 to 76 Hz. We'll enter these in the "Monitor" section of the file.
HorizSync 31.0 - 80.0
VertRefresh 56.0 - 76.0
We can save the file and finalize our changes.
sudo update-modules
After we reboot, everything should be running smoothly. I'm still having some unusual problems with the display area being too far to the left in the BIOS even though it's centered in GNOME, but I can live with that. Maybe later I'll come up with a solution.
Friday, August 05, 2005
Comfortably Num
I like to use the numeric keypad for entering long numbers. To that end, I would prefer to have X11 turn on Num Lock by default. Luckily I'm not the only one who feels that way. Chua Wen Kiat has been kind enough to provide an easy way to invoke Martin-Éric Racine's numlockx utilities at the start of a new X11 session.
We're going to download the numlockx package. Then we'll back up the system file we'll be editing and open it.
sudo apt-get install numlockx
sudo cp /etc/X11/gdm/Init/Default /etc/X11/gdm/Init/Default.bak
sudo gedit /etc/X11/gdm/Init/Default
The last line of the file should read exit 0. Just above that line, we're going to add the following.
if [ -x /usr/bin/numlockx ]; then
/usr/bin/numlockx on
fi
Save the edited file. If you want the change to take effect immediately, close all applications and enter the command sudo /etc/init.d/gdm restart, which will restart GNOME.
Please note that for reasons unknown to me the above command does not work as expected on some systems. Mine is one of them. If the command kills GNOME but fails to restart it, you could enter sudo reboot from the console or switch back to the console where X11 was running (Ctrl+Alt+F7) and reboot from there (Ctrl+Alt+Del). You may also be able to start a new session with the command startx -- :consolenumber, where consolenumber is the number of an unused console. In any case, Num Lock should now turn on at the beginning of each new session.
We're going to download the numlockx package. Then we'll back up the system file we'll be editing and open it.
sudo apt-get install numlockx
sudo cp /etc/X11/gdm/Init/Default /etc/X11/gdm/Init/Default.bak
sudo gedit /etc/X11/gdm/Init/Default
The last line of the file should read exit 0. Just above that line, we're going to add the following.
if [ -x /usr/bin/numlockx ]; then
/usr/bin/numlockx on
fi
Save the edited file. If you want the change to take effect immediately, close all applications and enter the command sudo /etc/init.d/gdm restart, which will restart GNOME.
Please note that for reasons unknown to me the above command does not work as expected on some systems. Mine is one of them. If the command kills GNOME but fails to restart it, you could enter sudo reboot from the console or switch back to the console where X11 was running (Ctrl+Alt+F7) and reboot from there (Ctrl+Alt+Del). You may also be able to start a new session with the command startx -- :consolenumber, where consolenumber is the number of an unused console. In any case, Num Lock should now turn on at the beginning of each new session.
Subscribe to:
Posts (Atom)