Hello Richard, On 2025-12-08 21:12:56 +0100 R Frith-Macdonald <[email protected]> wrote:
> > On 08/12/2025 18:49, Patrick Cardona wrote: >> Hello, > >> Until now, I was not able to fix the openURL issue. > >> Context: >> - I added a wrapper 'Firefox.app'. >> - The Default Web Browser in 'SystemPreferences > Internet' has been set to >> Firefox.app. Its Info-gnustep.plist contains the expected array >> 'CFBundleURLTypes'. > > The default web browser is what is supposed to be used to open a URL if an > app asks to open that URL (like asking to open a file) by calling the > -openURL: method. > >> - But the "firefox" word is not found in any .plist of '~/GNUstep/Defaults' >> folder. > > The preferred/default app for a task is stored in Services.GNUstepExtPrefs in > the Library directory, not in the defaults database. > So I looked for it: for FOLDER in /System/Library /Local/Library/; do find $FOLDER -name "Services.GNUstepExtPrefs"; done Not found. Is my GNUstep system badly set? > >> I also installed an OpenURLService, did 'make_services' and successfully >> tested with a selected URL string. But this is not fixing the case of links >> within TextEdit nor GNUMail. > > Services are provided by the Services menu ... typically highlighting text > and selecting a service should perform that service on that text. > > >> 1) Without the link filter, when the string "https://www.gnustep.org" is >> selected, >> in a text file, the menu 'Services > Open Selected URL' is available and it >> works to open the above URL in the default browser (firefox). > > So that confirms that your service is working ... you can highlight any text > and use the Services menu to open it as a URL. > >> 2) With the link filter: if I use 'Edit > Add link' menu within TextEdit, >> the related link (same URL as above) is created and highlighted (with the >> blue color and the expected pointer of the mouse over) >> GNUstep.org >> But when I click on the above link, nothing happens. > > Clicking on some general text in an app is controlled by that app (it's not > something built into the GNUstep libraries). If the app wants to open a URL > in a browser, I would expect the app to call the -openURL: method. > Since it seems that -openURL: is not being called, I'd guess the two apps > you are talking about do not want to open links when they are clicked. So I wonder why they implemented such filters: - In he case of TexTEdit, maybe to provide links in the exported PDF files? - For GNUMail, mails seem filtered to provide a plain text mail, but with active links. Maybe Riccardo could tell us about the underlying code. > >> I guess in the case two: >> - The mouseDown Event should handle the NSURL object with the openURL >> method. >> - Something related to default Web Browser in NSWorkspace should handle >> both the default browser app and the openURL method. > >> So I guess my Service menu will never be useful to handle such case, >> because URL strings are not the same as NSURL objects. > >> How do you handle such links > > I think it sounds like what you want is to change TextEdit and GNUmail to > support clicking on links in the text they are displaying to open aURLs. > That means they must check the mouse down, see if it was over a part of their > text that looks like a link, and decide (according to some rule you decide > on) whether they want to open the link rather than editing the text. If > they want to open the link the apps need to, call -openURL: passing the URL > as a parameter. I don't haver the source code to hand, but last time I > looked TextEdit.app does not support clickable links, and I'm guessing > GNUmail doesn't either. > > The GNUstep framework provides the mechanism (call the -openURL: method, and > it will use the preferred app to do so), but it's up to individual apps > whether/when they use it. > > The framework also provides the Services menu as a way to perform this (and > other installed services) on any text that an app allows to be selected. > Service are pretty much automatically available (if an app prevents text from > being selectable, that's generally deliberate). > If the fact this is not provided even in GNUMail is confirmed, I think we should implement it in a more general way. As a link to open an URL in the preferred Web Browser is a common expected behaviour in a Desktop, maybe we could think of something part of a kind of GNUstep Desktop Framework to enhance the behaviour of all existing applications to provide this functionality? It could mostly be usefull than writing the same code here and there to enhance exisitng apps. Almost apps could benefit from it: Affiche, GNUMail, HelpViewer, SimpleAgenda, TextEdit or Ink... Cheers, Patrick -- Patrick Cardona - Pi400 - GNU/Linux aarch64 (Debian 13.2) Xorg (1:7.7+24) - libcairo2 (1.18.4-1+rpt1 arm64) Window Maker (0.96.0-4) - GWorkspace (1.1.0 - 02 2025) - Theme: AGNOSTEP - MUA: GNUMail (1.4.0)
