Is it possible to set the default behaviour of double clicking a folder to be "Open in New Window" with PCManFM?

Solution 1:

You can try to recompile PCManFM , I am running Lubuntu 12.04 with PCManFM 0.9.10 and these steps worked for me.

Follow these steps:

  1. Open a Terminal and install the necessary packages:

    sudo apt-get install apt-src build-essential
    
  2. Install the build dependencies:

    sudo apt-get build-dep pcmanfm
    
  3. Create a folder to download the source code:

    mkdir ~/Downloads/src
    cd ~/Downloads/src
    
  4. Download the source:

    apt-src install -b pcmanfm
    
  5. Edit the pcmanfm-0.9.10/src/pcmanfm.c file.

    leafpad pcmanfm-0.9.10/src/pcmanfm.c
    
  6. In Leafpad, search for the line fm_main_win_open_in_last_active(fi->path); (should be somewhere around line 420 and change it to fm_main_win_add_win(NULL, fi->path);. Save the changes and close the file. See the screenshots if it isn't clear:

    Before:

    code earlier

    After:

    code after editing

  7. Go to the pcmanfm-0.9.10/ folder to build the deb packages:

    cd pcmanfm-0.9.10/
    dpkg-buildpackage -rfakeroot -uc -b
    
  8. Now you can install the deb packages:

    cd ..
    sudo dpkg -i pcmanfm*deb
    
  9. Finally you can logout and Login to see the changes.


Reference: This post by ogilvierothchild in ubuntu forums.

Solution 2:

Edit this file (as root):

/usr/share/applications/pcmanfm.desktop

Look near the end of it for a line that says:

Exec=pcmanfm %U

Add the -n option to the command like this:

Exec=pcmanfm -n %U

Save the edited file, and thereafter, pcmanfm will always open in a new window unless you specifically tell it to open something in a new tab.

The feature to default to opening in a tab rather than a new window would be fine if it were workspace-aware. The difficulty that arises is that you may have pcmanfm open on some other desktop and you try to open a file and nothing (apparently) happens. If you hunt around on your other desktops, you'll find it, but it should default to opening in a new window if there is no open pcmanfm on the current desktop.