środa, 27 maja 2009

Getting rid of cmd.exe window in cygwin/x11 -- better solution

As I wrote before I had some problems with running x11 apps in cygwin, when cmd.exe window appeared every time. Yesterday's solution works, but it is not perfect. I found that:
  • I cannot pass any parameters to the apps being started
  • There are a lot of copies of cmd.exe in system memory
Then I have investigated shortuts somewhere in my Start Menu and I have found that x11 applications are run via the special wrapper program - run.exe
Manual says that: ,,run -- start programs with hidden console window''
So, to open an xterm window with a login shell in it, you can type:

run xterm -ls

That's all, folks.
(No wonder I could not find it in Google -- everyone uses xterm in a proper way -- via Start Menu shortcut)

wtorek, 26 maja 2009

Getting rid of cmd.exe window in cygwin/x11

I have been using cygwin environment for a long time, including x11 applications and I would like to get rid of cmd.exe window every time I am running an application, via Start Menu -> Run. This is really annoying.
I have been googlin' for several months for the solution. I found a snippet to be run via Windows Scipting Host. Here it is:

CreateObject("WScript.Shell").Run """" & WScript.Arguments(0) & """", 0, False

(to be saved, for instance, as c:\snippet.exe)

Example of use:

wscript.exe c:\snippet.vbs xterm

Pros: cmd.exe window does not appear any more

Cons: I am not familiar with WSH api and I don't know how to pass an extra argument or arguments to the command being run.

Anyway, this solution works.

poniedziałek, 27 kwietnia 2009

Setting a wallpaper with display tool

To set a wallpaper using display tool , use the following command in your ~/.xsession file:

display -dispose Background -window root /path/to/your/wallpaper.jpg

poniedziałek, 13 kwietnia 2009

GTK+ settings with ~/.gtkrc-2.0

To set gtk+ theme, font, etc without using GNOME, you should add some lines to your ~/.gtkrc-2.0 with following syntax:

gtk-icon-theme-name = "IconThemeName"
gtk-theme-name = "ThemeName"
style "font"
{
font_name = "FontName size"
}
widget_class *" style "font"

Example:

gtk-icon-theme-name = "Human"
gtk-theme-name = "Human"
style "font"
{
font_name = "Tahoma 8"
}
widget_class *" style "font"

środa, 18 marca 2009

Cygwin's bash in NTEmacs

For all of you who wants to use Cygwin's bash as your Emacs shell (that's right, the shell instance you run via M-x shell), please paste the following lines into your ~/.emacs file

(setq shell-file-name "bash")
(setenv "SHELL" shell-file-name)

Also, to get rid of unwanted ^M line-endings in the shell buffer, add the following line:

(add-hook 'comint-output-filter-functions 'comint-strip-ctrl-m)

to your ~/.emacs

poniedziałek, 3 listopada 2008

ImageMagick: auto-rotating images with convert

Popular digital cameras put EXIF information into image file -- for instance to describe its orientation. I have always used GIMP to open all my images, then to save their portrait versions. GIMP 2.6 offers ,,new feature'': image is auto-rotated according to EXIF data, but when you want to save it claims there were no changes in this image.
ImageMagick's convert utility offers -auto-orient option to rotate the image according to EXIF information; it obsoletes the GIMP completely and it is also wonderful tool for mass-rotating/converting huge sets of images.
Example usage:

convert filename -auto-orient filename

wtorek, 16 września 2008

Java: Numeric spinners in Swing

Spinner is a single input field which lets you select a value; typical spinner provides a pair of arrow buttons for selecting an element step-by-step.
The behaviour of JSpinner widget is determined by a model assigned with it.
For a spinner that should display numerical values, SpinnerNumberModel class is designed.
Here is a short usage of a numeric spinner:

SpinnerNumberModel model = new SpinnerNumberModel(1024, 1, 65535, 1);
JSpinner spinner = new JSpinner(model);

// (...)

int x = ((Integer)model.getValue().intValue();

About the model's constructor:
* first param is a default value that will be displayed in the spinner at the beginning
* second param is the minimum value
* third param is the maximum value
* fourth param is the step used when scrolling the spinner (by page up/page down or a mouse wheel)