1.1: Getting Linux
Chapter 1 video on Youtube
Testing is currently done on Ubuntu 13.10 destribution.
You can download Ubuntu here:
http://www.ubuntu.com/download/desktop
I'm going to assume a basic knowledge of Linux for this guide.
If you're new to all of this I would recommend running Ubuntu in a virtual machine before deploying to an actual machine.
You can download Oracle Virtual Box (free) here:
https://www.virtualbox.org/wiki/Downloads
1.2: Installing and Configuring Wine
Running a Windows program on a Linux machine requires the WINdows Emulator (WINE). Ubuntu has a stable version of WINE in the standard repository, but there's a few nice new features in the current development branch such as improved font smoothing, so we'll make use of the development branch instead.
To install the latest development version we're going to add it from the official WINE PPA (Personal Package Archive). PPA's are a Ubuntu "feature", so those of you who are on another distro may need to find their specific package or build from source.
Run this code, one line at a time and without the dollar ($) sign, in your terminal:
Code: Select all
$ sudo add-apt-repository ppa:ubuntu-wine/ppa
$ sudo apt-get update
$ sudo apt-get install wine1.7
Now we will set the WINE directory that will house our emulated software. By default WINE will select the following path as WINE directory:
Code: Select all
/home/<username>/.wine
Code: Select all
export WINEPREFIX=<set your desired WINE path here>
Remember to add the above line at the end of your .bashrc file to have set over multiple sessions
Code: Select all
$ winecfg
If you like you can select your WINE directory on the fly here by running this command:
$ WINEPREFIX=<path to desired winedirectory> winecfg
Code: Select all
$ winetricks vb6run
Code: Select all
$ wine XYplorer_13.70_Install.exe
2.1: Doing your first test-run!
You may start a Windows executable by navigating to the install folder and running the .exe file with the wine command. Starting XYplorer on my system looks like this:
Code: Select all
$ wine ~/.wine-xy/drive_c/xy/XYplorer.exe
The terminal window will display all WINE and XYplorer activities. While this is particularly useful during debugging it looks unsightful. Instead, we're going to make XYplorer launch from an icon in the Ubuntu sidebar exactly the same way it does under Windows
2.2: Adding XYplorer to the sidebar
Ubuntu deals with "shortcuts" in a similar way as Windows. There's 2 steps involved. First we must make an executable shell script, second we must make the launcher file. I recommend reading this Ubuntu Help article before proceeding:
https://help.ubuntu.com/community/Unity ... sktopFiles
STEP 1: Making the shell script
You need to specify the location of your wine folder (the wineprefix) followed by the wine command to launch XYplorer. Here's what that looks like on my system.
Code: Select all
WINEPREFIX=/home/me/.wine-xy wine /home/me/.wine-xy/drive_c/xy/XYplorer.exe
Code: Select all
$ chmod 700 myfile.sh
Code: Select all
$ ./myfile.sh
STEP 2: Making the launcher file
If you read the Ubuntu Help article above you should understand how launcher .desktop files work. They are pretty self-explanatory, but remember to ensure your launcher file is executable. You make it executable in the same way as the shell script, using chmod 700. Getting the shell script and launcher file correct can be somewhat tricky so please don't hesitate to contact me or post below with any questions. This is what my .desktop file looks like:
Code: Select all
[Desktop Entry]
Version=1.1
Name=XYplorer
Exec=/home/me/bin/XYplorer/start_xy.sh
Icon=/home/me/bin/XYplorer/icon.png
Terminal=false
Type=Application
Categories=Utility;Application;
Chapter 3: Improving the look and feel
Font rendering works differently on Linux compared to Windows. Windows makes use of some particular "cheats" and "tricks" to make TrueType fonts look "good". These are not available or hard to reproduce on Linux. This chapter will deal with how to integrate the way XYplorer looks with the rest of your Linux system.
Obtaining new fonts and a few words on the Infinality patches
As I said earlier my distro of choice is Ubuntu due to it having fairly decent (OSX-styled) font rendering. Other distros may look different. The Infinality patch set aims to improve TrueType rendering by tweaking the font engine. The patch set is beyond the scope of this guide but I highly recommend reading up on them (or even trying it out). You can download the patch sets here. Pre-compiled packages are also available
My font of choice for Wine applications is "Droid Sans". You can download it freely from Google.
https://www.google.com/fonts
Fonts depend on personal taste!
Below are a few examples of what XYplorer will look like on first start. It's hard to post full screen shots, but due to the small size of the fonts used the program looks out of place between other Linux programs.
A couple of small fixes to make Xyplorer fit in
Step 1 is to slightly increase the dpi setting for wine applications. Because each WINEPREFIX folder acts as a wholy-contained Windows emulator you can easily have different dpi settings for different applications.
I have set the dpi from 96 to 100
Code: Select all
$ winecfg
Step 2 is to change the fonts in XYplorer from Tahoma to Droid Sans and also to slightly up the size
The Droid Sans font acts similar to Tahoma and Segoe UI in that it is limited in width more so than Open Sans or Ubuntu. This seems to work better with Windows-style interfaces. Wider fonts often look out of place or text may even fall off the edge of a Label or Button because there is no more space left. Numbers also seem to render much better compared to Tahoma, especially at small sizes (<10)
Chapter 4: Giving XYplorer access to native applications
Because XYplorer runs in a Windows emulator you will run into some not-so-obvious problems when dealing with files on Linux. XYplorer is perfectly capable of browsing and manipulating your file system and acts according to the permissions granted to the user account that launched Wine.
But what happens when you want to play a media file, read a PDF document, or extract an archive? Double-clicking files inside XYplorer on Windows simply starts the program you have designated for that. On Linux, XYplorer can't easily access the native applications on the system. Wine supports linking file extensions to native Linux applications. Unfortunately, the process involves editing entries in the registry.blob of your Wine emulator, which is laborious to say the least.
Introducing: XYassistant(.py)
Once again, XYplorer's rich feature-set comes to the rescue. Custom File Assosciations can be used to launch native Linux applications from inside XYplorer in exactly the same way things work on Windows. To help XYplorer deal with the complexities of launching a native application I have developed a helper script in python. Python comes bundles with any Linux distribution and so it will work out of the box.
You define Custom File Assosciations the same way you do on Windows.
extension;extension;extension > python-location xyassistant-location native-application.
For example:
Code: Select all
jpg;JPG;png>/usr/bin/python /home/me/xyassist.py eog
mp3;mp4;flv>/usr/bin/python /home/me/xyassist.py vlc
html;chm;txt>/usr/bin/python /home/me/xyassist.py sublime_text
Code: Select all
''' Simply save this script and name it xyassistant.py
Open your Custom File assosciations and define a rule according to the example below:
avi;mp3;mp4>/usr/bin/python /home/<your user name>/xyassistant.py vlc
You must specify the location of the python interpreter on your system followed by the location of
xyassistant followed by the executable application of your choice. If you save xyassistant.py outside of your home folder you need to ensure XYplorer has rights to access that location as well.
'''
#/usr/bin/python
import os
import re
import subprocess
import sys
class Assistant(object):
def __init__(self, executable, windows_path):
self.executable = executable
self.windows_path = windows_path
def translate(self):
# extract the file name from full windows path
filename = re.search('(?<=\\\\)[^\\\\]+$', self.windows_path).group(0)
# join filename to working directory path to create full path
linux_path = '/'.join([os.getcwd(), filename])
self.linux_path = linux_path
def start(self):
# print([self.executable, self.linux_path])
subprocess.call([self.executable, self.linux_path])
if __name__ == '__main__':
# ignore first argument as it is path to this script
assistant = Assistant(sys.argv[1], sys.argv[2])
assistant.translate()
assistant.start()
Annex A: Bugtracker
Fixable or workaround exists
Code: Select all
>>> Error 445 for proc IB@160
Appears after starting XYplorer.exe and can be clicked away. Has no known further consequences
>>> Error 13 for pList@21
Has to do with how file sizes are displayed. Often appears when switching file size columns away from default kB. Can be fixed by resetting the column back to kB. May cause WINE crash if allowed to recur multiple times by switching to different folders
>>> Attempting to "search" /root or /proc
May cause prolonged lock-ups. XYplorer should return eventually but may take several minutes
>>> Custom File Assosciations
Domewhat broken. They work by themselves and Xy is able to launch native UNIX applications from their full path (e.g. /usr/bin/vlc) but the file path that is fed to the executable is corrupt (it contains the Windows drive letter which is not accepted in UNIX). In theory, you could write a shell script that regexes out the drive letter to make the path legal. I'm going to explore that more later because it means XYplorer could be used to navigate to a file and then it hands over the file handling (pdf, video, audio, etc...) to the UNIX native program. Native file handling can be done by editing the wine registry but obviously that's a chore compared to our file assosciations
>>> Xycopy.exe dialogues
Actual I/O copy operation works almost up to native speed, Dialogue progress bar sometimes not updated.
Code: Select all
>>> Unix environment symbolic links are not displayed
>>> From version 13.70.0100 and later changing the column for file size to any other value than KB(rounded) will cause runtime error 97 to occur. This will crash xyplorer beyond recovery