#283 one window/one instance

1.3
closed-fixed
Uncertain (2)
5
2013-12-28
2012-12-19
pacman401
No

could You add option like 'one window' or 'one instance' , so any other program trying to use pcmanfm launch/work in new tab , and manual creating of new windows or moving tabs from one widow to enother will still be avalible

btw why pcmanfm -d don't provide one instance ?

Discussion

  • eltomito
    eltomito
    2013-02-01

    If I find a way to attach a patch to this comment, I'll send a modification that allows what you are requesting.

    The patch adds a preference to pcmanfm called "Open desktop folders in new windows" which is meant to be a user-friendly way of saying "new instances open new windows".

     
  • eltomito
    eltomito
    2013-02-01

    Okay, no idea how to attach files here, co here comes the patch in all its glory:

    --------------------------------------------------------------------------------------------------------------------------

    --- pcmanfm/src/pcmanfm.c 2013-02-01 13:49:06.255710111 +0100
    +++ pcmanfm-new_window/src/pcmanfm.c 2013-02-01 13:52:05.879713021 +0100
    @@ -490,7 +490,11 @@
    for(; l; l=l->next)
    {
    FmFileInfo* fi = (FmFileInfo*)l->data;
    - fm_main_win_open_in_last_active(fm_file_info_get_path(fi));
    +
    + if( !app_config->desktop_open_in_new_window )
    + fm_main_win_open_in_last_active(fm_file_info_get_path(fi));
    + else
    + fm_main_win_add_win( fm_main_win_get_last_active(), fm_file_info_get_path(fi) );
    }
    if(user_data && FM_IS_DESKTOP(user_data))
    move_window_to_desktop(fm_main_win_get_last_active(), user_data);
    --- pcmanfm/src/pref.c 2013-02-01 13:49:06.255710111 +0100
    +++ pcmanfm-new_window/src/pref.c 2013-02-01 13:52:18.399713225 +0100
    @@ -322,6 +322,7 @@
    INIT_BOOL(builder, FmConfig, si_unit, NULL);
    INIT_BOOL(builder, FmConfig, backup_as_hidden, NULL);

    + INIT_BOOL(builder, FmAppConfig, desktop_open_in_new_window, NULL);
    INIT_COMBO(builder, FmAppConfig, bm_open_method, NULL);
    INIT_COMBO(builder, FmAppConfig, view_mode, NULL);

    --- pcmanfm/src/app-config.c 2013-02-01 13:49:06.251710109 +0100
    +++ pcmanfm-new_window/src/app-config.c 2013-02-01 13:52:58.503713876 +0100
    @@ -93,6 +93,7 @@
    cfg->desktop_sort_by = COL_FILE_MTIME;

    cfg->wallpaper_common = TRUE;
    + cfg->desktop_open_in_new_window = FALSE;
    }

    @@ -184,6 +185,8 @@
    FM_FOLDER_MODEL_COL_IS_VALID((guint)tmp_int))
    cfg->desktop_sort_by = tmp_int;

    + fm_key_file_get_bool(kf, "desktop", "open_in_new_window", &cfg->desktop_open_in_new_window);
    +
    /* ui */
    fm_key_file_get_int(kf, "ui", "always_show_tabs", &cfg->always_show_tabs);
    fm_key_file_get_int(kf, "ui", "hide_close_btn", &cfg->hide_close_btn);
    @@ -321,6 +324,7 @@
    g_string_append_printf(buf, "show_wm_menu=%d\n", cfg->show_wm_menu);
    g_string_append_printf(buf, "sort_type=%d\n", cfg->desktop_sort_type);
    g_string_append_printf(buf, "sort_by=%d\n", cfg->desktop_sort_by);
    + g_string_append_printf(buf, "open_in_new_window=%d\n", cfg->desktop_open_in_new_window);

    g_string_append(buf, "\n[ui]\n");
    g_string_append_printf(buf, "always_show_tabs=%d\n", cfg->always_show_tabs);
    --- pcmanfm/src/app-config.h 2013-02-01 13:49:06.251710109 +0100
    +++ pcmanfm-new_window/src/app-config.h 2013-02-01 13:53:12.807714110 +0100
    @@ -108,6 +108,9 @@
    gboolean show_wm_menu;
    GtkSortType desktop_sort_type;
    int desktop_sort_by;
    +
    + /* should desktop folders be opened in new windows or new tabs? */
    + gboolean desktop_open_in_new_window;
    };

    struct _FmAppConfigClass
    --- pcmanfm/data/ui/pref.glade 2013-02-01 13:49:06.235710111 +0100
    +++ pcmanfm-new_window/data/ui/pref.glade 2013-02-01 14:08:13.947728716 +0100
    @@ -383,6 +383,22 @@
    <property name="position">6</property>
    </packing>
    </child>
    + <child>
    + <object class="GtkCheckButton" id="desktop_open_in_new_window">
    + <property name="label" translatable="yes">Open desktop folders in new windows (not just new tabs)</property>
    + <property name="visible">True</property>
    + <property name="can_focus">True</property>
    + <property name="receives_default">False</property>
    + <property name="use_action_appearance">False</property>
    + <property name="yalign">0.57999998331069946</property>
    + <property name="draw_indicator">True</property>
    + </object>
    + <packing>
    + <property name="expand">True</property>
    + <property name="fill">True</property>
    + <property name="position">7</property>
    + </packing>
    + </child>
    </object>
    </child>
    </object>

     
  • pacman401
    pacman401
    2013-02-24

    send it by e-mail pacman401@gmail.com

     
  • pacman401
    pacman401
    2013-02-24

    plz instructions how to
    convert your comment as patch file
    add patch to source and correctly compile

     
  • eltomito
    eltomito
    2013-02-26

    I see the problem is that the patch is displayed here with leading spaces removed, so when you copy it from sourceforge,
    the patch program says it's malformed, because the spaces are missing and then they don't match the original files.

    However, if you get e-mail notification about traffict in this thread, you can copy the patch file from the e-mail
    and it's correct.

    Does that answer your question?

    If you need more detailed information on how to download, patch and compile the code,
    feel free to ask. I'll respond faster this time - the last message ended up in the spam can.

     
  • The option to open desktop folders in new window instead of new tab is added in current PCManFM sources in GIT.
    Also there is a command line option to open folder in new window.
    I hope it will satisfy your needs.
    Thank you very much.

     
    • assigned_to: nobody --> lstranger
    • status: open --> closed-fixed