Skip to content
This repository has been archived by the owner on Apr 15, 2021. It is now read-only.

hotkey to open multiple windows at once #15

Open
DavidGretzschel opened this issue May 11, 2020 · 15 comments
Open

hotkey to open multiple windows at once #15

DavidGretzschel opened this issue May 11, 2020 · 15 comments

Comments

@DavidGretzschel
Copy link

A feature request:
I want want to enter something like mW, see the hints appear, typing a hint, it opening another window (that's not getting focus) and the hints appearing immediately again.
So basically a window-version of the very much loved mf.
I feel that mW would be even better, since I have a lot of screen real estate to show windows side by side with FancyZones these days on a 32:9 monitor.

eastmancr pushed a commit to eastmancr/vb4c that referenced this issue May 14, 2020
Implemented suggestion from issue [dcchambers#15](dcchambers#15). I attempted to make the main window come to the front but I think the PORT messages are destroyed by the time the function is called and `chrome.windows` is inaccessible. I also didn't want to modify messenger.js too much before the code gets refactored/rewritten.
@eastmancr
Copy link
Contributor

I created #16 that implements this feature. If you want to use it before it gets pulled into master, you can load it the same way you load the master branch by downloading it from the "multiwindow" branch in my fork. It defaults to unmapped but can be mapped by adding map mW :call createHintMultiWindow<CR> to your cVimrc from your options page.

@dcchambers, I recommend keeping this issue open until the feature is fully implemented or the commit gets pulled.

@DavidGretzschel
Copy link
Author

DavidGretzschel commented May 14, 2020

@lemonjuiz
very cool, thank you!
I could install your patch but I can't figure out what exactly "adding to the options page" means. The only thing I ever did here before was change the font to something bigger.
image
Where do I paste this in? The top or bottom window? Do I seperate this with two }-braces?

I tried several ways, but none worked.

@eastmancr
Copy link
Contributor

You put the map command in the top box. Your cVimrc is a list of commands that gets executed every time you load a page and you use it to store your custom settings. You want it to look like this:
image
The text following the " is a comment and can be omitted.

@DavidGretzschel
Copy link
Author

When I click "save" on the bottom left, it gives me some kind of error.
image

@eastmancr
Copy link
Contributor

eastmancr commented May 14, 2020

The command is map mW :call createHintMultiWindow<CR>, not mW :call createHintMultiWindow<CR>. If you open up the console with CTRL SHIFT J you would see Line NaN: Expected "(", "->", [ \t], or [\n\r] but ":" found. because it thought the command was mW when it should be map.

Change the command to map mW :call createHintMultiWindow<CR> to fix.

@DavidGretzschel
Copy link
Author

Ah I must have missed the map somehow.
That line I can save without an error, but mW doesn't do anything.
Except the m blocks the normal W from triggering. (which is normal, another W will do the normal "open in window"-thing)
Will try later on normal Chrome without any extensions that might interfere.

@eastmancr
Copy link
Contributor

You need to reload any tabs that were open before you Save on the options page to load the new command. vb4c only loads in those settings before a tab loads.

@DavidGretzschel
Copy link
Author

made a video on exactly what I did, am I still doing something wrong?
https://www.loom.com/share/e0dda7afff134f399b0ce0ba80a3119c

@eastmancr
Copy link
Contributor

eastmancr commented May 14, 2020

vb4c-patch-1

That sounds suspiciously like my patch-1 branch in my fork. Did you download the multiwindow branch or the patch-1 branch? multiwindow is the correct branch but I think I just haven’t changed my default branch from patch-1. Here is a direct link that should download it: https://github.com/LemonJuiz/vb4c/archive/multiwindow.zip
I will make it more clear what version is installed in the future.

If even after verifying the correct branch is installed the command still doesn't work, please send a screenshot of your console after pressing mW when it is mapped.

@DavidGretzschel
Copy link
Author

excellent, now it works!
Is there any way to not make it acticate the newly opened page?

@eastmancr
Copy link
Contributor

I’m not sure what you mean by that. If you mean “wait until ESC is pressed to open all of the windows,” that is something that might be able to be added but would require a bit of code refactoring as all multi commands just run the same command over and over and have no “memory” of previous commands.
If you mean “make the current window go on top of the opened windows,” I have tried that and that also needs a bit of refactoring.
If it is neither of those, please clarify.

@DavidGretzschel
Copy link
Author

DavidGretzschel commented May 16, 2020

I meant neither, I already have a way to keep the current window in foreground via AHK.
https://www.howtogeek.com/howto/13784/keep-a-window-on-top-with-a-handy-autohotkey-script/

But when I open a window with mW it'll activate itself, so I have to alt-tab back to the origin-window. So instead of quickly pressing bgbqbrbfba, I have to press alt+tab every two letters.
The "wait until ESC is pressed to open all of the windows" would be a good solution for this.

Though maybe there's a "do not activate new window"-setting in Chrome or vb4c already for this?

@eastmancr
Copy link
Contributor

I just wanted to leave an update here saying that I am working on this. I have the infrastructure in place to get the windows to open only when the hints are closed but I am having an issue with passing the links from one part of the code to another. This feature will have to be added in a future patch.

(For any JS developers reading, I can't get a local variable, sessionStorage, or localStorage to be persistent between content_scripts/messenger.js and content_scripts/mappings.js. All three options are persistent within the files individually but not across the whole codebase. Please message if you know what I am doing wrong.)

@DavidGretzschel
Copy link
Author

Actually what I wanted is already there, I was just confused.

I didn't notice that the active window never actually changed.
Chrome only implements a 1px wide frame to show that it's active instead of coloring the tabbar with the windows accent color.
Sorry for the confusion.
Still think that "wait for ESC...." would be pretty cool, though.

@DavidGretzschel
Copy link
Author

Actually, couldn't you just use open each link from the linklist, you create with "my" in its own seperate window?
(pressing "my" allows you to multi-grab urls, which you can open en masse by pressing "P" [something I just learnt a couple minutes ago])
Maybe could be put on "mP".

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants