Replies: 11 comments
-
Wow, you see me almost speechless!
Same to you! |
Beta Was this translation helpful? Give feedback.
-
I do not know, how it is for Unix/Linux (MacOS should not be affected I guess, because the menu is outside browser window), but in Windows the title string is layed over the menu which is by default hidden, but now covered by the string if enabled (embarrassing that I did forget about this). So I added this CSS: #menubar-items {
background-color: var(--lwt-accent-color);
background-image: var(--lwt-header-image);
position: relative; /* for z-index */
z-index: 1;
} For me using a theme this works fine. But I also tested code you provide with the addon bar script when not using a theme, and there seems to be some opacity setting necessary, but I did not check further. |
Beta Was this translation helpful? Give feedback.
-
Could you state the case, when the menubar and the "title" overlap? I tried to avoid those cases in the code. |
Beta Was this translation helpful? Give feedback.
-
Oops, I only downloaded the file and adjusted the settings/variables: var customcssforfx_tabs_not_on_top = 2;
var customcssforfx_appbutton_in_titlebar = 1; Just to be safe: I did not speak about the panel menu. |
Beta Was this translation helpful? Give feedback.
-
You are right. The code was not yer ready for the menubar ;-) To stop overlapping and without increasing titlebar size I tried to move the menubar to the right. Could you test this code: // 'Tab label in titlebar' script for Firefox by Aris
(function() {
try {
var customcssforfx_tabs_position = 0; // 0 = CustomCSSforFx not installed; 1 = tabs on top; 2 = tabs not on top;
var customcssforfx_appbutton_in_titlebar = 0; // 0 = CustomCSSforFx not installed / disabled; 1 = default/big; 2 = icon only
var titlebarlabelbox = document.createXULElement("hbox");
titlebarlabelbox.setAttribute("id","tab_label_in_titlebar_box");
var titlebarlabel = document.createXULElement("label");
titlebarlabel.setAttribute("id","tab_label_in_titlebar");
titlebarlabelbox.appendChild(titlebarlabel);
document.getElementById("titlebar").insertBefore(titlebarlabelbox, document.getElementById("titlebar").firstChild);
// catch cases where tab title can change
document.addEventListener("TabAttrModified", updateLabel, false);
document.addEventListener('TabSelect', updateLabel, false);
document.addEventListener('TabOpen', updateLabel, false);
document.addEventListener('TabClose', updateLabel, false);
document.addEventListener('load', updateLabel, false);
document.addEventListener("DOMContentLoaded", updateLabel, false);
updateLabel();
function updateLabel() {
setTimeout(function(){
titlebarlabel.setAttribute("value",gBrowser.selectedBrowser.contentTitle);
},100);
}
var {Services} = Components.utils.import("resource://gre/modules/Services.jsm", {});
var sss = Components.classes["@mozilla.org/content/style-sheet-service;1"].getService(Components.interfaces.nsIStyleSheetService);
var customcssforfx_appbutton_in_titlebar_code = '';
if(customcssforfx_appbutton_in_titlebar == 1)
customcssforfx_appbutton_in_titlebar_code = ' \
#tab_label_in_titlebar_box { \
padding-inline-start: 95px !important; \
} \
';
else if(customcssforfx_appbutton_in_titlebar == 2)
customcssforfx_appbutton_in_titlebar_code = ' \
#tab_label_in_titlebar_box { \
padding-inline-start: 40px !important; \
} \
';
var adjust_tabs_toolbar_position_code = ' \
#toolbar-menubar { \
padding-top: 20px !important; \
} \
#toolbar-menubar[inactive="true"] + #TabsToolbar { \
padding-top: 26px !important; \
} \
.titlebar-spacer[type="pre-tabs"], \
.titlebar-spacer[type="post-tabs"] { \
display: none !important; \
} \
#main-window:not([sizemode="fullscreen"]) .titlebar-buttonbox-container { \
position: absolute !important; \
display: flex !important; \
top: 0 !important; \
right: 0 !important; \
}\
#main-window:not([sizemode="fullscreen"])[sizemode="maximized"] .titlebar-buttonbox-container { \
top: 8px !important; \
}\
#main-window[tabsintitlebar] #TabsToolbar { \
padding-inline-start: 2px !important; \
} \
';
if(customcssforfx_tabs_position == 2)
adjust_tabs_toolbar_position_code = ' \
#toolbar-menubar { \
position: absolute !important; \
display: flex !important; \
top: 0 !important; \
right: 0px !important; \
} \
#main-window:not([sizemode="fullscreen"])[sizemode="maximized"] #toolbar-menubar { \
top: 8px !important; \
}\
';
var uri = Services.io.newURI("data:text/css;charset=utf-8," + encodeURIComponent('\
\
#tab_label_in_titlebar_box { \
position: absolute !important; \
display: flex !important; \
}\
'+adjust_tabs_toolbar_position_code+'\
'+customcssforfx_appbutton_in_titlebar_code+'\
\
'), null, null);
sss.loadAndRegisterSheet(uri, sss.AGENT_SHEET);
} catch(e) {}
}()); |
Beta Was this translation helpful? Give feedback.
-
It works until the tab title reaches a certain length. For an extreme example check Lopadotemachoselachogaleokranioleipsanodrim…. I do not like, though, that the menu is to the right, now. I’d actually prefer that the tab title fully disappeared when the menu was blended in, but I did not get a working method to set a width of 100%. Something must be not well adjusted or even wrong in my style (I’ve only added Actually I loved the way it worked in Firefox versions before v.57 with an addon Hide Caption Titlebar Plus, but this was more sophisticated. I do not know whether this still is possible with Webextension API, but if you are interested in the code, download it: hide_caption_titlebar_plus_4-4.1.1-fx.xpi (I may delete this in the future). It did more than the menu stuff and has quite a lot style files, but in regards to this it was a flying layer, and the tab title was set after the menu. |
Beta Was this translation helpful? Give feedback.
-
I posted a new file with more configuration options. Hiding the label, when menubar is visible, would defeat the purpose of this feature in my opinion. Maybe moving title and menubar a bit and decreasing their top and bottom padding/margin/'space' values can lead to a more acceptable result? Test the new file, once you have some free time. ;-)
|
Beta Was this translation helpful? Give feedback.
-
Nice. I opted for 1 twice.
I assume, no, I am sure you tested with a default profile, and it works there. For me there are small glitches, but these will come from custom style settings on my side, and it will just need some time to adjust these. |
Beta Was this translation helpful? Give feedback.
-
You are right, I did not run many different tests.
Many CustomCSSforFx might interfere and create glitches. Further more testing became somehow harder than usual. Changes sometime only seem to work after clearing Startup cache and restarting Firefox (closing, starting, not via "Restart" button). |
Beta Was this translation helpful? Give feedback.
-
I wanted to say that noone can expect you to test for every possible constellation. This said this works for me: #main-window #titlebar #tab_label_in_titlebar {
margin-top: 4px !important;
}
#tab_label_in_titlebar_box {
z-index: 6; /* larger by 1 than for menu */
/* position: absolute;/* already set in script */
}
#titlebar #toolbar-menubar #menubar-items {
background-color: var(--lwt-accent-color);
background-image: var(--lwt-header-image);
padding: 5px;
margin-top: 10px;
position: relative; /* for z-index */
z-index: 5; /* larger by 1 than in a custom style for URL bar colouring */
} The margins settings are due to other adjustments. The z-index stuff is in reaction to using the style you can find in this forum posting written by me in Camp Firefox.
Didn’t notice this yet, but I had to notice that temporal style adjustments that work instantly in devtools sometimes do afterwards only work with increasing the specifity of rules, sometimes even |
Beta Was this translation helpful? Give feedback.
-
This shows how rarely I use the panel menu so this took a while getting aware of it: With enabled script this menu is not displayed for me. As mentioned above: var customcssforfx_appbutton_in_titlebar = 1; Update 1: I have no solution, but noticed that this is a consequence of setting the z-index and maybe the position property. Update 2: The isssue is only caused by this rule: #tab_label_in_titlebar_box {
z-index: 6;
} I had to remove it and following this also changing the other one to #titlebar #toolbar-menubar #menubar-items {
background-color: transparent;
position: relative; /* for z-index */
z-index: 5; /* larger by 1 than in a custom style for URL bar colouring */
} Note the transparent background-color. |
Beta Was this translation helpful? Give feedback.
-
Tab title in title bar (+ CustomCSSforFx compatibility)
See #54 (comment)
Script:
https://github.com/Aris-t2/CustomJSforFx/blob/master/scripts/tab_label_in_titlebar.uc.js
Use these two options inside the script to configure script for CustomCSSforFx setup.
Examples:
Default setup / CustomCSSforFx not installed;
var customcssforfx_tabs_not_on_top = 0; // var customcssforfx_appbutton_in_titlebar = 0;
CustomCSSforFx installed / tabs on top / (big) appbutton in titlebar
var customcssforfx_tabs_not_on_top = 1; // var customcssforfx_appbutton_in_titlebar = 1;
CustomCSSforFx installed / tabs not on top / (big) appbutton in titlebar
var customcssforfx_tabs_not_on_top = 2; // var customcssforfx_appbutton_in_titlebar = 1;
Merry Christmas and a happy new year.
Beta Was this translation helpful? Give feedback.
All reactions