Aris-t2 / CustomCSSforFx

Custom CSS tweaks for Firefox
GNU General Public License v3.0
1.84k stars 180 forks source link

Page Title in Address Bar #428

Closed LeeBinder closed 2 years ago

LeeBinder commented 2 years ago

Hi Aris-t2. I've read your issue blurb so I don't expect you to do anything to begin with. At this point I'd just like to hear your expert opinion if you consider it possible at all to revive legacy Firefox' tweak to show a page's title in Firefox' Address Bar rather than the URL?

The two old XUL extensions that did this in Firefox legacy are attached just for reference (simply remove the .zip from each file name) add_page_title_to_url_bar-1.0.20-fx.xpi.zip page_title_in_url_bar-6.2-fx.xpi.zip

Also there used to be a similar userChrome.css + url-title-hover.xml solution, but that stopped working, too, with some recent FFx update.

What do you think? Or have you maybe even looked into this at some point already?

Aris-t2 commented 2 years ago

It might be possible with JavaScript, but not with CSS.

LeeBinder commented 2 years ago

Hi @Aris-t2, great to see you here 👍 !

I'd say I testify to that since all my attempts with CSS led to - nothing. And I'm not a pro in JS as you are. But I know a little bit of JS. If you have code snippets for me to try out, I'd be all in for that :)

Aris-t2 commented 2 years ago

I came up with something, that goes into the direction you requested. Instead of replacing the url, the script adds a title label.

image

https://github.com/Aris-t2/CustomJSforFx/blob/master/scripts/tab_label_in_urlbar.uc.js

Continue here: https://github.com/Aris-t2/CustomJSforFx/issues

LeeBinder commented 2 years ago

Great, thank you @Aris-t2, will try 👍

For Waterfox Current (based on FF 91.4.0), is there one of the methods (M2 or M3) you would recommend over the other?

Aris-t2 commented 2 years ago

I can only recommend M2. M3 might work, but I haven't tested it for a while.

LeeBinder commented 2 years ago

@Aris-t2 I'm sorry, but I can't manage to get this working at all, neither in Windows (Firefox) nor macOS (Firefox, Waterfox), all latest release-channel versions of both browsers. I tried in new empty profiles to make sure there is no interference, and after trying M2 also tried M3 (with its corresponding config.js and config-prefs.js) with all steps from your ReadMe incl. deleting startup cache etc.- same thing.

Have you tested this only in dev/ nightly Ffox? Or are you maybe also using specific CSS which is required for this to work?

I this also works for you in release Ffox: could you maybe just zip up (with max. compression) and attach your entire chrome folder while you have this working? That might be the easiest/ simplest, esp. for you. I'm sure I can narrow this down from there.

Aris-t2 commented 2 years ago

I run tests on release and Nightly using M2.

image

chrome.zip

LeeBinder commented 2 years ago

yes @Aris-t2, thanks to your chrome folder I got this working now 👍 Turns out it was a quite blunt mistake: I downloaded https://github.com/Aris-t2/CustomJSforFx/blob/master/scripts/tab_label_in_urlbar.uc.js directly via right click, save as, having forgotten that on GithUb it's necessary to open such link first because it will display the file as a webpage embedded into GithUb, click onto "Raw", THEN download .. :) So for completion, here's the link to the directly downloadable raw script.

I even managed to maintain xiaoxiaoflood's config.js mods to also have his custom legacy Extensions still working, by merging his config.js into yours 😎:

click to expand ```javascript // This is a mixed config.js, Aris-t2 and xiaoxiaoflood merged by Lee Binder lockPref('xpinstall.signatures.required', false); const Cu = Components.utils; Object = Cu.getGlobalForObject(Cu).Object; const { freeze } = Object; Object.freeze = obj => { if (Components.stack.caller.filename != 'resource://gre/modules/AppConstants.jsm') return freeze(obj); obj.MOZ_REQUIRE_SIGNING = false; Object.freeze = freeze; return freeze(obj); } try { Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource://gre/modules/osfile.jsm"); if (!Services.appinfo.inSafeMode) { Services.scriptloader.loadSubScript( OS.Path.toFileURI(OS.Path.join(OS.Constants.Path.profileDir, "./chrome/userChrome/userChromeJS.js")), this, "UTF-8"); }; } catch(e) {}; try { const { Services } = Cu.import('resource://gre/modules/Services.jsm'); Cu.import(Services.io.newFileURI(Services.dirsvc.get('ProfD', Ci.nsIFile)).spec + 'chrome/utils/boot.jsm'); } catch (ex) {}; ```

Just one little caveat: if the page/ tab title is really long (which on quite a few pages it is), it completely covers the URL, making it impossible to edit or copy it..

Do you think it would be possible by any chance to insert a condition that onclick (best both, left and right), the label is hidden, or its visibility index is set to a value behind the URL?

Aris-t2 commented 2 years ago

CSS could save the day. ;-) I did no run much tests yet, but this would simply hide the label once you hover the urlbar

#urlbar:hover #tab_label_in_urlbar {
  display: none !important;
}

Maybe I should add some "max width" by default or something similar.

LeeBinder commented 2 years ago

Mighty fine, perfect 👌 ! Or should I say: stylish .. 😉

Aris-t2 commented 2 years ago

I did some more tweaks to the script. ;-) Feedback: https://github.com/Aris-t2/CustomJSforFx/issues/54