iswitchw mod - Fast window and browser tab switching - Updated Oct 1st, 2023!

Post your working scripts, libraries and tools for AHK v1.1 and older
evilmanimani
Posts: 29
Joined: 24 Jun 2020, 16:42

iswitchw mod - Fast window and browser tab switching - Updated Oct 1st, 2023!

Post by evilmanimani » 27 Apr 2021, 00:12

iswitchw
screenshot.png
screenshot.png (144.87 KiB) Viewed 4351 times
Quick fuzzy find-as-you-type searching and selection of open windows (and Chrome & Firefox tabs!).

The text will turn green if there's only there's only one result, or red if there's no matches, though the last valid matches will remain in the list. Hitting delete, Ctrl+Backspace, or Ctrl+W will clear the input in either case.

Multiple extra shortcuts are available, you can navigate with Tab/Shift+Tab, Arrows, Home/End, or PgUp/Dn. You can also focus a specific tab with Win+0-9 for the first 10 tabs, or with a numerical hotstring, by typing the row number then ending with a space (up to 99).

Active Chrome and Firefox tabs are listed, and selecting the row will activate the window and select the applicable tab.

This is a fork of an older version that hasn't been updated in the better part of a decade, but I was still using it and figured I'd try my hand at making a few improvements. There's lots of shortcuts, and the window can be moved and resized, with the position saved between sessions. Listing and selection of Chrome & Firefox tabs is possible via Chrome remote debugging protocol and the Acc.ahk library (with jeeswg's related functions) respectively, which is included. See the readme for full details of course.

https://github.com/evilmanimani/iswitchw/

Credits to tvjg, who's script I modified, and to the others that came before. Looks like this program has been shambling along for quite a few years now in multiple iterations :D
https://github.com/tvjg/iswitchw
Attachments
iswitchw-master.zip
(647.67 KiB) Downloaded 48 times
Last edited by evilmanimani on 01 Oct 2023, 22:05, edited 9 times in total.

User avatar
rommmcek
Posts: 1475
Joined: 15 Aug 2014, 15:18

Re: iswitchw - Back from the dead. Now with Chrome tabs!

Post by rommmcek » 27 Apr 2021, 19:37

Here is contemporary GetAltTabWindows by teadrinker if you're interested.

evilmanimani
Posts: 29
Joined: 24 Jun 2020, 16:42

Re: iswitchw - Back from the dead. Now with Chrome tabs!

Post by evilmanimani » 28 Apr 2021, 00:29

Hey, thanks. I actually figured out the following on my own, which returned the same results as teadrinker's in my testing, and appears even simpler, unless there's some caveat I'm missing.

Code: Select all

w::
top := DllCall("GetTopWindow", "Ptr", "")
Loop {
	next :=	DllCall("GetWindow", "Ptr", A_Index = 1 ? top : next,"uint", 2)
	WinGetTitle, title, % "ahk_id" next
	If title {
		i++
		str .= Format("{:-3}{}",i . ":",title) "`n"
	}
} Until !next
Msgbox, % str
str := i := ""
Return
I've changed my approach and swapped chrome.ahk for Accv2.ahk, and implemented jeeswg's functions from here: https://www.autohotkey.com/boards/viewtopic.php?f=6&t=26947&p=294316#p294316

The result being that tabs are now listed and can be focused in both Chrome & Firefox, without requiring debug mode or anything like that. I've accounted for tab grouping in Chrome, so the listings are updated accordingly there, I've updated the zip in the first post.

I also fixed a couple issues, related to DPI scaling (disabled it, it's annoying to deal with) and sometimes rows not focusing their corresponding window.

jwwpua
Posts: 13
Joined: 06 Aug 2021, 15:03

Re: iswitchw mod - Fast window and browser tab switching

Post by jwwpua » 18 Aug 2021, 01:40

Very nice. Any plans to include chrome bookmarks or history in the results, prioritized below open tabs of course? It would be convenient for times you already closed the tab or just for quick access to anything whether open or closed.

jwwpua
Posts: 13
Joined: 06 Aug 2021, 15:03

Re: iswitchw mod - Fast window and browser tab switching

Post by jwwpua » 18 Aug 2021, 11:20

Not sure why, but my Chrome tabs aren't showing up at all. Another issue I have is that typing a number followed by space doesn't select a row (or do anything that I can tell). I got the latest from your github, so let me know if you have any suggestions. Thanks!

Edit: I downloaded from your OP, which fixed the issue of a number + space not working. However, I still can't get Chrome tabs to show up. I've closed/restarted Chrome and iswitchw. Also tried running Chrome in debug mode. I must be overlooking something...

evilmanimani
Posts: 29
Joined: 24 Jun 2020, 16:42

Re: iswitchw mod - Fast window and browser tab switching

Post by evilmanimani » 30 Aug 2021, 19:18

Hey there, hadn't had a look at this in a bit, and yeah it appears to be broken, something must have changed in a chrome update; I'll take a look when I get a chance.

User avatar
Thoughtfu1Tux
Posts: 125
Joined: 31 May 2018, 23:26

Re: iswitchw mod - Fast window and browser tab switching

Post by Thoughtfu1Tux » 07 Sep 2021, 22:43

Loving this script! But Firefox got broken by a recent update as well.

evilmanimani
Posts: 29
Joined: 24 Jun 2020, 16:42

Re: iswitchw mod - Fast window and browser tab switching

Post by evilmanimani » 11 Sep 2021, 23:50

I updated it on Github and in the attachment to fix Chrome tab support, Firefox support does continue to work though in my testing, but I'd recommend ensuring that you're launching with the x64 version of AHK or it won't be able to see 64bit processes. Vivaldi support is broken, as well, if anyone uses it besides me.

zhotkey
Posts: 14
Joined: 21 Jun 2017, 08:22

Re: iswitchw mod - Fast window and browser tab switching

Post by zhotkey » 13 Sep 2021, 18:49

Chrome is not showing up at all for this update for me. MSEdge at least appears and returns the last used tab, but doesn't show separate tabs. I am using AutoHokey v1.1.33 (Unicode 64-bit).

evilmanimani
Posts: 29
Joined: 24 Jun 2020, 16:42

Re: iswitchw mod - Fast window and browser tab switching

Post by evilmanimani » 13 Sep 2021, 19:35

Do you have "Native accessibility API support" enabled in chrome://accessibility ? You may need to reload the script after enabling that in Chrome.

zhotkey
Posts: 14
Joined: 21 Jun 2017, 08:22

Re: iswitchw mod - Fast window and browser tab switching

Post by zhotkey » 13 Sep 2021, 22:15

If I enable "Native accessibility API support"" it works, thanks!

silverrs8
Posts: 3
Joined: 19 Mar 2023, 11:07

Re: iswitchw mod - Fast window and browser tab switching

Post by silverrs8 » 19 Mar 2023, 11:45

Superb script. The only thing not working is searching for numbers and in addition a period.
I have many files open that have a version number in the name e.g. workshop 2.1. It would be great of it also could search for "2.1".

When pressing the '.' the script exits.

Does anyone know what to change to make this possible?

User avatar
rommmcek
Posts: 1475
Joined: 15 Aug 2014, 15:18

Re: iswitchw mod - Fast window and browser tab switching

Post by rommmcek » 24 Mar 2023, 23:43

silverrs8 wrote:
19 Mar 2023, 11:45
The only thing not working is searching for numbers and in addition a period.
Ad numbers: In the RefreshWindowList() function comment out:

Code: Select all

  if (search ~= "^\d+")
    return
Ad period: Define your own EndChars (e.g.: Hotstring("EndChars", "-()[]{}:;""/\,?!`n`t") - note: there is no period and no space) before:

Code: Select all

Loop 99 {
    KeyFunc := Func("ActivateWindow").Bind(A_Index)
    Hotkey, IfWinActive, % "ahk_id" switcher_id
    Hotstring(":X:" A_Index , KeyFunc)
}
P.s.: Read thoroughly comments in the script!
P.p.s.: Once the script considers an entry as match (green text) or mismatch (red text) you can still edit the entry by selecting part of it by mouse or Shift + Left/Right and entering new text w/o using Del or BackSpace which would erase entire entry.

silverrs8
Posts: 3
Joined: 19 Mar 2023, 11:07

Re: iswitchw mod - Fast window and browser tab switching

Post by silverrs8 » 25 Mar 2023, 05:18

Thanks a lot. That did it. Much appreciated! This is a huge game changer from a generic Windows usability perspective.

silverrs8
Posts: 3
Joined: 19 Mar 2023, 11:07

Re: iswitchw mod - Fast window and browser tab switching

Post by silverrs8 » 23 Sep 2023, 13:07

Did anyone test if it still works on Windows 11 as well? It now has become an important part of my toolset but need te migrate to W11 soon.

evilmanimani
Posts: 29
Joined: 24 Jun 2020, 16:42

Re: iswitchw mod - Fast window and browser tab switching

Post by evilmanimani » 01 Oct 2023, 17:31

silverrs8 wrote:
23 Sep 2023, 13:07
Did anyone test if it still works on Windows 11 as well? It now has become an important part of my toolset but need te migrate to W11 soon.
Hey, surprised there's still folks using this, but happy to see that's the case :)

You'll be pleased to hear that it does indeed work on W11, and I've also managed to get both Vivaldi and Chrome tab listing/switching working for a coming update by using the Chrome Devtools protocol (without requiring Chrome.ahk for that matter), once it's up, all that is needed is to create a shortcut to your browser with

Code: Select all

--remote-debugging-port=9222
(use whatever port number you want) appended to the target field, then just add it to the configuration.

Firefox support relied on Acc.ahk, and it appears that the paths have broken once again :D, still looking into that, but admittedly at a lower priority since I don't presently use Firefox myself. If anyone has any guidance on that part I'm all ears.

I should be putting an update on Github in the next day or so here so keep an eye out for that. For the future I'm hoping to get a simple config dialog working. Any suggestions or feedback is appreciated. Cheers.

evilmanimani
Posts: 29
Joined: 24 Jun 2020, 16:42

Re: iswitchw mod - Fast window and browser tab switching

Post by evilmanimani » 01 Oct 2023, 19:21

Just pushed the update for those changes, let me know if you run into any hiccups!

https://github.com/evilmanimani/iswitchw

evilmanimani
Posts: 29
Joined: 24 Jun 2020, 16:42

Re: iswitchw mod - Fast window and browser tab switching - Updated Oct 1st, 2023!

Post by evilmanimani » 01 Oct 2023, 22:07

If you happened to grab it from the OP or Github just since my last post, might want to grab it again. Made a quick change so that the script won't become unresponsive while It's connecting to Chrome/Vivaldi to grab the tab list.

Post Reply

Return to “Scripts and Functions (v1)”