Unintentionally closing window when closing tabs
Submitted by can..@..le.org
Assigned to Xfce Bug Triage
Created attachment 6269 Patch to add 'Preserve Final Tab' option/behaviour
This is a very minor thing but this catches me out a lot when using Thunar, even though I know the behaviour (it also catches me out when using the Leo editor), and I end up closing the Thunar window unintentionally quite often.
Current behaviour is that Thunar will close the window upon closing the last tab, which is the same behaviour as a lot of other file managers (apparently. I only use Thunar, so I don't know personally).
In my opinion, "Close Tab" (Ctrl-W) should only close the tab if there is a tab to be closed (i.e. the tab bar is visible). Otherwise, closing the window is not what the user requested.
However, this would be a significant change in behaviour and would require those that wanted to keep the current behaviour to enable the "Always Show Tabs" (hidden?) option. This would be pretty unreasonable (along with the additional bug reports that Ctrl-W had suddenly "stopped working").
I've attached a proof-of-concept patch which adds a "Preserve Final Tab" preference (in "Behaviour"), which prevents Thunar from closing the last tab. It isn't ideal ("Tabs" frame is actually packed inside the "Middle Click" frame because vbox gets redefined by the "Middle Click" section..) but demonstrates the behaviour I want adding and shows I am willing to/can provide a patch to do so, if it would be acceptable for inclusion.
It may be better to just prompt the user ("Close window? Y/N") if an attempt to close the last tab is made. I'm okay with coding any solution that would be acceptable!
Please note that I don't code in C, nor have I ever used GTK, so the code may be rough and need cleaning up.
Attachment 6269, "Patch to add 'Preserve Final Tab' option/behaviour":