Install ZTreeWin in Linux

This howto will show you how to install ZTreeWin under Linux using Wine. I was able to get it working in Ubuntu 8.04 “Hardy Heron” with KDE 3.5. YMMV.

You will need:

  • A Linux installtion running a graphical desktop environment (X Windows with KDE, GNOME, or your favorite window manager)
  • An x86-based CPU (Intel, AMD, etc) because Wine can’t run native Windows executables on non-x86 CPUs.

I don’t believe there is any way to get ZTreeWin running in a Linux text terminal environment because of ZTreeWin’s extensive use of Shift, Ctrl, and Alt keys and the way it interacts with the console display which is very different from how most Linux “console” apps work.

I will show you how to install it in your graphical Linux desktop and create a launcher and customize the window so that it shows 80×25 characters in an appropriately-sized frame instead of full-screen frame with extra empty black space.

Preparation

Install Wine using your favorite package manager.

sudo apt-get install wine

I suggest you also run the “winecfg” command and make sure the H: drive is mapped to your home folder under the Drives tab.

Run the Installer

Get the latest ZTreeWin installer from the ZTree web site, then run it inside Wine with this command:

cd ~/downloads
wine ztw???.exe   # Fill in the correct version number in the file name here.

Run through the setup wizard as you would on Windows.

Create a Launch Script

cd "~/.wine/drive_c/Program Files/ZTreeWin"
touch start_ztree.sh
chmod +x start_ztree.sh
nano start_ztree.sh

Enter the following code in the nano text editor and hit Ctrl + X to save and quit:

Filename: ~/.wine/drive_c/Program Files/ZTreeWin/start_ztree.sh

#!/bin/bash
cd "/home/USERNAME/.wine/drive_c/Program Files/ZTreeWin"
wineconsole --backend=user ZTWIN.BAT H:\

Subsitute your username where it says USERNAME.

Now edit your ZTWIN.BAT:

wine notepad ZTWIN.BAT   # We're using Notepad because it writes files with DOS-style line endings

The batch file should read like this:

Filename: ~/.wine/drive_c/Program Files/ZTreeWin/ZTWIN.BAT

@"C:\Program Files\ZTreeWin\ZTW.EXE" %*

Fix it if your existing one is using short folder names like PROGRA~1. Save and close.

Add the Launcher to your Applications Menu

I converted ZTreeWin’s icon to a PNG file suitable for a desktop launcher in KDE and GNOME. Get it here and save it to ZTreeWin’s executable folder. (Right-click on the following image and use your browser’s Save Image command.)

Now, edit your applications menu and add ZTreeWin with the following properties:

Field name Value
Name ZTreeWin
Command '/home/USERNAME/.wine/drive_c/Program Files/ZTreeWin/start_ztree.sh'
Icon '/home/USERNAME/.wine/drive_c/Program Files/ZTreeWin/ztw2.png'
Enable Launch Feedback unchecked

Substitute your username where it says USERNAME in the “Command” and “Icon” fields, and don’t skip the single quotes (').

Launch ZTreeWin

Run the launcher you created.

Well, that didn’t work out quite right, did it? I tried changing the window parameters in the ZTreeWin config screen (Alt + F10) and restarting ZTreeWin and that didn’t have any effect. I tried running ZTW.BAT from inside a CMD.EXE session in an existing console window and that didn’t work either.

I guess for now we’ll just have to settle for an 80×25 window. Here’s how you can enforce the correct pixel size for the window:

Force ZTreeWin’s Window to Always Be a Specified Size

First, right-click on the window and click Properties. Set the Font to Deja Vu Sans Mono. I found this to have the best coverage of non-letter characters ZTreeWin uses to draw graphics on the screen, but it’s not perfect. Set the size to 18px.

Now go to the Configuration tab and make sure Buffer zone and Window size are 80×25.

Click OK and make sure you choose to “Retain these settings for later sessions“.

Now… we’re not completely finished yet. Something in the way ZTreeWin starts up causes the console to resize itself to take up most of the screen. In KDE 3.5, you can fix this by right-clicking on the titlebar of the window selecting Configure Window Behavior. Go to the Window-Specific Settings page and click New.

Enter these values in the Window tab:

Field name Value
Description Wine Console
Window class (application type) wineconsole.exe Wine
Match whole window class checked
dropdown after Window class (applicaiton type) Exact Match

Enter these values into the Geometry tab:

Field name Value
Size checked
Size dropdown Force
Size textbox 728,478

Click OK to close the top settings window, the OK to save and close the window that launched that. Close and restart ZTreeWin to make sure it all came out right.

If the window size didn’t come out exactly right, try using the Detect button on the Window tab of the Window-Specific Settings dialog box, right after you’ve used the Wine Console window properties command to set the window size to 80×25 characters. YMMV.

I’m not sure if GNOME and XFCE and other desktops have a similar force-window-size feature, but I’m guessing you the reader will figure out some way to do it, or just live with the window size bug if you’re not using KDE.

Conclusion

If you got it all working correctly your ZTreeWin window should look something like this:

Now don’t forget to setup your ZTreeWin Application window (F9), your Editors (Alt + F10 → A, B), and other external helper programs. Programs running under Wine can launch any Linux program even with command line parameters. Any files paths given in the invocation will be translated to Linux filesystem paths so the Linux program can find them.

I hope this guide helps some other ZTree fans to get their favorite file manager running in Linux.

Problems?

(Added 12 September 2008)

I wrote the bulk of this guide in a late-night stupor after the excitement of getting it to work for myself. It occurs to me now that some WINE newbies might need a little help with troubleshooting. If you do all that stuff above and it fails and you don’t even know why, you might be missing out on some error messages. To see if WINE is having issues, try running the launcher script from the command prompt:

"/home/USERNAME/.wine/drive_c/Program Files/ZTreeWin/start_ztree.sh"

If WINE isn’t reporting any errors, also try running the ZTWIN.BAT Windows launcher script from the Windows command prompt:

wineconsole --backend=user cmd.exe

(window opens)

cd /d "C:\Program Files\ZTreeWin"
ZTWIN.BAT

Leave a Reply

Please view the Comment Policy before submitting a comment.
 

Your email address will not be published. Required fields are marked *