O'reilly X Power Tools.Pdf
Total Page:16
File Type:pdf, Size:1020Kb
X POWER TOOLS ® Chris Tyler Beijing • Cambridge • Farnham • Köln • Paris • Sebastopol • Taipei • Tokyo X Power Tools® by Chris Tyler Copyright © 2008 O’Reilly Media, Inc. All rights reserved. Printed in the United States of America. Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472. O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (safari.oreilly.com). For more information, contact our corporate/institutional sales department: (800) 998-9938 or [email protected]. Editor: Andy Oram Indexer: Ellen Troutman-Zaig Production Editor: Mary Brady Cover Designer: Marcia Friedman Copyeditor: Mary Brady Interior Designer: David Futato Proofreader: Laurel Ruma Illustrator: Robert Romano Printing History: December 2007: First Edition. Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of O’Reilly Media, Inc. X Power Tools, the image of a power sander, and related trade dress are trademarks of O’Reilly Media, Inc. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and O’Reilly Media, Inc. was aware of a trademark claim, the designations have been printed in caps or initial caps. While every precaution has been taken in the preparation of this book, the publisher and author assume no responsibility for errors or omissions, or for damages resulting from the use of the information contained herein. This book uses RepKover™, a durable and flexible lay-flat binding. ISBN-10: 0-596-10195-3 ISBN-13: 978-0-596-10195-4 [M] Table of Contents Preface . ix Part I The X Server 1. Introduction to the X Window System . 3 1.1 The X Window System 3 1.2 The History of X 4 1.3 The Renaissance: New X Versus Old X 4 1.4 X by Any Other Name 6 1.5 Seven Layers of an X-based GUI 6 1.6 Where Is the Server? 9 1.7 Why Windows Look and Act Differently 9 1.8 Toolkits and Desktop Environments 10 1.9 The Role of Freedesktop.org 11 1.10 Display Hardware 11 1.11 Displays, Screens, and Xinerama 19 1.12 Display Specifications 20 1.13 TCP/IP Ports 21 1.14 Local Connection Mechanisms 21 1.15 Server Extensions 22 1.16 Where to Draw the Line: Kernel Versus User-Space Drivers 24 2. Starting a Local X Server . 25 2.1 One Size Doesn’t Fit All 25 2.2 Virtual Terminals 25 2.3 Starting a Raw X Server Manually 26 iii 2.4 Using a Display Manager to Start the X Server 27 2.5 Enabling or Disabling the Display Manager at Boot Time 28 2.6 What Started the Display Manager? 30 2.7 Starting Multiple X Servers Using a Display Manager 31 2.8 Starting Additional X Servers on Demand Using a Display Manager 33 2.9 Starting an X Server with Clients Only When Needed 35 2.10 Switching VTs from the Shell Prompt 36 2.11 Starting X Within X 36 2.12 No Mouse! 37 2.13 Bailing Out: Zapping X 39 2.14 Terminating X Automatically 39 3. Basic X.org Configuration . 40 3.1 What Is There to Configure? 40 3.2 Why Only root Can Configure the X Server 40 3.3 Places Your Configuration Could Hide 41 3.4 Let the X Server Configure Itself 43 3.5 The xorg.conf Configuration File 44 3.6 Optional Sections in the xorg.conf Configuration File 49 3.7 Configuring the Pointer Device 51 3.8 Configuring a Two-Button Mouse 52 3.9 Configuring a Mouse with a Scrollwheel 53 3.10 Configuring a Synaptics TouchPad 53 3.11 Enabling DPMS 54 3.12 Configuring Video Card Driver Options 56 3.13 LightSteelBlue and Other Color Names 58 3.14 Configuring a Monitor’s Scan Rates 59 3.15 Reading Server Log Files 62 3.16 Configuring the Default Depth of a Screen 64 3.17 Configuring the Resolution of a Screen 65 4. Advanced X.org Configuration . 67 4.1 Multi-Screen Configuration 67 4.2 Xinerama Configuration 68 4.3 Differences Between Multi-Screen and Xinerama Modes 69 4.4 Positioning Screens 71 4.5 Overlapping Xinerama 72 4.6 Scrolling Virtual Screens and Xinerama 74 iv Table of Contents 4.7 Using Multiple Outputs from One Video Card 77 4.8 Parallel Pointing Devices 79 4.9 Parallel Keyboards 81 4.10 Using X with GPM or MOUSED 83 5. Using the X Server . 85 5.1 Interacting with the X Server 85 5.2 Changing Resolution On-the-Fly 85 5.3 Changing the Resolution and the Screen Size Dynamically 86 5.4 Using the Middle Mouse Button 87 5.5 Using the Clipboard 88 5.6 Keyboard Focus 90 5.7 Keyboard and Mouse Grabs 90 Part II X Clients 6. X Utility Programs . 95 6.1 The Unused Toolbox 95 6.2 Determine the Display Configuration 96 6.3 Getting Window Information 97 6.4 Viewing Server Settings 100 6.5 Control That Bell! 101 6.6 Adjusting the Keyboard Repeat Rate 102 6.7 Adjusting the Mouse Acceleration 103 6.8 Playing with the Lights 104 6.9 Killing a Rogue Client 105 6.10 Examining Part of the Display in Detail 105 6.11 Script a Screen Dump 107 6.12 Preventing the Screen from Blanking During Presentations 108 6.13 Eye Candy: xscreensaver 109 6.14 Redrawing the Screen 111 7. Running X Clients . 112 7.1 Running X Clients 112 7.2 Background Operation 112 7.3 Geometry 113 7.4 Split Personality: Running Nongraphical Applications 115 Table of Contents v 8. Session Managers, Desktop Environments, and Window Managers . 118 8.1 X and Desktop Environments 118 8.2 Session Managers 119 8.3 Virtual Desktops 120 8.4 Starting GNOME 123 8.5 Starting KDE 126 8.6 Starting Xfce 128 8.7 Using a Window Manager Alone 129 Part III Colors, Fonts, and Keyboards 9. Color . 135 9.1 RGB and Other Color Systems 135 9.2 Visuals 136 9.3 Gamma 138 9.4 Color Management Systems 140 10. Core Fonts: Fonts the Old Way . 142 10.1 Old Fonts Versus New Fonts 142 10.2 Configuring the Font Path 143 10.3 Using a Font Server 145 10.4 Font Names 146 10.5 Installing and Removing Fonts 148 11. Pango, Xft, Fontconfig, and Render: Fonts the New Way . 150 11.1 Client-Side Fonts 150 11.2 Adding and Removing Fonts Manually 151 11.3 Adding and Removing Fonts Using GNOME 151 11.4 Adding and Removing Fonts Using KDE 153 11.5 Fontconfig Font Names 155 11.6 Fontconfig Utilities 156 11.7 Installing the Microsoft Fonts 157 11.8 Rendering Options 157 vi Table of Contents 12. Keyboard Configuration . 161 12.1 Keyboards and XKB 161 12.2 The Location of XKB Files 162 12.3 XKB Components 162 12.4 Selecting an XKB Keymap Using Rules 163 12.5 Using Keyboard Groups 166 12.6 Setting the Keymap in the xorg.conf File 167 12.7 Setting the Keymap from the Command Line 168 12.8 Setting the Keymap Using a Keyboard Configuration File 169 12.9 Compiling Keyboard Maps 169 12.10 Viewing or Printing a Keyboard Layout 170 Part IV Using X Remotely 13. Remote Access . 175 13.1 Network Transparency 175 13.2 Displaying on a Remote Server 175 13.3 Enabling Remote Sessions 176 13.4 Accessing a Remote Session on a Specific Host 178 13.5 Accessing a Remote Session on Any Available Host 178 13.6 Accessing a Remote Session from a List of Available Sessions 179 13.7 The Three Challenges of Remote Access 181 13.8 Host-Based Access Control 182 13.9 xauth and Magic Cookies 183 13.10 The X Security Extension 186 13.11 Low-Bandwidth X (LBX) 187 13.12 X Tunneling with SSH 188 13.13 Using Public Keys with SSH 190 13.14 Using Passphrase Protection of SSH Keys 191 13.15 OpenSSH and the SECURITY Extension 192 14. Using VNC . 193 14.1 The VNC System 193 14.2 So Many VNC Versions! 194 14.3 Xvnc Basics 195 14.4 The vncserver Script 196 Table of Contents vii 14.5 Using the VNC Viewers 197 14.6 Using Standing VNC Servers 198 14.7 Configuring the Xvnc Web Server 199 14.8 Customizing the VNC Java Applet Web Page 199 14.9 Starting VNC On Demand Using xinetd 202 14.10 Starting VNC On Demand Using inetd 204 14.11 Using the Java Applet with On-Demand VNC Servers 204 14.12 Accessing VNC Securely Using SSH 205 14.13 Embedding an X Application in a Web Page 206 14.14 Using KDE and Gnome Remote DesktopAccess Tools 210 14.15 Using the VNC Extension to the X.Org Server 212 14.16 Using VNC to Share a Presentation 213 14.17 Bypassing a Firewall 215 Part V Special Configurations 15. Building a Kiosk . 219 15.1 What Is a Kiosk, and Why Do I Want One? 219 15.2 Selecting Kiosk Hardware 219 15.3 Configure X for a Kiosk 221 15.4 Controlling the Keyboard 222 15.5 Controlling the Mouse 223 15.6 Starting a Single Fullscreen Application 224 15.7 Network Status Monitoring 225 15.8 Using xscreensaver to Reset a Kiosk 228 15.9 Refining the Kiosk Appearance 229 15.10 Putting It All Together: Scripting a Kiosk 230 15.11 Booting a Kiosk 232 15.12 Creating a Video Wall 233 Index .