Loading...
 

cygwin

Cygwin setup for a unix hack

I am a unix hack yet I run windows at home and on my work PC. I find that running cygwin is a good approximation for the Solaris and Linux systems that I also enjoy. My biggest surprise is the X-Windows support in cygwin; truly impressive.
  • Use "file" to check for files with CR/LF

Packages to install

I don't have a good package list because I run gEDA schematic capture software that has a lot of dependencies. I believe that most users will not need all the packages that I have installed. For sure you want to install the x-server packages. My suggestion is to select the rxvt, xorg-server, and xinit. That should pull in my favorite shell and the X Server.

Gtk Fixes

mkdir -p ~/.local/share

fatal error - unable to remap

  1. Shutdown all Cygwin processes and services
  2. Start ash or dash (do not use bash or a terminal emulator like rxvt or mintty). The easiest way to do this is to use Windows Explorer and navigate to the top level of your cygwin installation, and double-click ash.exe or dash.exe in the bin/ directory.
  3. Execute /bin/rebaseall (in the ash/dash window)

Create windows shortcuts

I have a specific behavior that I like when it comes to scroll back buffers. The settings below will create a large scroll back buffer that will pause where I'm looking regardless of output to the TTY. The behavior will also immediately jump to the bottom if I type something. Nothing is more frustrating than scrolling backwards only to have the output jump back to the bottom or continue scrolling because of additional output. This setup is also possible in putty (my favorite Windows telnet/ssh/serial client).
Options for rxvt
C:\cygwin\bin\rxvt.exe 
-display :0                  #use display 0 if started with xwindows
-fn "Lucida Console-12"      #console font
-bg white                    #foreground
-fg black                    #background
-sl 10000                    #save 10000 lines of scroll back
-sr                          #put scroll bar on right
-si                          #turn off scroll to bottom on tty output
-sw                          #turn off scrolling with the scrollback buffer
-sk                          #turn on scroll to bottom on keypress
-tn rxvt                     #tell other programs this is rxvt
-geometry 120x50             #120 rows by 50 columns
-e /bin/bash --login         #start bash

Shortcut for rxvt terminal
C:\cygwin\bin\rxvt.exe -display :0 -fn "Lucida Console-12" -bg white -fg black -sl 10000 -sr -si -sw -sk -tn rxvt -geometry 120x50 -e /bin/bash --login

Shortcut for XWin Server
C:\cygwin\bin\run.exe /usr/bin/bash.exe -l -c /usr/bin/startxwin.exe

Contents for .startxwinrc
rxvt -display :0 -fn "Lucida Console-12" -bg white -fg black -sl 10000 -sr -si -sw -sk -tn rxvt -geometry 120x50 -e /bin/bash

regedit file for right-click directory menu
[HKEY_CLASSES_ROOT\Directory\shell\PromptCMD]
@="&Prompt CMD"
[HKEY_CLASSES_ROOT\Directory\shell\PromptCMD\command]
@="cmd  /f:on /k @cd /d %1 & title Prompt"
[HKEY_CLASSES_ROOT\Directory\shell\PromptBash]
@="Prompt &bash"
[HKEY_CLASSES_ROOT\Directory\shell\PromptBash\command]
@="C:\\cygwin\\bin\\rxvt.exe -bg white -fg black -fn \"Lucida Console-12\" -sl 10000 -sr -si -sw -sk -tn rxvt -geometry 120x50 -display :0 -e /bin/bash --login -c \"cd \\\"`cygpath '%1'`\\\" ; exec /bin/bash \""


Troubleshooting

  • Tip - Online cygcheck - query packages and files. Searches are regex so use \ to escape a period, ex. 'gmp\.h'
    • cygcheck -f : find package file belongs to
    • cygcheck -l : list package contents
    • cygcheck -p : query packages on cygwin.com from the command line
    • cygcheck -c : verifies package is installed and list the version

Printing

By the cygutils package includes lpr and properly detects the default windows printer. You can check this by evaluating the PRINTER environment var
echo $PRINTER

If your program wants to print in postscript, and your printer does not understand postscript, you should install the ghostscript package.
Ghostscript, Ghostview and GSview
  • ghostscript
  • gv

Notes

I'm trying to find a command that will allow gschem to print directly to my windows printer.
  • Convert PS to PDF
"C:\Program Files\Adobe\Acrobat 6.0\Distillr\acrodist.exe" "%1"
acrodist is missing a font used by gschem
  • http://www.linux-foundation.org/en/OpenPrinting/Database/DatabaseIntro

No luck so far!


Found a script that might work in gschem except that I don't want to use enscript; rather I want to redirect from stdin. Dohh.. my bash skills are not that good. Maybe I'll play with it the next time I get tired of "print to a file, open a shell, run ps2pdf, open a file explorer, find the pdf, open w/ acrobat, print from acrobat....."

#!/bin/bash
#
# print-code
#
# Generate a filename based on the current date/time
FILENAME=`date +%Y%m%d%H%M`
#
# Generate PostScript
enscript "$@" -o $FILENAME.ps
#
# Generate PDF
ps2pdf $FILENAME.ps
#
# Print PDF with Adobe Reader
c:/Program\ Files/Adobe/Acrobat\ 7.0/Reader/AcroRd32.exe /p $FILENAME.pdf
#
# Remove temporary files
\rm $FILENAME.ps $FILENAME.pdf



Also, gschem uses this guile script to print; it can be modified, but I'll need to research how to use Guile...
geda\share\gEDA\scheme\print.scm


Contributors to this page: michael and admin .
Page last modified on Thursday 08 of May, 2014 09:43:22 CDT by michael.