Thursday, January 21, 2010

Cygwin X Session Tuning

The goal is to be able by one click command run cygwin Xserver with standardly determined session (as you would run startx script).

Create 'startx_' file (put it into the C:\cygwin\bin), you can tweak startx parameters in there.

startx_
#!/bin/sh
/bin/startx -- -multiwindow -clipboard -silent-dup-error

In your home directory you need file '.xinitrc' to take precendence before C:\cygwin\etc\X11\xinit\xinitrc. If that global file is ok for you just skip this, but usually you will want to specify what xclients to run. Just copy above global xinitrc and tweak it. I've needed to put '-nocpp' parameter to the xrdb, otherwise it refused to load my resources.

.xinitrc
#!/bin/sh
userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
sysresources=/etc/X11/xinit/.Xresources
sysmodmap=/etc/X11/xinit/.Xmodmap

# merge in defaults and keymaps
if [ -f $sysresources ]; then
    xrdb -merge $sysresources
fi

if [ -f $sysmodmap ]; then
    xmodmap $sysmodmap
fi

if [ -f "$userresources" ]; then
    xrdb -merge -nocpp "$userresources"
fi

if [ -f "$usermodmap" ]; then
    xmodmap "$usermodmap"
fi

# start some nice programs

#twm &
#xclock -geometry 50x50-1+1 &
#xterm -geometry 80x50+494+51 &
#xterm -geometry 80x20+494-0 &
#exec xterm -geometry 80x66+0+0 -name login

#exec twm
#exec mwm
#exec aewm++
#exec fvwm
#exec xwinwm

exec xterm -e /usr/bin/bash -l

Place file '.Xresources' into your home directory (tweaks for xterm).

.Xresources
*customization: -color
*reverseVideo: true
*initialFont: 5

! Color the popup menus and the menubar to match:
*SimpleMenu*backgroundPixmap:   gradient:vertical?dimension=500&start=gray90&end=gray60
!*SimpleMenu*background: gray20
*SimpleMenu*foreground: gray50

! Color the menubar to match:
*Form.menubar.background: gray20
*Form.menubar*background: gray60
*Form.menubar.foreground: gray50
*Form.menubar*foreground: gray1
*Form.background: gray20
*form.background: gray20

!*background: gray90

Then place shortcut on the desktop or create cmd file with:

c:\cygwin\bin\run.exe /usr/bin/bash.exe -l -c startx_

No comments :

Post a Comment