For quite some time now I've been using Fluxbox as my window manager of choice. It's simple, clean-looking and relatively lightweight. Like most other window managers, Fluxbox is a stacking WM, meaning windows can be moved around freely and overlap. I've never really worked well with this design however, since I tend to open lots of terminal windows and forget to close them. Eventually I have so many windows open it's hard to find anything, so I either have to spend time figuring out which ones I need and which I don't, or just let them be and open yet another terminal. Obviously, this only makes the situation worse.
To solve this problem, I recently switched to Awesome, a tiling window manager. Unlike stacking WMs, tiling WMs try to automatically arrange all of your on-screen windows so that they don't overlap (although most also support "floating" windows like you get with a stacking WM). Basically, when you open the first window it uses the entire screen. When a second window is opened, the screen will be divided between the two. If you close a window, the space it used is divided amongst the other windows, automatically resizing them as necessary to fill the space. This way you don't have to go manually moving and resizing everything.
Additionally, Awesome uses Lua for its configuration file, so it is
much more extensible than many other window managers (tiling or
not). Finally, like other tiling WMs, you can use the keyboard to do
everything in Awesome, although you can use the mouse as well.
posted at: 14:14 | path: /computers/linux/apps/x11 | permanent link to this entry
Hiding Private Data on Public NFS Shares
I have a public read-only NFS share on my machine. Exporting it as read-only stops others from adding, deleting, or modifying any files. However normal Unix permission checks apply so if I make a file owned by my user id that only my user has the read permission for, anyone else can still read it as long as he has a user with the same id on his machine. I was running low on storage space on my home partition, and I needed to temporarily use this public share to store data. The problem is that I didn't want everyone to be able to read what I stored there.
I already have the root_squash option set, but that doesn't help me in this case. Reading the exports manpage, I found the all_squash option which maps all remote UIDs to the anonymous user (nobody). This way even if a remote user has a UID that matches mine, when he attempts to access a file or directory that doesn't have read permission for 'other' he can't read my data.
The moral of the story is that if you have a read-only public NFS share, it's good to add 'all_squash' to the export option list.
posted at: 11:19 | path: /computers/linux | permanent link to this entry
Tweaking Firefox's Popup Blocker
Commenting out 'mouseup' and 'click' allows popups associated with forms to work but stops onClick ads. Unfortunately, it also breaks sites that use onClick to do something useful, like display an image in a new window (which is still evil, but at least it's not an ad). If this breaks a particular site, set firefox to allow popup ads from it.
See this Slashdot thread for more useful stuff.
posted at: 09:04 | path: /computers/linux/apps/firefox | permanent link to this entry
MST3K Episode List
Here's the current list of all Mystery Science Theater 3000 episodes I have in my collection. Some are on DVD, some on VHS, and some in mpeg or avi format.
|Mitchell||???||Joe Don Baker, Linda Evans||Crime Drama/Comedy||Far too long||DVD|
|Overdrawn at the Memory Bank||???||Raul Julia||Science Fiction||00:00||DVD|
|Manos: Hands of Fate||???||Bad Actors||Horror? (I guess)||00:00||DVD|
|Santa Claus Conquers the Martians||???||Christmas||DVD|
Command Line Niftyness
Every so often I find a command that has some nifty feature that I didn't know about. I want to document those commands and their features here.
Finding the full pathname of a file
The 'readlink' command is used to get the name of the file that a symbolic link points to. Normally it sends the exact contents of the symlink to stdout, but with the '-f' option it will resolve the full path to the file and send that to stdout instead. Useful if you want to determine from within a script the full pathname of a file. An additional bit of niftyness is that this works on non-symlink files too as long as you pass the -f option.
I think that only the linux version of readlink does this. There is a standard C library function called realpath() that does the same thing.
posted at: 21:29 | path: /computers/linux | permanent link to this entry
Red Hat Gets Terminal Settings Wrong
Okay, I don't really mind if Red Hat decides to do things differently than Debian, but I do mind if they way they do things breaks the standard, accepted way. In this case, I'm referring to the way that Red Hat configures the terminal backspace character.
Now, Red Hat configures the Backspace key to send Control-H, which is the classic, historical setting for it. However, this interferes with Emacs, which uses Control-H to start the help system. The modern (and IMHO correct) setting is to use ASCII DEL (^?, value 127) for Backspace. Debian follows this method as detailed in the Keyboard Configuration section of the Debian Policy Manual. This allows Backspace, Delete, and Control-H to be interpreted independently of one another.
The fact that Red Hat chooses to use the old configuration bothers me, but I can deal with that. What I can't deal with is that Red Hat puts the following code into /etc/bashrc:
This sets the tty erase character to whatever is specified as the backspace code in the terminfo database. Whoever wrote this is trying to work around terminals that send one character with the backspace key, yet whose tty device is set to use the other character. This may work with terminals on the local machine, or with remote logins to machines that use the same erase character, but it breaks backspace on other systems. The erase character is correctly set by telnetd and sshd to match the erase character used on the client, and this code forces it to be whatever character the server uses. The program being run must generate output that is correctly displayed on the user's terminal, which means that the server must use the terminal settings the client wants, not the other way around.
if [ -x /usr/bin/tput ]; then if [ "x`tput kbs`" != "x" ]; then # We can't do this with "dumb" terminal stty erase `tput kbs` elif [ -x /usr/bin/wc ]; then if [ "`tput kbs|wc -c `" -gt 0 ]; then # We can't do this with "dumb" terminal stty erase `tput kbs` fi fi fi
stty erase ^?explicitly in my shell startup script. This is unacceptable however, since it 1) doesn't change the fact that Red Hat's default setup is broken and 2) some of my accounts are used by several other people who use different distros, and setting the erase character explicitly might break their terminal settings.
# This makes screen treat backspaces '^?' as # deletes. There should be a fix in the code # for the way termcap inheritance works, # but I dont know where to put it, and this works. bindkey -d -k kb stuff "\010"This forces the backspace key to send ^H, which is WRONG!!! Even if you think that ^H is the correct character for backspace (which it isn't), it is not correct to force screen to send ^H for backspace. If my kb/kbs entry is defined as ^?, this code makes it absolutely impossible to send ^?, since screen will always translate it to ^H. I don't know what the heck this is supposed to fix. If my kb/kbs is defined as ^H to begin with, this does nothing and is therefore useless. If the kb/kbs entry is ^?, now it becomes impossible to send DEL to the application. This will break all apps that use the stty erase character to determine what backspace should be if the erase character isn't ^H. Now another fix is required, like the brain-dead 'stty erase `tput kbs`' hack described above. The only way to solve the problem is as follows:
Vi Keybindings for Firefox
I have finally figured out how to make firefox recognize vi keybindings. Below are the steps required to make it work on Debian boxes (most of them work for all unix platforms):
1. Copy /usr/lib/mozilla-firefox/chrome/browser.jar to your $HOME/.firefox/default/xxxxxx.xxx/chrome directory.
2. Unzip browser.jar and edit the content/browser/browser.xul file, adding the following lines to the end of the
<key key="," command="Browser:Back"/>
<key key="." command="Browser:Forward"/>
<key key="a" command="Browser:Home" />
<key key="r" oncommand="BrowserReload();" />
<key key="r" oncommand="BrowserReloadSkipCache();" modifiers="shift" />
<key key="n" command="cmd_findAgain" />
<key key="n" command="cmd_findPrevious" modifiers="shift"/>
<key key="o" command="Browser:OpenLocation" />
<key key="O" oncommand="focusSearchBar();" modifiers="shift"/>
<key key="w" command="cmd_newNavigator" modifiers="shift"/>
<key key="w" command="cmd_newNavigatorTab"/>
<key key="q" command="cmd_close" />
<key key="q" command="cmd_closeWindow" modifiers="shift"/>
<key key="f" command="View:FullScreen" />
<key key="z" command="cmd_textZoomReduce" />
<key key="z" command="cmd_textZoomEnlarge" modifiers="shift"/>
<key key="s" command="View:PageSource" />
<key key="i" command="View:PageInfo" />
<key key="b" command="Browser:AddBookmarkAs" modifiers="shift"/>
<key key="b" command="viewBookmarksSidebar" />
<key key="h" command="viewHistorySidebar" modifiers="shift"/>
<key key="d" command="Tools:Downloads" />
<key key="p" command="cmd_print" modifiers="shift"/>
5. Run 'dpkg-divert --rename /usr/lib/mozilla-firefox/res/builtin/platformHTMLBindings.xml'.
6. Run 'ln -s /etc/mozilla-firefox/platformHTMLBindings.xml /usr/lib/mozilla-firefox/res/builtin'.
7. Add the following lines to /etc/mozilla-firefox/platformHTMLBindings.xml at the end of the
<handler event="keypress" key="a" modifiers="alt" command="cmd_selectAll"/>
<handler event="keypress" key="u" command="cmd_scrollPageUp" />
<handler event="keypress" key="k" command="cmd_scrollLineUp"/>
<handler event="keypress" key="j" command="cmd_scrollLineDown"/>
<handler event="keypress" key="h" command="cmd_scrollLeft"/>
<handler event="keypress" key="l" command="cmd_scrollRight"/>
<handler event="keypress" key="g" command="cmd_scrollTop"/>
<handler event="keypress" key="g" command="cmd_scrollBottom" modifiers="shift"/>
<handler event="keypress" key=";" command="cmd_findTypeLinks"/>
posted at: 18:10 | path: /computers/linux/apps/firefox | permanent link to this entry
Scroll Wheel Hack for Text-Based Apps
Most mice these days have one of those scroll wheels as the middle button. Many graphical applications can use the scroll wheel to scroll various on-screen objects, such as list boxes and text boxes. I was wondering if it were possible to make text-based applications recognize the scroll wheel and scroll appropriately. I found some web sites that focused mainly on getting X to recognize the wheel, and a few that had info on configuring graphical apps to scroll on wheel clicks. The few pages that had any info on text-based apps provided a solution that mapped the wheel clicks to PageUp, PageDown, Up, Down, etc. While this works in many applications, it doesn't allow for the wheel to scroll by different amounts based on context (i.e. 1/2 page in less, 5 lines in vim, etc). So, I played with my .Xdefaults file a bit and came up with the following solution:
Instead of forcing the wheel clicks to map to PageUp or PageDown, why not map the clicks to unused escape sequences? This would effectively create two keys (or more if you want to use modifier keys with the wheel) that could then be mapped on a per-application basis. Here's the relevant section from my .Xdefaults file:
XTerm*vt100.translations: #override\n\ Meta
, : string("0x9b") string("[25;3~")\n\ Meta , : string("0x9b") string("[26;3~")\n\ Shift , : string("0x9b") string("[25;2~")\n\ Shift , : string("0x9b") string("[26;2~")\n\ Ctrl , : string("0x9b") string("[25;5~")\n\ Ctrl , : string("0x9b") string("[26;5~")\n\ , : string("0x9b") string("[25~")\n\ , : string("0x9b") string("[26~")\n\
bindkey "\233[25~" up-line-or-history bindkey "\233[26~" down-line-or-history
My Proposed Partitioning Scheme
Lately I've been thinking of redoing my partitioning scheme. Currently I'm using an LVM-root setup, which has caused me some difficulty. I have been unable to upgrade to the new 2.6 kernel because I can't seem to build a kernel and initrd that support the version of LVM I'm using (can't find the correct version of vgscan). My solution is to move the root partition out of LVM, since I'm never going to resize it anyway. Also, this eliminates the need for an initrd and a seperate /boot partition. In addition, if the LVM partition gets hosed, I have a basic system I can use to fix it.
Here's my planned setup. This will be used on two drives, one 200GB and one 40GB (my laptop). The /var partition is larger because that's where my Apt cache is, and I need it for package downloads. 2.0GB is plenty for me for /usr because I don't install much under /usr/local (Debian has everything packaged already :-), I don't install packages I don't need, and I do my kernel builds under $HOME. /home usually fills the remainder of the disk (or physical volume) unless the disk is huge. I don't think I'll ever exceed 40GB for personal files, but I can always resize /home if I need to.
/dev/hda1 / ext3 150MB /dev/vg01/usr /usr ext3 2.0GB /dev/vg01/tmp /tmp ext3 1.0GB /dev/vg01/var /var ext3 1.0GB /dev/vg01/swap swap ext3 1.0GB /dev/vg01/home /home ext3 between 10GB and 40GB
Yet Another FTP Client
I'll admit it: I'm a commandline junkie. I cut my teeth on an Apple II+ (literally: I started messing with computers at age 3), so to me a GUI has always seemed foreign: nice eye candy, but not the real user interface. I hate being tied to the window system to do my work, so most of the applications and utilities I use are text-based. It bugs me that I have to use OpenOffice to do real word processing and Mozilla Firefox to browse the web (for you fellow CLI addicts, I do use w3m and lynx fairly often, but most sites these days pretty much require a graphical browser to be useful).
I also get frustrated when I can't find a text-based or commandline program to accomplish a task. For a long time, I've been looking for a text-based sftp client that supports command history and tab-completion. Today, I finally found one: yafc (Yet Another FTP Client). I could tell you all about this very cool app, but instead I'll just shamelessly steal the list of features from the project's website:
Lately (due to bad experiences with Red Hat boxes), I've been trying to find a page that clearly states the major reasons for choosing Debian over another Linux distro. The best I've found so far is Manoj Srivastava's "Why Linux? Why Debian?". If you're curious about switching to Debian, or want to persuade someone else to make the switch, you should read this.
posted at: 21:14 | path: /computers/linux/debian | permanent link to this entry