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

Open links and bookmarks, lang, history links in background when pressing ctrl #158

Closed
wants to merge 8 commits into from

Conversation

aunetx
Copy link
Contributor

@aunetx aunetx commented Oct 23, 2023

Fixes #157, and depends on #155 (although this dependence can be dropped as it is only used when loading bookmarks and history rows in background).

@hugolabe
Copy link
Owner

Doesn't seem to work well for me. Once you press Ctrl, all the links in the side panel open in a new tab, even when you have already released it.

This could be solved. However, I'm not convinced about the method used of capturing the key press and then saving it to a variable in the window module. This can be prone to problems and makes the code more difficult to maintain.

I think the check should be done in the module in which a link has been clicked, checking the state of the modifier keys. I'll try to look at it with more time.

@hugolabe hugolabe closed this Nov 15, 2023
@jhenriquelc
Copy link

Hi, I've been looking into implementing this as a first contribution to the project but I've run into a few obstacles

GtkListBox seems to abstract away the event used to emit the row-activated signal, making it impossible to implement this in most places without either changing what widget is used for the list and its rows (losing all of the niceties that those provide) or handling the modifier key state externally.

However, adding support for this inside the WebKit view seems pretty trivial, maybe we could add that while we figure out the rest?

Is using an Adwaita ActionRow with a button suffix for opening the link in a new window a good compromise (maybe too cluttered)? Or maybe a preference to open links in new tabs by default (kinda inflexible but at least customizable)?

@camelCaseNick
Copy link
Contributor

GtkListBox seems to abstract away the event used to emit the row-activated signal

You could just not use that signal, but add your own Gtk.GestureClick and do the same handling currently done in the activation handler with an additional check for the GDK_CONTROL_MASK in Gtk.EventController.get_current_event_state() (a gesture is an event controller).

@hugolabe
Copy link
Owner

Hi @jhenriquelc

It should probably be done with Gtk.Gesture as @camelCaseNick says, but it doesn't seem like an easy task.

However, adding support for this inside the WebKit view seems pretty trivial, maybe we could add that while we figure out the rest?

I think it's more coherent to add support within Webkit if it's added to the rest of the widgets. Currently you can already open a link in another tab with the middle mouse button or with the context menu.

Is using an Adwaita ActionRow with a button suffix for opening the link in a new window a good compromise (maybe too cluttered)? Or maybe a preference to open links in new tabs by default (kinda inflexible but at least customizable)?

I don't think it's a good idea to make changes to the application's UI because of this. I think it could be an improvement to add support for the Ctrl key but it's not essential either.

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.

Open links and bookmark in new tab in pressing ctrl
4 participants