In this post I will explain how to create a startup launcher that can be used from command line or from a filemanager. I'm really exited that I got this working and it is very useful, at least to my working style.
First I create a file called /usr/local/bin/pw with this content. If you are unsure how to do this try this:
Code: Select all
#!/bin/bash
#
#Edit the below line
WINEPREFIX=$(echo /home/`whoami`/.wine)
#WINEPREFIX=$(echo /home/`whoami`/.wine-pw5)
export WINEPREFIX=$WINEPREFIX
#Trying to find out the local name of the Program Files folder
#like C:\Programfiler
PROGRAMFILES=$(wine cmd /c echo "%ProgramFiles%")
#create the filepath, takes multiple files
file=$(winepath "$@" |awk '{ print "\""$0"\"" }'| tr -s \\n " ")
#The below gives more windows style filepath, but it fails loading ./img.jpg
#file=$(winepath --windows "$@"|awk '{ print "\""$0"\"" }'| tr -s \\n " ")
echo "env WINEPREFIX=$WINEPREFIX wine start \"$PROGRAMFILES\Digital Light & Color\Picture Window Pro 5.0\pw50.exe\" $file"
wine start "$PROGRAMFILES\Digital Light & Color\Picture Window Pro 5.0\pw50.exe" $file
This file need execute permission.
It should no be possible to launch picture window in many way from the command line:
pw image1.jpg #open pw and image1.jpg
pw files/image1*.tif #open pw and multiple files
locate calender-2008|grep jpg$| perl -pe's/ /\\ /g' |xargs pw # open pw and all files that end with jpg and contain calender-2008. space allowed in filename
Integrating with nautilus filemanager
The goal here is to be able to use the "right click" open with function. To do this with some eye candy we need a file in ~/.local/share/applications called picturewindow.desktop. I have this content, but I think there is room for improvements here.
Code: Select all
[Desktop Entry]
Encoding=UTF-8
Name=Picture Window Pro
Comment=Edit images
Exec=pw %F
Terminal=false
Type=Application
Icon=/home/ltg/.local/share/icons/a7d2_pw50.0.xpm
The icon may have a different name on your system. To find it try the command "
locate pw50.0.xpm". To send a file to picture window from nautilus just right click and select "open with". First time for each file type (jpg,tif,png) you may have to choose the "other application" entry and find Picture Window there. If everything works it will be described as "Picture Window Pro" (the name entry from above) with the picture window icon.
It is also possible to drag-and-drop images from file manager to picture window.
Firefox to picture window
It is also possible to send images from firefox to picture window. I use an extension called viewsourcewith
http://dafizilla.sourceforge.net/viewso ... /index.php With this installed you have to create a new application within the plugin. Use /usr/local/bin/pw as the path to the application. You should now be able to right click on a image in firefox select "source-with" and select "picture window". Great.
There is a small bug or feature that picture window open up in the background and not get focus. Anyone have a solution to this?
This is tested on ubuntu 9.10 and partly on xubuntu 9.10