Logitech Marble Mouse

I wanted to use the scroll buttons on my Logitech Marble Mouse. After a bit of poking, I got it to work as I wished. Here’s my xorg.conf file:

# /etc/X11/xorg.conf (xorg X Window System server configuration file)
#
# This file was generated by dexconf, the Debian X Configuration tool, using
# values from the debconf database.
#
# Edit this file with caution, and see the /etc/X11/xorg.conf manual page.
# (Type "man /etc/X11/xorg.conf" at the shell prompt.)
#
# This file is automatically updated on xserver-xorg package upgrades *only*
# if it has not been modified since the last upgrade of the xserver-xorg
# package.
#
# If you have edited this file but would like it to be automatically updated
# again, run the following command:
#   sudo dpkg-reconfigure -phigh xserver-xorg

Section "Files"
  FontPath  "unix/:7101"
  FontPath  "/usr/share/fonts/truetype"
  FontPath  "/usr/share/fonts/X11/misc"
  FontPath  "/usr/X11R6/lib/X11/fonts/misc"
  FontPath  "/usr/share/fonts/X11/cyrillic"
  FontPath  "/usr/X11R6/lib/X11/fonts/cyrillic"
  FontPath  "/usr/share/fonts/X11/100dpi/:unscaled"
  FontPath  "/usr/X11R6/lib/X11/fonts/100dpi/:unscaled"
  FontPath  "/usr/share/fonts/X11/75dpi/:unscaled"
  FontPath  "/usr/X11R6/lib/X11/fonts/75dpi/:unscaled"
  FontPath  "/usr/share/fonts/X11/Type1"
  FontPath  "/usr/X11R6/lib/X11/fonts/Type1"
  FontPath  "/usr/share/fonts/X11/100dpi"
  FontPath  "/usr/X11R6/lib/X11/fonts/100dpi"
  FontPath  "/usr/share/fonts/X11/75dpi"
  FontPath  "/usr/X11R6/lib/X11/fonts/75dpi"
  # path to defoma fonts
  FontPath  "/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType"
EndSection

Section "Module"
  Load  "i2c"
  Load  "bitmap"
  Load  "ddc"
  #Load "dri"
  Load  "extmod"
  Load  "freetype"
  Load  "glx"
  Load  "int10"
  Load  "vbe"
EndSection

Section "InputDevice"
  Identifier  "Generic Keyboard"
  Driver    "kbd"
  Option    "CoreKeyboard"
  Option    "XkbRules"  "xorg"
  Option    "XkbModel"  "pc104"
  Option    "XkbLayout" "us"
EndSection

Section "InputDevice"
  Identifier  "Configured Mouse"
  Driver    "mouse"
  Option    "CorePointer"
  Option    "Device"    "/dev/input/mice"
  Option    "Protocol"    "Auto"
  Option    "Buttons" "4"
  Option    "EmulateWheel" "true"
  Option    "EmulateWheelButton" "8"  #Option   "Emulate3Buttons" "true"
EndSection

Section "Device"
  Identifier  "nVidia Corporation C51 [GeForce 6150 LE]"
  Driver "nvidia"
  #Driver   "nv"
  BusID   "PCI:0:5:0"
  Option "SWcursor"
EndSection

Section "Monitor"
  Identifier  "Generic Monitor"
  Option    "DPMS"
  HorizSync 28-84
  VertRefresh 43-60
EndSection

Section "Screen"
  Identifier  "Default Screen"
  Device    "nVidia Corporation C51 [GeForce 6150 LE]"
  Monitor   "Generic Monitor"
  DefaultDepth  24
  SubSection "Display"
    Depth   1
    Modes   "1680x1050" "1024x768" "800x600" "640x480"
  EndSubSection
  SubSection "Display"
    Depth   4
    Modes   "1680x1050" "1024x768" "800x600" "640x480"
  EndSubSection
  SubSection "Display"
    Depth   8
    Modes   "1680x1050" "1024x768" "800x600" "640x480"
  EndSubSection
  SubSection "Display"
    Depth   15
    Modes   "1680x1050" "1024x768" "800x600" "640x480"
  EndSubSection
  SubSection "Display"
    Depth   16
    Modes   "1680x1050" "1024x768" "800x600" "640x480"
  EndSubSection
  SubSection "Display"
    Depth   24
    Modes   "1680x1050" "1024x768" "800x600" "640x480"
  EndSubSection
EndSection

Section "ServerLayout"
  Identifier  "Default Layout"
  Screen    "Default Screen"
  InputDevice "Generic Keyboard"
  InputDevice "Configured Mouse"
EndSection

Section "DRI"
  Mode  0666
EndSection

More on screen

While I don’t have a screen for a graphical user environment (like X), I do have screen for the terminal, and it rocks.

Here’s how I use it; I have four primary email accounts, each with their own .muttrc. I open a screen session for each account, plus one session as a scratch pad, for the variety of non-mail activities that I do each day. (If you’re thinking that one session for all non-mail activities is too few, you’d be right most of the time, but I have a solution for that too.) I start all of these sessions by calling screen with a special config file, which I call .myscreenrc, to separate it from the regular .screenrc. It looks like this:

autodetach on
shell -$SHELL
screen -t scratch
screen -t uoft u
screen -t nerd n
screen -t witteman w
screen -t woolgathering wg

The -t option givens me a title for each session within screen – which helps me keep everything straight. I call this with a line in my .xinitrc, like so:

sleep 1 && urxvt -geometry 80x56+0+0 -e screen -c .myscreenrc &

The delay helps it come up after my backdrop is drawn, so I don’t have a blank behind my transparent terminal.

All of this is now nicely set up, and I am in mutt (the last email account). I hop between instances in three ways: Ctrl-a " for a list of sessions to scroll through, Ctrl-a ' and the number of the session I want to be in or Ctrl-a n or Ctrl-a p for the next and previous session. If I need a fresh session, it’s as easy as Ctrl-a c.

There are a couple of problems with this setup. The mutt sessions only lasts as long as mutt is open, so if my fingers, from long training, close mutt, then I lose that session as well, and I have to start it afresh. The solution, rather than training my fingers, was to prevent mutt from closing. I remapped q in the browser and index modes to be the equivalent of c?, which means that I can only close mutt from the pager by hitting x. Fine by me, and it lets me have long-lived sessions.

Now, whether I am sitting at my machine or ssh-ing in from work, I have all the same things at my disposal, and I can comfortably leave aspects of my work open when changing locations. If I have left my sessions running at home, I simply call screen -x when at work, and I am in my familiar environment. If I have detached at home then screen -r is the right call.

However, if I have detached at home and stopped my X session, I run into the other problem. When I started screen via my .xinitrc I also set the $DISPLAY variable in each session. As such, when I am logged in remotely without X running, certain programs throw errors because I am not able to reach the X session. The sidestep for this is to unset DISPLAY if I am going to be using programs that care about that variable, most notably vim.

It sounds like work, but it is actually extremely sweet, and really easy.

vimrc

" Set settings
set autoindent
set title
"set notitle
set ruler
set nocompatible
set showcmd
set ts=2
set shiftwidth=2
set expandtab
set shiftround
set smarttab
set tw=72
set backspace=indent,eol,start
set incsearch
set showmatch
set pastetoggle=<F11>
filetype plugin on
syntax on
colors ron
let mapleader=","

" Remember where I last edited a file
set viminfo='10,"100,:20,%,n~/.viminfo
    au BufReadPost * if line("'"") > 0|if line("'"") <= line("$")|exe("norm '"")|else|exe "norm $"|endif|endif

if &term =~ "xterm-debian" || &term =~ "xterm-xfree86" || &term =~ "Eterm"
  set t_Co=16
  set t_Sf=^[[3%dm
  set t_Sb=^[[4%dm
endif
" Settings set

" Map mappings
:inoremap ( ()<ESC>i
:inoremap [ []<ESC>i
:inoremap " ""<ESC>i
:inoremap { {}<ESC>i
:inoremap < <><ESC>i

"map W :!aspell -c -x % " old - vim7 has spellcheck now
map F gqap

" http://vim.sourceforge.net/tips/tip.php?tip_id=465
" make an element out of anything you type with a CR in the middle
inoremap ,,, <esc>diwi<<esc>pa><cr></<esc>pa><esc>kA

" Fix common typos
iab teh the
iab hte the
iab adn and
iab nad and
iab taht that
iab htat that
iab fo of
iab ot to
iab wiht with

set pastetoggle=<F10>

" SmartTab wrapper
function! SmartTab()
  let col = col('.') - 1
  if !col || getline('.')[col - 1] !~ 'k'
    return "<tab>"
  else
    return "<c-p>"
  endif
endfunction

" turn on SmartTabs
inoremap <tab> <c-r>=SmartTab()<cr>

" Turn on the spellcheck
setlocal spell spelllang=en_us
set spellfile=~/.vimspell.utf8.add

" Mappings mapped

" Language-specific skeleton files
" Perl
autocmd BufNewFile *.pl 0r ~/.vim/skel/skel.pl
" HTML
autocmd BufNewFile *.html 0r ~/.vim/skel/skel.html
" Python
autocmd BufNewFile *.py 0r ~/.vim/skel/skel.py