Wishlist - feature request, Double click tab to close

Discussion related to "Everything" 1.5 Alpha.
Post Reply
Xavierarmand
Posts: 14
Joined: Fri Nov 24, 2023 12:19 am

Wishlist - feature request, Double click tab to close

Post by Xavierarmand »

I would love to see a double click anywhere on a tab to close it in everything.

I've this implemented in my web browsers and file manager, directory opus.

I have tried to use autohotkey to automate this myself using #ifmouseover, double click sends Ctrl+w. ... It almost works. The hot is being sent but I'm getting a windows error chime as another element of the gui is receiving the key input so the tab remains open.

Thanks
Xavier
void
Developer
Posts: 17152
Joined: Fri Oct 16, 2009 11:31 pm

Re: Wishlist - feature request, Double click tab to close

Post by void »

I have put on my TODO list to add a customizable tabs_double_click_action advanced setting.

Thank you for the suggestion.
NotNull
Posts: 5517
Joined: Wed May 24, 2017 9:22 pm

Re: Wishlist - feature request, Double click tab to close

Post by NotNull »

Quick tip:

Clicking the scrollwheel will also close tabs. Works in Directory Opus and webbrowsers too.
Even in Explorer .. (where double-clicking doesn't)
Xavierarmand
Posts: 14
Joined: Fri Nov 24, 2023 12:19 am

Re: Wishlist - feature request, Double click tab to close

Post by Xavierarmand »

Awesome. Thank you. And will check out the middle click as well. Didn't think of that for some reason
Xavierarmand
Posts: 14
Joined: Fri Nov 24, 2023 12:19 am

Re: Wishlist - feature request, Double click tab to close

Post by Xavierarmand »

okay after tinkering a few mins I got this ahk code to work using the middle mouse button...

Code: Select all


#IfWinActive ahk_exe Everything64.exe
~Lbutton:: ;; ev, double click on tab to close it
global control
ControlGetFocus, Control, ahk_exe Everything64.exe
if (A_PriorHotkey != "~Lbutton" or A_TimeSincePriorHotkey > 300)
	{
		KeyWait, Lbutton, u ; Too much time between presses, so this isn't a double-press.
		return
	}
else
	{
		If MouseIsOver(Control = "SysTabControl321")
			{
				sleep 90 
				send, {Mbutton}
			}
		#if
	}
return
#IfWinActive

MouseIsOver(WinTitle) ;; MouseIsOver() ;; Function // SHARED
	{  
	global control
		MouseGetPos,,, Win,Control
		return WinExist(WinTitle . " ahk_id " . Win . Control)
	}

; might only need one of theses...
IsDoubleClick(MSec = 300) {
    Return (A_ThisHotKey = A_PriorHotKey) && (A_TimeSincePriorHotkey < MSec)
}
IsDoubleClickEx(MSec = 300) {
    preHotkey := RegExReplace(A_PriorHotkey, "i) Up$")
    Return (A_ThisHotKey = preHotkey) && (A_TimeSincePriorHotkey < MSec)
}
NotNull
Posts: 5517
Joined: Wed May 24, 2017 9:22 pm

Re: Wishlist - feature request, Double click tab to close

Post by NotNull »

Thank you for sharing @Xavierarmand !

Quick tip: double-click speed is configurable in Windows (mouse settings). Some people might have a slow double-click speed (old / muscle troubles/..) or a fast one (pro-gamers/..).
You can read the Windows double-click speed in AHK using:

Code: Select all

	$DoubleClickTime := DllCall("GetDoubleClickTime")
%$DoubleClickTime% contains the max number of milliseconds between clicks (here:500; I guess that is the default).


I tried to shorten your script a bit. Briefly tested, but seems to work.
If not, maybe it can give some inspiration :D

Code: Select all

;	Read Doubleclick speed (system setting)
	$DoubleClickTime := DllCall("GetDoubleClickTime")

#IfWinActive ahk_exe Everything64.exe
Lbutton::
{
	MouseGetPos,,,, CurrentControl
	if (A_PriorHotkey = A_ThisHotkey and A_TimeSincePriorHotkey < $DoubleClickTime and CurrentControl = "SysTabControl321")	{
		Sleep 90 
		Send, {Mbutton}
	}
	else {
		Send {%A_ThisHotkey%}
	}
}
return
#IfWinActive

Xavierarmand
Posts: 14
Joined: Fri Nov 24, 2023 12:19 am

Re: Wishlist - feature request, Double click tab to close

Post by Xavierarmand »

very nice. I'm new to ahk. haven't played with dll calls much yet least it be copy and paste. I'll try this out too.
NotNull
Posts: 5517
Joined: Wed May 24, 2017 9:22 pm

Re: Wishlist - feature request, Double click tab to close

Post by NotNull »

Xavierarmand wrote: Wed Dec 18, 2024 1:33 am I'm new to ahk.
Right .. I assumed you were way more experiencd than I am, because I remembered you wrote this. That's 5000+ lines of code!
Xavierarmand
Posts: 14
Joined: Fri Nov 24, 2023 12:19 am

Re: Wishlist - feature request, Double click tab to close

Post by Xavierarmand »

NotNull wrote: Wed Dec 18, 2024 8:05 pm
Xavierarmand wrote: Wed Dec 18, 2024 1:33 am I'm new to ahk.
Right .. I assumed you were way more experiencd than I am, because I remembered you wrote this. That's 5000+ lines of code!
That reminds me I need to upload an update that fixes a Ctrl + space hotkey which EV implanted a in a recent update.

:lol:

But still over on the reddit they were fast to say my code was messy and that I aught to double the code by rewriting in v2. Which isn't necessary for work with simple text....


Furthermore check out this dedcaited EV menu I posted last night. Pulled this out of my main script. ...

viewtopic.php?t=15972

I figured out how to copy details of the selected items from an everything window that in the background without bringing it to the front\top.
void
Developer
Posts: 17152
Joined: Fri Oct 16, 2009 11:31 pm

Re: Wishlist - feature request, Double click tab to close

Post by void »

Everything 1.5.0.1390a adds a tabs_double_click_action advanced setting.

To close tabs on double click:
  • In Everything 1.5, from the Tools menu, click Options.
  • Click the Advanced tab on the left.
  • To the right of Show settings containing, search for:
    tabs
  • Select: tabs_double_click_action
  • Set the value to: Close
  • Click OK.


Everything 1.5.0.1390a also improves middle button handling.
Xavierarmand
Posts: 14
Joined: Fri Nov 24, 2023 12:19 am

Re: Wishlist - feature request, Double click tab to close

Post by Xavierarmand »

very nice!

this is more responsive than my ahk script.

Thank you!
Post Reply