Quantcast
Channel: Hacker News 50
Viewing all articles
Browse latest Browse all 9433

prtfl.io

$
0
0

Comments:"prtfl.io"

URL:http://www.prtfl.io/muellerwolfram/blog/2013/1/23/how-to-use-photoshop-in-ubuntu


For quite some time Photoshop used to be the one app that kept me from completely switching away from Windows. For everything else, Ubuntu is the OS of my choice. But dual boot sucks, and I don't want to switch OSes every time I need to use Photoshop. I want to use Photoshop in Ubuntu. It is certainly possible to do so, but i have a few requirements:

I need Photoshop to

  • be 100% stable - it shall never crash. Even 99% stable is not tolerable
  • have acceptable performance  - occasional freezes or (extremely) long rendering times are not acceptable
  • fully integrate into Ubuntu - should behave like a native Ubuntu app: e.g. shows the appropriate icon on [alt]+[tab] command. should be searchable and launchable from Ubuntu dash.

So to summarize what i want in one sentence: Photoshop should behave and feel (almost) the same way as it does for Windows users.

 

High Level summary of what we need to do:

We are going to use VirtualBox, and install Windows and Photoshop on it. We are then going to configure it in a way that Photoshop fully integrates into the OS, behaves and feels like a native Ubuntu app. When we are done with it we won't even notice that it runs in a VirtualBox.

Foreword:

Peeking ahead at the long list of steps you have to do to set up Photoshop, you probably ask yourself two questions: "Why not just use wine instead?" or even "Why not just use gimp instead?"

Regarding Gimp: Let's not go there. This post shall not be about gimp vs. Photoshop. Gimp is a fine piece of software, but growing up with Photoshop and knowing it inside out, I am just too lazy to spend the amount of time necessary to adjust to the a new interface, and (re)learn how to use the tools. If you are a happy Gimp user you can stop reading here, but to go on with this post let’s just assume we want to use Photoshop in Ubuntu.

Regarding Wine: With Wine it requires fewer steps to set up Photoshop, and it (apparently) works with every version, including CS6. But the thing is, at least for me, it is not 100% stable. It might be 99%, but that last 1% could potentially mean that you lose unsaved work. Which is one of the most frustrating things ever, and not tolerable.

 

Agenda

  • Installing VirtualBox
  • Installing Windows
  • Installing Photoshop
  • Configuring VirtualBox to better integrate into Ubuntu

 

Installing VirtualBox

Note: I’m going to keep the first couple of steps of the how-to relatively compact. There are plenty of guides on how to install VirtualBox, set up a new VM and install Windows on it, on the internet, and if you get stuck at one point, google is your friend. Instead of rewriting stuff that has been said before, I'm going to point you to great tutorials published elsewhere.

There are two versions of VirtualBox available for Ubuntu. One packaged by Ubuntu themselves, one by VirtualBox. Due to licensing (i guess), the Ubuntu Package doesn’t include all features (e.g USB support), so I recommend that you just go ahead to VirtualBox’s download page and download the right package for your system from there.

 

Install Windows

There is a very good article on how to install Windows XP on linuxjournal.com so I’m just going to refer you to that. It’s relatively straight forward, and you shouldn’t run into any problems. Just two notes: First, give the VM as much RAM as you can spare, preferably 4GB (if you have 8 in total). Second, remember to install the Guest Additions as described at the end of the article.

Installing Windows 7 requires basically the same steps. Here is a guide on how to do that. 

Performance wise, at least on my machine, Windows XP does actually perform better. Startup time for my XP VM is about 14 seconds until Photoshop is ready to use. With my Windows 7 VM it takes about 18 seconds. Not a huge difference, so just use whatever Windows version you have at hand.

 

Install Photoshop

Now boot up your new Windows VM, grab yourself the latest demo of Photoshop from adobe (or use the full version if you own one) and install it. If you don’t need the latest and greatest, you can download a full version of Photoshop CS2 for free here.

 

Configuring VirtualBox to better integrate into Ubuntu

Ok, now its getting interesting. But first let’s recap what we’ve done so far: We installed VirtualBox on Ubuntu, we set up a new virtual machine, we installed first Windows on that virtual machine, and then Photoshop. If you stop here, you will be able to manually start the VM, open Photoshop, and enjoy using it on Ubuntu. But we can do better. There are a couple of neat tricks to make applications running inside a VM more integrated into Ubuntu:

Shared folders

In order to be able to open files from your Ubuntu (or other Linux host system) you have to add a folder (probably your /home dir) as a shared folder to VirtualBox. This answer  on askubuntu.com describes pretty clear how to accomplish that. It’s pretty straight forward: Open VirtualBox, select your VM, click Settings -> shared Folders, and add your desired folder.

Make sure you check auto-mount, so you don’t have to set it up everytime you restart your VM. In your VM, if your folders don’t automatically show up in your explorer, you need to manually create a new network place. Here is a guide on how to do that in Windows 7. When your are at step 7 of that guide, if you click browse, your shared folders, that you set up in the VirtualBox settings, should show up.

Seamless Mode

Seamless Mode disables the desktop of your VM. It doesnt run the application within a windows desktop, instead it shows the running (windows) applications right next to running applications in Ubuntu. Switching between native apps and vm apps with [alt]+[tab] should be way smoother now. If you can’t image what this looks like, check out this screenshot from techrepublic.com  To get this working yourself, start the VM and open up Photoshop. In the Ubuntu menubar of your VM window select View -> Switch to seamless mode. I recommend auto-hiding the windows taskbar, and showing VirtualBox’s Mini Toolbar. Go to Machine -> Settings -> General -> Advanced and check Show Mini Toolbar in Seamless Mode.

Saving the State of a VM

If you close the VM, by clicking the X in the mini toolbar (see picture) or hitting [hostkey]+[q], you will be asked if you want to shutdown, power off or save the machine’s state.

Saving the machine’s state is what we want. It is like going in suspend mode in Ubuntu. If you have Photoshop running in Seamless Mode and you save the state of the machine, the next time you open up the VM it will open up Photoshop in Seamless Mode right where you left it. Thats handy for two reasons: First, you don’t need to manually open Photoshop and switch to Seamless Mode every single time. You just open the VM, one click, and you are good to go. Second, when you wake up the VM you don’t need to wait until Photoshop launches, since it is already running.

Utilising VirtualBox’s command-line tools

So now we have a Virtual Machine set up with Photoshop, and every time we launch it Photoshop is already running, every time we close it, we save the state of the machine. That’s already a pretty decent setup, but in order to launch Photoshop you still need to open up VirtualBox GUI first, select your VM and start it. Fortunately, VirtualBox can be completely controlled by command line commands. To try it out, run the command

VBoxManage startvm name-of-your-vm

or

VBoxManage startvm /home/user/path/to/your/vm.vbox

You can find the location of your VM Image in Settings -> Storage (see picture)

Bash alias

To make our lives easier, we can set up a bash alias for that command, like so:

Open up your bashrc file (or whatever config file for the shell you are using)

vim /home/$USER/.bashrc

and add the line

alias photoshop="VBoxManage startvm name-of-your-vm"

close and reopen your terminal. Now you can just type

photoshop

Setting up an Ubuntu Desktop Entry

Opening Photoshop is a now a simple cli command away. But we can do even better. We can set up an Ubuntu desktop entry which will make Photoshop accessible from Unity Launcher and Unity Dash. It will also let us choose an icon that it will show when we switch apps with [alt]+[tab]. Let's go ahead an create a desktop with your favorite text editor:

vim /home/$USER/.local/share/applications/photoshop.desktop

Copy this code into it:

#!/usr/bin/env xdg-open
# Change your username in line 7 + 8
[Desktop Entry]
Version=1.0
Name=Photoshop
Exec=/home/username/bin/photoshop.sh
Icon=/home/username/.local/share/icons/hicolor/128x128/apps/photoshop.png
Type=Application
StartupWMClass=VirtualBox
Categories=Development;Office;

We need to create two missing files though. See line 7 in your desktop entry file: the exec command runs a simple bash script that we will create in a short moment. Line 8 points to an icon that we will download and save in that location.

The bash script

open vim or any other text editor

vim /home/$USER/bin/photoshop.sh 

copy this code:

#!/bin/bash
VBoxManage startvm /home/username/path/to/your/vm.vbox

paste it, save it and make the file executable:

chmod +x /home/$USER/bin/photoshop.sh 

The bin folder in my home directory is where I place my custom bash scripts. You can change that location if you want, just remember to point to the right place in your desktop entry.

The icon

I got mine from here. There are other create icons on that site, just pick one and save it in /home/username/.local/share/icons/hicolor/128x128/apps/photoshop.png

 

Conclusion

That's it. We are done.

What we have now is a stable version of Photoshop fully integrated into Ubuntu. I've been using this set up for a couple of days now, and I'm pretty happy with it. The performance of Photoshop is good, not noticebaly worse than on windows. Starting and closing Photoshop happens in a decent amount of time; 14 seconds and 7 seconds respectively. I love how it integrates with my other apps. When I switch between native apps and Photoshop, I don't even notice that it runs in a VM. Because I'm opening everything through the Dash, making it possible to launch Photoshop that way was quite important to me.

Lauching Photoshop through Dash looks like this:

Switching with [alt]+[tab] shows the right icon:

The only thing that's annyoing though: In order to show you the right icon when you [alt]+[tab] through applications, Ubuntu is matching the WM_CLASS of the current window with the StartupWMClass that we declared in our desktop entry. Unfortunately VirtualBox gives every VM the same WM_CLASS. What that means is, every instance of VirtualBox shows the Photoshop icon. If you only use VirtualBox for Photoshop, than that's fine. But if you, like me, use it to run MacOS (for xcode), be aware that your MacOS VM is showing the Photoshop icon now as well. I haven't found a work around for that, comments are welcomed.


Viewing all articles
Browse latest Browse all 9433

Trending Articles