Closing the last tab to close the window

Features wanted...
Post Reply
River
Posts: 2
Joined: 12 Dec 2019 11:06

Closing the last tab to close the window

Post by River »

This is an option in every internet browser & file manager I've used (Dolphin, Directory Opus, Windows explorer with QTTabBar etc.). I'd love if XYplorer offered this option at some point.

I appreciate you guys & the work you put in. Thanks.

rpnfan
Posts: 60
Joined: 07 Jan 2016 21:42

Re: Closing the last tab to close the window

Post by rpnfan »

I understand that you might like this option in a browser (although I personally don't like /use it), but wonder why in a file manager? This is not a "tab-based" program per se IMO. I thought "everybody" -- at least XY users -- will have the file manager active most of the time. :-D

River
Posts: 2
Joined: 12 Dec 2019 11:06

Re: Closing the last tab to close the window

Post by River »

My file manager usage is very similar to my internet browser usage, often they're both used at the same time in the same workflow.

I have lots of little projects I work on simultaneously so I'm constantly opening and closing windows/tabs to keep things simple. I'm one of those people with a hotkey for everything, closing XYplorer is basically the only thing in my workflow I haven't been able to shortcut. It sounds trivial, and I guess it is, but sometimes I'm opening and closing a 5+ times an hour, so it would be a very nice option to have.

I'm not alone in appreciating the feature. I noticed many others when Dolphin (KDE/Linux) added it last year.

robertoleonardo
Posts: 15
Joined: 17 Jun 2021 19:56

Re: Closing the last tab to close the window

Post by robertoleonardo »

River - i am with you. i tweaked a similar script to achieve the desired feature. i have it set as a user defined command (User --> Manage Commands), and then just set my typical "close tab" keyboard shortcut (ctrl w) to that. the script below will also reset to your default startup path before closing the window/last tab - that part may or may not be necessary/desired depending on your settings/goals.

the below also minimizes to tray on the last tab rather than exit. if you want it to fully exit - just change the two instances of "# 1027" to "exit;"

Code: Select all

    if (gettoken(get("tabs"), "count", "|") == 1) {
        $ini  = "%TEMP%\~XY.ini"; savesettings 1, $ini;
        $path = getkey("StartPathNewTab", "Settings", $ini);
        if ($path) {
        goto $path;
        #1027;
            } else {
            #1027; }
        }
    } else { tab("close"); }

admin
Site Admin
Posts: 60357
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Closing the last tab to close the window

Post by admin »

Never liked this feature.

user012912
Posts: 1
Joined: 15 Feb 2023 12:44

Re: Closing the last tab to close the window

Post by user012912 »

The above script does not do the expected behavior, because it closes when there is one tab LEFT instead of when you close the last tab (which isn't possible).

Instead, what I did is define a hotkey of CTRL+W for "Exit" under "File".

Get to the hotkeys by opening any XYplorer window and press CTRL+F9. It will open the window.

CTRL+W is currently defined to close the current tab, but I have it set to max tabs 1 to disable the tabs and then I hid the tab bar. What I wanted was for the window itself to close when I pressed CTRL+W. So I assigned "Exit" to "CTRL+W", and it now performs the expected behavior just like Windows Explorer.

If you want to also have tabs and close the window when you have 1 tab left and press CTRL+W, thenneither my solution nor the above script will work, so you will have to modify the above script so that it:

* Checks if tabs = 1 (that's in the script)
* And then only when you press CTRL+W will it close the window (the script above instead closes the window when there is one tab left instead of when you press CTRL+W on the last tab).

So if you want to have tabs, modify the above script to do this behavior.

Post Reply