[[howto:desktop:install-ztreewin-in-linux]]

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

howto:desktop:install-ztreewin-in-linux [2018-08-05 04:25]
howto:desktop:install-ztreewin-in-linux [2020-08-13 06:17] (current)
Line 1: Line 1:
 +~~META:
 +creator = Brendan Kidwell
 +&date created = 2008-09-04
 +~~
 +{{tag>file-manager linux wine ztreewin}}
 +~~DISCUSSION~~
 +====== Install ZTreeWin in Linux ======
 +
 +This howto will show you how to install [[http://www.ztree.com/html/ztreewin.htm|ZTreeWin]] under Linux using [[http://www.winehq.org/|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 <kbd>Shift</kbd>, <kbd>Ctrl</kbd>, and <kbd>Alt</kbd> 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.
 +
 +<code bash>
 +sudo apt-get install wine
 +</code>
 +
 +I suggest you also run the "''winecfg''" command and make sure the <wrap file>H:</wrap> drive is mapped to your home folder under the <wrap nav>Drives</wrap> tab.
 +
 +{{::winecfg.png?300&direct}}
 +
 +===== Run the Installer =====
 +
 +Get the latest ZTreeWin installer from the ZTree web site, then run it inside Wine with this command:
 +
 +<code bash>
 +cd ~/downloads
 +wine ztw???.exe   # Fill in the correct version number in the file name here.
 +</code>
 +
 +Run through the setup wizard as you would on Windows.
 +
 +===== Create a Launch Script =====
 +
 +<code bash>
 +cd "~/.wine/drive_c/Program Files/ZTreeWin"
 +touch start_ztree.sh
 +chmod +x start_ztree.sh
 +nano start_ztree.sh
 +</code>
 +
 +Enter the following code in the nano text editor and hit <kbd>Ctrl-X</kbd> to save and quit:
 +
 +<file bash ~/.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:\\
 +</file>
 +
 +//Subsitute your username where it says ''USERNAME''.//
 +
 +Now edit your <wrap file>ZTWIN.BAT</wrap>:
 +
 +<code bash>
 +wine notepad ZTWIN.BAT   # We're using Notepad because it writes files with DOS-style line endings
 +</code>
 +
 +The batch file should read like this:
 +
 +<file dos ~/.wine/drive_c/Program Files/ZTreeWin/ZTWIN.BAT>
 +@"C:\Program Files\ZTreeWin\ZTW.EXE" %*
 +</file>
 +
 +Fix it if your existing one is using short folder names like <wrap file>PROGRA~1</wrap>. 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 <wrap nav>Save Image</wrap> command.)
 +
 +{{::ztw2.png?nolink|}}
 +
 +Now, edit your applications menu and add ZTreeWin with the following properties:
 +
 +{{::ztreewin-launcher.png?direct&600|}}
 +
 +^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.
 +
 +{{::ztreewin-window-too-big.png?direct&400|}}
 +
 +Well, that didn't work out quite right, did it? I tried changing the window parameters in the ZTreeWin config screen (<kbd>Alt-F10</kbd>) and restarting ZTreeWin and that didn't have any effect. I tried running <wrap file>ZTW.BAT</wrap> from inside a <wrap file>CMD.EXE</wrap> 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 <wrap nav>Deja Vu Sans Mono</wrap>. 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.
 +
 +{{::ztreewin-font.png?nolink|}}
 +
 +Now go to the Configuration tab and make sure <wrap nav>Buffer zone</wrap> and <wrap nav>Window size</wrap> are 80×25.
 +
 +{{::ztreewin-window-config.png?nolink|}}
 +
 +Click <wrap nav>OK</wrap> and make sure you choose to "<wrap nav>Retain these settings for later sessions</wrap>".
 +
 +{{::ztreewin-window-properties-save.png?nolink|}}
 +
 +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 <wrap nav>Configure Window Behavior</wrap>. Go to the <wrap nav>Window-Specific Settings</wrap> page and click <wrap nav>New</wrap>.
 +
 +Enter these values in the <wrap nav>Window</wrap> tab:
 +
 +{{::ztreewin-kde-settings-window.png?direct&400|}}
 +
 +^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 <wrap nav>Geometry</wrap> tab:
 +
 +{{::ztreewin-kde-settings-geometry.png?direct&400|}}
 +
 +^Field name       ^Value      ^
 +|Size             |//checked//|
 +|Size //dropdown//|Force      |
 +|Size //textbox// |728,478    |
 +
 +Click <wrap nav>OK</wrap> to close the top settings window, the <wrap nav>OK</wrap> 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 <wrap nav>Detect</wrap> button on the <wrap nav>Window</wrap> tab of the <wrap nav>Window-Specific Settings</wrap> 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:
 +
 +{{::ztreewin-finished-installing.png?direct&400|}}
 +
 +Now don't forget to setup your ZTreeWin Application window (<kbd>F9</kbd>), your Editors (<kbd>Alt-F10</kbd> → <kbd>a</kbd>, <kbd>B</kbd>), 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:
 +
 +<code bash>
 +"/home/USERNAME/.wine/drive_c/Program Files/ZTreeWin/start_ztree.sh"
 +</code>
 +
 +If WINE isn't reporting any errors, also try running the <wrap file>ZTWIN.BAT</wrap> Windows launcher script from the Windows command prompt:
 +
 +<code bash>
 +wineconsole --backend=user cmd.exe
 +</code>
 +
 +//(window opens)//
 +
 +<code dos>
 +cd /d "C:\Program Files\ZTreeWin"
 +ZTWIN.BAT
 +</code>