Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hidden option for preferring windows over tabs #55

Merged
merged 1 commit into from
Jun 6, 2022
Merged

Conversation

lydell
Copy link
Owner

@lydell lydell commented May 21, 2022

Addresses #54.

In short:

  • Alt+K and Alt+Shift+K opens links in new background windows instead of tabs. Note: Firefox seems to always focus new windows currently, while Chrome is able to open windows in the background. So on Firefox, Alt+K and Alt+L are effectively the same, and Alt+Shift+K just feels broken when you use it.
  • Alt+L opens links in new foreground windows instead of tabs.
  • Holding Alt while activating a hint opens the link in a new window instead of tab.

This is kept as a hidden option since it doesn’t work 100 %. I’ll revisit again as more users of this feature show up.

  1. Go to Link Hints Options.
  2. Scroll to the bottom of the page.
  3. Expand the “Debug” section.
  4. Scroll to the “PREFER_WINDOWS” option.
  5. Enable it!

@lydell
Copy link
Owner Author

lydell commented May 21, 2022

@ceasal Would you mind testing builds from this pull request? That’s a much faster feedback cycle than publishing “for real” which can take weeks.

  1. Install one of the builds below. (It sounds like you use Firefox but I added Chrome as well just in case.)
  2. Go to Link Hints Options.
  3. Scroll to the bottom of the page.
  4. Expand the “Debug” section.
  5. Scroll to the “PREFER_WINDOWS” option.
  6. Enable it!

(You can also build the extension yourself, if you prefer: https://github.com/lydell/LinkHints/blob/main/CONTRIBUTING.md)

Firefox

  1. Download this zip: link_hints-1.2.3.zip
  2. Go to about:debugging.
  3. Click “This Firefox” in the sidebar.
  4. Click the “Load Temporary Add-on…” button.
  5. Choose the zip file you downloaded.
  6. Now you should be able to test the version from this PR until you restart Firefox!

Chrome

  1. Download this zip: link_hints-1.2.3.zip (Note: Another zip than for Firefox.)
  2. Unzip it into a folder.
  3. Go to chrome://extensions in Chrome.
  4. Disable your current Link Hints installation.
  5. Enable the “Developer mode” switch in the top right corner.
  6. Click “Load unpacked” in the top left corner.
  7. Choose the folder you unpacked the zip into.
  8. Now you should be able to try it out!

@ceasal
Copy link

ceasal commented May 21, 2022

Tested in Firefox 99.0.1

After checking prefer windows in debug,

Alt+K, Alt+L both open new windows.
Alt+Shift+K opens a new window but stays in hinting mode when switching back to the window, although the new window is focused immediately.
Alt+J and holding Alt when activating the last key in a hint opens in a new tab as well.

The binds seem to perform as they did before when the debug flag is not checked.

@ceasal
Copy link

ceasal commented May 21, 2022

I added some machinery to my window manager to ignore focus changes for Chrome and Firefox windows.

On Chromium 100.0.4896.127, the K bindings open in the background and L opens in the foreground, corroborating your testing.

Firefox does the opposite: a newly spawned window is not focused, while any window opened from a middle click will be focused.

From my simple testing on X11, when a page is loaded in a new window, it seems Firefox sends a _NET_ACTIVE_WINDOW signal. Chrome does not send such a signal.

I tried opening a new window from a terminal, e.g. firefox --new-tab http://google.com but the signal it still sent.

@lydell
Copy link
Owner Author

lydell commented May 22, 2022

Thanks for the testing!

On macOS, Chrome works perfectly with background/foreground windows. It works just like with tabs. While Firefox seems to always focus new windows. So on Firefox, Alt+K and Alt+L are effectively the same, and Alt+Shift+K just feels broken when you use it.

Is this still good enough for you? If so, I think I might merge this as-is and keep it as a hidden “debug” option. Partly because few Link Hints users seem to need it, partly because it doesn’t work 100 %.

@ceasal
Copy link

ceasal commented May 22, 2022

Yes, it's reasonable to keep the option hidden given the behavior isn't consistent.

@lydell lydell merged commit 83240d8 into main Jun 6, 2022
@lydell lydell deleted the windows branch June 6, 2022 09:15
This was referenced Jun 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants