IBBoard / cawbird

A fork of the Corebird GTK Twitter client that continues to work with Twitter
https://ibboard.co.uk/cawbird/
GNU General Public License v3.0
310 stars 37 forks source link

Open Tweet by insert URL #245

Open ghost opened 3 years ago

ghost commented 3 years ago

Is your feature request related to a problem? Please describe.

Actually there are no way to open exact tweet by URL using Cawbird.

Describe the solution you'd like

Add option to open exact tweet just by insert its URL:

Describe alternatives you've considered

Twidere/Twidere-X (Twitter client for Android) supports opening Twitter links via web browsers integrated option "Open Link with Appp" or via sharing URL using "Open Link With" & "Easy Open Link"

Additional context Add any other context or screenshots about the feature request here.

IBBoard commented 3 years ago

Yeah, I've hit this a few times recently (e.g. finding a tweet somewhere online and wanting to QT it from Cawbird). Shouldn't be too hard to do. I doubt we'll support pic.twitter.com, though, because we've got no way (that I know of) for backtracking from images to tweets and so users can just open the image in their browser.

IBBoard commented 3 years ago

This will need @CodedOre to think about how to do it in the LibHandy redesign, though 🙂

CodedOre commented 3 years ago

The thing is this: iOS (and I guess Android too) allow an app to set URL's they handle, so when they are called, it ask to open it in the app.

I don't know if there is an equivalent on Linux. Have to look at it at sometime.

CodedOre commented 3 years ago

Alright, I have done some quick research, and it seems like this could (maybe) be done with XDG-MIME.

It would require to expand the Desktop-File, (maybe) set up an custom MIME-Specification and creating some code that can get an URL over as an command line argument and open the requested page. Sounds more like backend to me.

I would like to emphasize the "maybe". So far as I could see without experimenting with it it is only verified working with file-types and url's under an different domain, such as "apt://". I think it should be possible to be extended to an URL, but have to try it.

CodedOre commented 3 years ago

@Symbian9, if you know any examples of Linux apps implementing such a thing, I would be glad for a mention here.

ghost commented 3 years ago

if you know any examples of Linux apps implementing such a thing

@CodedOre, Guess you are asking me about "Open/Share with App..." feature here, right?

As far as I know, there are some web browser extensions which provide "Open/Share with App..." feature to share URL with other apps (basing on MIME tipe). Also in web browsers on Linux (even on all other platforms) there is feature to choose ann app to open file with when click on some download links.

Additionally there is MIME tipe for *.url files (text files with single URL link string), which could be set to open by specific application on Linux or by choose one of the apps which has assigned such MIME type.


BTW, Lets Cawbird has at least a feature to open direct tweet just by insert its URL via Cawbird GUI.

Actually Cawbird has NO at least CLI option to open URL like common browsers already has:

$ cawbird https://twitter.com/<@user>/status/<tweet_ID>
CodedOre commented 3 years ago

@CodedOre, Guess you are asking me about "Open/Share with App..." feature here, right?

As far as I know, there are some web browser extensions which provide "Open/Share with App..." feature to share URL with other apps (basing on MIME tipe). Also in web browsers on Linux (even on all other platforms) there is feature to choose ann app to open file with when click on some download links.

I was specifically asking about apps including an "a specific url opens the app instead of the browser", because it would prove this is possible (as I already mentioned, it might work, but it needs to be proven to work).

But I also can't think of an app doing this right now.

Open the right app from a link yes, but a specific url without distinct domain, that's the big question.

ghost commented 3 years ago

I was specifically asking about apps including an "a specific URL opens the app instead of the browser", because it would prove this is possible (as I already mentioned, it might work, but it needs to be proven to work).

What about MiniTube? It 'share' YouTube video links with media players by launch configured media player with shared URL via CLI interface:

Additionally some feature on "Open/Share URL with App" using copied text string from clipboard buffer has CopyQ (Qt5) app:

Guess, ClipIt (GTK+) clipboard manager also has such feature:

Additionally GoldenDict has a feature to get text string from clipboard buffer as query text input just by select text string in any app & hit Ctrl+C+C shortcut to show output as GoldenDict's "Scan pop-up" or directy in GoldenDict's main window:

I suggest that GoldenDict's behavior is most related to expected feature adding for Cawbird.

IBBoard commented 3 years ago

Alright, I have done some quick research, and it seems like this could (maybe) be done with XDG-MIME.

It would require to expand the Desktop-File, (maybe) set up an custom MIME-Specification and creating some code that can get an URL over as an command line argument and open the requested page. Sounds more like backend to me.

I would like to emphasize the "maybe". So far as I could see without experimenting with it it is only verified working with file-types and url's under an different domain, such as "apt://". I think it should be possible to be extended to an URL, but have to try it.

Yeah, I'm not expecting to do a "Always open in Cawbird" and have Firefox suddenly kick you to Cawbird. I don't think that's possible. As you say, it's mime-types (Twitter doesn't have a mime type) or it's specific protocols (apt:// or magnet:// and whatever else BitTorrent clients use)

As a first step, I was planning to add an equivalent to "File > Open" and you paste the URL. We can trivially use the existing TweetUtils.activate_link() functionality to open the tweet as a page. It lets people take URLs from elsewhere and then interact with them through Cawbird (Maybe you're not logged in through your browser? Maybe you just don't want "Posted from Twitter Web" on your posts?). That's where we'd need the LibHandy design updating - where does the "open tweet" menu item (or other widget) go?

Second step would be working out how to do it from the CLI, potentially to a running instance. I put that second because there's more checks around "is the app open? If not, open it with a non-standard starting window".

Third step would be DBus or whatever other mechanisms are required for other communication with other apps, if we need that.

GoldenDict's feature sounds like they're just using a global shortcut to trigger a specific interaction and then taking the clipboard - which may be much harder/impossible under Wayland. Some of the others sound like they're potentially either just using xdg-open (or similar) or know that the app takes a file/URL as an argument.

CodedOre commented 3 years ago

Yeah, I'm not expecting to do a "Always open in Cawbird" and have Firefox suddenly kick you to Cawbird. I don't think that's possible. As you say, it's mime-types (Twitter doesn't have a mime type) or it's specific protocols (apt:// or magnet:// and whatever else BitTorrent clients use)

Well, that was my first interpretation of the wanted feature, but I might have misinterpret that.

Would still make for a interesting addition if possible. It's quite handy to click on an URL and be asked to open it in the right app on iOS. But, there is no real equivalent for this on Linux.

As a first step, I was planning to add an equivalent to "File > Open" and you paste the URL. We can trivially use the existing TweetUtils.activate_link() functionality to open the tweet as a page. It lets people take URLs from elsewhere and then interact with them through Cawbird (Maybe you're not logged in through your browser? Maybe you just don't want "Posted from Twitter Web" on your posts?). That's where we'd need the LibHandy design updating - where does the "open tweet" menu item (or other widget) go?

I would probably just place that in the app-menu. It would probably be the best point for it. On the other hand, the menu would give not much space for an entry of the URL... Have to do some experimenting.

Second step would be working out how to do it from the CLI, potentially to a running instance. I put that second because there's more checks around "is the app open? If not, open it with a non-standard starting window".

Third step would be DBus or whatever other mechanisms are required for other communication with other apps, if we need that.

The point here is: There are not so many apps which would call Cawbird for open a tweet beside a browser. It could be useful for quicksharing something on Twitter, but we are lacking a general mechanism for that too.

ghost commented 3 years ago

I would probably just place that in the app-menu. It would probably be the best point for it.

Yep, add it just as sub menu under "gear" icon:

On the other hand, the menu would give not much space for an entry of the URL... Have to do some experimenting.

I propose show input URL filed in pop-up widget, same way as pop-up widget works for create new tweet.

CodedOre commented 3 years ago

So, from my experiments today, I think the best solution would be this:

better_insert_url

When a user wants to open a URL inside of Cawbird, we can't (like on iOS) ask that the link should be opened in Cawbird. But I think we can look inside the clipboard if it contains a link with the twitter domain. And since the user will likely copied the link when going back to Cawbird, we could then ask if this link should be shown in Cawbird.

But adding the option to open an tweet by adding the link to the command line is a good idea.

IBBoard commented 3 years ago

I'm never entirely convinced by the "spy on the clipboard" approach. I think I've seen comments about it not working in some contexts (Wayland again?) and apparently it's a bad idea. Plus it just seems invasive.

That's not to say that it isn't a good mockup. It looks clean and useful. I'm just not convinced by the technical approach that it requires.

I'd rather have an action button or menu item that pops up a dialog (both as a user, and as the developer)

CodedOre commented 3 years ago

Technically, I think it is not that much of an problem.

I personally use Wayland ans while I had some problems at the start, they were limited to "clipboard is cleared when original app is closed" and this I think is also resolved.

And I wouldn't intent to constantly scan the clipboard, only one scan when Cawbird was unfocused and get that focus back (since this would be the point where the user returns from the browser, etc. to insert it in Cawbird). Haven't looked at details, but this shouldn't waste resources.

However, it is an thing where some could question what is does. Reading the entire clipboard to see if there is a Twitter URL can seem invasive, even if we only care about the actual URLs we use.

ghost commented 3 years ago

I'm never entirely convinced by the "spy on the clipboard" approach.

Fully agree on this warning. Cawbird should NOT monitor my clipboard buffer!

Please, follow my request as described in my previous comment https://github.com/IBBoard/cawbird/issues/245#issuecomment-748076486

IBBoard commented 3 years ago

And I wouldn't intent to constantly scan the clipboard, only one scan when Cawbird was unfocused and get that focus back (since this would be the point where the user returns from the browser, etc. to insert it in Cawbird). Haven't looked at details, but this shouldn't waste resources.

I guess that makes sense. But I think it still treads that fine line between "helpfully guessing your actions" and "feeling invasive.

Or… maybe… We could have both? Have an "open with" option and have a (disabled by default) "auto-detect copied Twitter URLs" setting?

I personally use Wayland ans while I had some problems at the start, they were limited to "clipboard is cleared when original app is closed" and this I think is also resolved.

The other thing I'm aware of is the whole "listen out for global shotcuts" 'problem', but as I understand it then it's less a "Wayland problem" and more just that Wayland has a tighter (and more secure) architecture than X and doesn't let apps get arbitrary events or otherwise interfere with each other.

ghost commented 3 years ago

and have a (disabled by default) "auto-detect copied Twitter URLs" setting?

Yep, this should be optional only.

IBBoard commented 3 years ago

So that we've got it for reference (because I've been poking around this bit for other reasons) it looks like Cawbird.vala command_line() is where we need to catch this. after opt_context.parse() the array contains the remaining arguments. This includes the executable path (like $0 in Bash scripts) and any other non-switch arguments. We should be able to check that for the URL pattern and take it if it matches.

philipzae commented 3 years ago

As mentioned in my duplicate bug, it would be good that when searching for a tweet URL, that the original tweet appears in the search results and not just when the tweet URL is quoted in another tweet, so it would be easy to jump to a tweet which you've copied from and pasted in the search tab.

CodedOre commented 3 years ago

That would actually be a good idea.

We currently have categories for search results, so if a valid URL is entered, we could display the right tweet on top in an "direct hit" category.

However I think it could still be a good idea to add the menu option as well.

IBBoard commented 3 years ago

Yeah, the search wouldn't be a replacement. Should it be the only way that people can do it from the GUI if they have the "check the clipboard" functionality disabled? It would save us having an "Open tweet" menu item somewhere, but I'm not sure if it's sufficiently discoverable.

philipzae commented 3 years ago

After contemplating it more, I think Ctrl + V might be a great means to easily jump to a tweet, as you are copying the link from your browser, so why not paste to jump to it.

IBBoard commented 3 years ago

We probably can't do Ctrl+V everywhere because we risk clashing with people trying to paste tweet URLs into DMs etc.

But CodedOre's mockup assumes that we can check the clipboard when people switch focus back to Cawbird and then give them a prompt asking to open it. The idea is that "Cawbird gets focus again" is a good indicator for "user went to another app, copied the link and came back to Cawbird to use it".

But it would be disabled by default because people might be concerned about the privacy of scraping their clipboard, even though we'd be looking for something like ^https?://((mobile|www)\.)?twitter.com/[A-Za-z0-9]+/status/[0-9]+(\?[^\s]+)?$ and ignoring the contents if it doesn't match.

Thinking about it, do we want to trigger it internally when people right-click a link in Cawbird and copy? Or not because they could have just clicked the link, and so they're probably copying it to use it somewhere else?

philipzae commented 3 years ago

We probably can't do Ctrl+V everywhere because we risk clashing with people trying to paste tweet URLs into DMs etc.

The intent was for it to work in particular scenarios, like timeline view, where there would be no text input happening.

But CodedOre's mockup assumes that we can check the clipboard when people switch focus back to Cawbird and then give them a prompt asking to open it. The idea is that "Cawbird gets focus again" is a good indicator for "user went to another app, copied the link and came back to Cawbird to use it".

Clipboard monitoring will definitely cause problems in my view. For example, I right-click 'Sources' > 'Copy Link Address', then i switch away from cawbird and then switch back, the popup appearing then wouldn't be useful.

But it would be disabled by default because people might be concerned about the privacy of scraping their clipboard, even though we'd be looking for something like ^https?://((mobile|www)\.)?twitter.com/[A-Za-z0-9]+/status/[0-9]+(\?[^\s]+)?$ and ignoring the contents if it doesn't match.

Disabled by default seems good.

Thinking about it, do we want to trigger it internally when people right-click a link in Cawbird and copy? Or not because they could have just clicked the link, and so they're probably copying it to use it somewhere else?

Sorry didn't follow this.

IBBoard commented 3 years ago

We probably can't do Ctrl+V everywhere because we risk clashing with people trying to paste tweet URLs into DMs etc.

The intent was for it to work in particular scenarios, like timeline view, where there would be no text input happening.

Makes sense. But which views do we support it in? Timeline at a minimum. But mentions? Likes? Lists? Probably not DMs (but then would people expect DM links to work instead?).

Thinking about it, do we want to trigger it internally when people right-click a link in Cawbird and copy? Or not because they could have just clicked the link, and so they're probably copying it to use it somewhere else?

Sorry didn't follow this.

If we only check the clipboard and pop up the banner when people refocus the window then we won't show the banner when people right-click a link within Cawbird and copy the link. Is that good because anyone who is copying the link would probably have just clicked it if they wanted to open it in Cawbird (so the banner would be annoying) or is it bad because it's inconsistent that they've got a Twitter URL in the clipboard and we're not showing the banner?

Because "copy to clipboard" is an internal action, we can trigger the banner to pop up when it is clicked as well as doing it when the app gets focussed. But we should only do it if it makes sense for users.

j1warren commented 3 years ago

my 2 cents, Ctrl-V on Home screen > check clipboard if it's twitter link > pop-up asking to open the tweet from clipboard. nothing else needed.

IBBoard commented 3 years ago

Do we need a popup if the user has pasted? That seems like a fairly clear request from the user to "do something" with the URL (unlike switching back to the app with a URL in their clipboard). And if it's not what they intended then they can go back.

j1warren commented 3 years ago

I would say Yes, but it's me. I don't like when programs do something drastic if I mistakenly press something intended for another window.

philipzae commented 3 years ago

Makes sense. But which views do we support it in? Timeline at a minimum. But mentions? Likes? Lists? Probably not DMs (but then would people expect DM links to work instead?).

All should work, unless you are in the conversation/textbox section of DM. DM links shouldn't work.

If we only check the clipboard and pop up the banner when people refocus the window then we won't show the banner when people right-click a link within Cawbird and copy the link. Is that good because anyone who is copying the link would probably have just clicked it if they wanted to open it in Cawbird (so the banner would be annoying) or is it bad because it's inconsistent that they've got a Twitter URL in the clipboard and we're not showing the banner?

Maybe to avoid problems of copied links from cawbird tripping up the clipboard monitor, maybe an extra bit of text can append the copied url, so cawbird knows not to process it. eg. https://twitter.com/JoeRessington/status/1350574543077838856?cawbird

Do we need a popup if the user has pasted? That seems like a fairly clear request from the user to "do something" with the URL (unlike switching back to the app with a URL in their clipboard). And if it's not what they intended then they can go back.

I would say no to the popup, as the user explicitly did an action.

IBBoard commented 3 years ago

Maybe to avoid problems of copied links from cawbird tripping up the clipboard monitor, maybe an extra bit of text can append the copied url, so cawbird knows not to process it. eg. https://twitter.com/JoeRessington/status/1350574543077838856?cawbird

That should work. And I've see Twitter links using "?s=11" for web vs app. But it gets dangerously close to "ad servers putting tracking junk on the URL" behaviour.

Makes sense. But which views do we support it in? Timeline at a minimum. But mentions? Likes? Lists? Probably not DMs (but then would people expect DM links to work instead?).

All should work, unless you are in the conversation/textbox section of DM. DM links shouldn't work.

But is it more or less confusing if it works on the home timeline, mentions, likes, list-of-lists, a list, and DM threads, but not a specific DM conversation and not search? And then the list-of-lists page sometimes has a text input on it, so do we change the behaviour when it's visible or only when it is focussed?

I'm not saying it can't be done, just thinking through the consistency and discoverability.

philipzae commented 3 years ago

But is it more or less confusing if it works on the home timeline, mentions, likes, list-of-lists, a list, and DM threads, but not a specific DM conversation and not search? And then the list-of-lists page sometimes has a text input on it, so do we change the behaviour when it's visible or only when it is focussed?

I'm not saying it can't be done, just thinking through the consistency and discoverability.

If the user is pasting a tweet url into the DM message, you'd want to capture it and show the tweet?

IBBoard commented 3 years ago

But if the input box isn't focussed, is that intentional and they want to open the tweet (like they do everywhere else) or is it accidental and they meant to post it into the content of a new DM?

It's almost certainly accidental. But it affects the consistency of the behaviour.

philipzae commented 3 years ago

When you click on a DM entry, similarly in search tab, focus is automatically put in the text field, after that you could attempt to pull text from previous messages and could mistakenly Ctrl+V rather than Ctrl+C. So if for the DM tab we want to show the popup when the textbox isn't in focus, that seems like a fine compromise.

IBBoard commented 3 years ago

I think we'd show the popup across all sections of the app whether there's a textbox focussed or not because the action that opens the tweet is clicking the "yes, do something with it" button/link not pressing Ctrl+V. The thing that we need to consider the consistency of is the Ctrl+V behaviour.

Asday commented 2 years ago

Did this ever get implemented in any way? I'd like to not use the website.

IBBoard commented 2 years ago

No. The ticket is still open, and it's tagged with "libhandy redesign", which hasn't been completed yet. It will be easier to integrate it into the UI in a sensible way when we're doing the redesign, so it won't be completed until then.

Asday commented 2 years ago

Thank you.

Would you consider integrating it into the UI in a stupid way in the meantime? Dialogue somewhere, pasting a link in the search box, Konami code within ten seconds of launching the program... Anything is good, of which perfect is the enemy.

CodedOre commented 2 years ago

What already works quite well is copying only the id of the tweet (the last bit with numbers of the URL) and then searching for it in Cawbird.

Asday commented 2 years ago

What already works quite well is copying only the id of the tweet (the last bit with numbers of the URL) and then searching for it in Cawbird.

My dumb ass did this and only saw the "no users found" message, then gave up. Thanks, this works fine, please disregard me.