|
| 1 | +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- |
| 2 | + * This Source Code Form is subject to the terms of the Mozilla Public |
| 3 | + * License, v. 2.0. If a copy of the MPL was not distributed with this |
| 4 | + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
| 5 | +const { css } = ChromeUtils.importESModule("chrome://glide/content/utils/dedent.mjs"); |
| 6 | + |
| 7 | +/* |
| 8 | + * Contains CSS snippets for manipulating the Browser UI. |
| 9 | + * Obtained from here: https://github.com/MrOtherGuy/firefox-csshacks |
| 10 | + */ |
| 11 | + |
| 12 | +export const autohide_tabstoolbar_v2 = css` |
| 13 | + /* Source file https://github.com/MrOtherGuy/firefox-csshacks/tree/master/chrome/autohide_tabstoolbar_v2.css made available under Mozilla Public License v. 2.0 |
| 14 | + See the above repository for updates as well as full license text. */ |
| 15 | +
|
| 16 | + /* Requires Firefox 133 */ |
| 17 | +
|
| 18 | + :root { |
| 19 | + --uc-tabs-hide-animation-duration: 48ms; |
| 20 | + --uc-tabs-hide-animation-delay: 200ms; |
| 21 | + /* Modification keeping the default behavior and setting a custom collapse width */ |
| 22 | + --uc-tab-collapsed-width: var(--tab-collapsed-width); |
| 23 | + } |
| 24 | +
|
| 25 | + @media -moz-pref("sidebar.verticalTabs") { |
| 26 | + #sidebar-main { |
| 27 | + overflow: visible !important; |
| 28 | + max-width: var(--uc-tab-collapsed-width) !important; |
| 29 | + z-index: var(--browser-area-z-index-toolbox-while-animating); |
| 30 | + transition: z-index 0s linear var(--uc-tabs-hide-duration); |
| 31 | + background: inherit; |
| 32 | + } |
| 33 | + sidebar-main { |
| 34 | + --tab-pinned-horizontal-count: 5; /* This needs to match whatever is used in sidebar-main.css - currently 5 */ |
| 35 | + background: inherit; |
| 36 | + overflow: hidden; |
| 37 | + min-width: var(--uc-tab-collapsed-width); |
| 38 | + transition: min-width var(--uc-tabs-hide-animation-duration) ease-out |
| 39 | + var(--uc-tabs-hide-animation-delay); |
| 40 | + border-inline: 0.01px solid var(--chrome-content-separator-color); |
| 41 | + border-inline-width: 0 0.01px; |
| 42 | + &:is([sidebar-positionend], [positionend]) { |
| 43 | + transition-property: min-width, transform; |
| 44 | + border-inline-width: 0.01px 0; |
| 45 | + } |
| 46 | + } |
| 47 | + :where(#navigator-toolbox[movingtab] + #browser > #sidebar-main) |
| 48 | + > sidebar-main[expanded], |
| 49 | + sidebar-main[expanded]:hover { |
| 50 | + min-width: calc( |
| 51 | + var(--tab-pinned-horizontal-count) * |
| 52 | + var(--tab-pinned-min-width-expanded) + 2 * |
| 53 | + var(--tab-pinned-container-margin-inline-expanded) + 1px |
| 54 | + ); |
| 55 | + transition-delay: 0ms !important; |
| 56 | + &:is([sidebar-positionend], [positionend]) { |
| 57 | + transform: translateX(calc(var(--tab-collapsed-width) - 100%)); |
| 58 | + } |
| 59 | + } |
| 60 | + #sidebar-wrapper { |
| 61 | + background: inherit; |
| 62 | + } |
| 63 | + } |
| 64 | + @media not -moz-pref("sidebar.verticalTabs") { |
| 65 | + :root:not([customizing], [chromehidden~="menubar"]) |
| 66 | + #navigator-toolbox:has(> :is(#toolbar-menubar, #TabsToolbar):hover), |
| 67 | + :root:not([customizing], [chromehidden~="menubar"]) #TabsToolbar { |
| 68 | + margin-bottom: calc( |
| 69 | + 0px - 2 * var(--tab-block-margin) - var(--tab-min-height) |
| 70 | + ); |
| 71 | + } |
| 72 | + #toolbar-menubar:is([autohide=""], [autohide="true"]) |
| 73 | + + #TabsToolbar:not(:hover) { |
| 74 | + -moz-window-dragging: no-drag !important; |
| 75 | + } |
| 76 | + #toolbar-menubar:is([autohide=""], [autohide="true"]) |
| 77 | + + #TabsToolbar:not(:hover, [customizing])::before { |
| 78 | + content: ""; |
| 79 | + display: flex; |
| 80 | + position: absolute; |
| 81 | + height: 6px; |
| 82 | + width: 100vw; |
| 83 | + visibility: visible; |
| 84 | + } |
| 85 | + #navigator-toolbox { |
| 86 | + transition: margin-bottom var(--uc-tabs-hide-animation-duration) ease-out |
| 87 | + var(--uc-tabs-hide-animation-delay) !important; |
| 88 | + --browser-area-z-index-toolbox: 3; |
| 89 | + } |
| 90 | + #TabsToolbar:not([customizing]) { |
| 91 | + visibility: hidden; |
| 92 | + position: relative; |
| 93 | + z-index: 1; |
| 94 | + transition: |
| 95 | + visibility 0ms linear var(--uc-tabs-hide-animation-delay), |
| 96 | + margin-bottom var(--uc-tabs-hide-animation-duration) ease-out |
| 97 | + var(--uc-tabs-hide-animation-delay) !important; |
| 98 | + } |
| 99 | + #mainPopupSet:has( |
| 100 | + > #tab-group-editor > [panelopen], |
| 101 | + > #tabgroup-preview-panel[panelopen] |
| 102 | + ) |
| 103 | + ~ #navigator-toolbox, |
| 104 | + #navigator-toolbox:has(> :is(#toolbar-menubar, #TabsToolbar):hover), |
| 105 | + #navigator-toolbox[movingtab] { |
| 106 | + transition-delay: 0s !important; |
| 107 | + margin-bottom: calc( |
| 108 | + 0px - 2 * var(--tab-block-margin) - var(--tab-min-height) |
| 109 | + ); |
| 110 | + > #TabsToolbar { |
| 111 | + visibility: visible; |
| 112 | + margin-bottom: 0px; |
| 113 | + transition-delay: 0ms, 0ms !important; |
| 114 | + } |
| 115 | + } |
| 116 | + @media -moz-pref("userchrome.autohidetabs.show-while-inactive.enabled") { |
| 117 | + #navigator-toolbox:-moz-window-inactive { |
| 118 | + margin-bottom: calc( |
| 119 | + 0px - 2 * var(--tab-block-margin) - var(--tab-min-height) |
| 120 | + ); |
| 121 | + > #TabsToolbar { |
| 122 | + visibility: visible; |
| 123 | + margin-bottom: 0px; |
| 124 | + } |
| 125 | + } |
| 126 | + } |
| 127 | + /* These rules make sure that height of tabs toolbar doesn't exceed tab-min-height */ |
| 128 | + #tabbrowser-tabs:not([secondarytext-unsupported]) .tab-label-container { |
| 129 | + max-height: var(--tab-min-height); |
| 130 | + } |
| 131 | + .tab-label { |
| 132 | + line-height: 20px !important; |
| 133 | + } |
| 134 | + :root[uidensity="compact"] .tab-label { |
| 135 | + line-height: 18px !important; |
| 136 | + } |
| 137 | + } |
| 138 | +`; |
| 139 | + |
| 140 | +export const hide_tabs_toolbar_v2 = css` |
| 141 | + /* Source file https://github.com/MrOtherGuy/firefox-csshacks/tree/master/chrome/hide_tabs_toolbar_v2.css made available under Mozilla Public License v. 2.0 |
| 142 | + See the above repository for updates as well as full license text. */ |
| 143 | +
|
| 144 | + /* This requires Firefox 133+ to work */ |
| 145 | +
|
| 146 | + @media -moz-pref("sidebar.verticalTabs") { |
| 147 | + #sidebar-launcher-splitter, |
| 148 | + #sidebar-main { |
| 149 | + visibility: collapse; |
| 150 | + } |
| 151 | + } |
| 152 | + @media -moz-pref("userchrome.force-window-controls-on-left.enabled") { |
| 153 | + #nav-bar > .titlebar-buttonbox-container { |
| 154 | + order: -1 !important; |
| 155 | + > .titlebar-buttonbox { |
| 156 | + flex-direction: row-reverse; |
| 157 | + } |
| 158 | + } |
| 159 | + } |
| 160 | + @media not -moz-pref("sidebar.verticalTabs") { |
| 161 | + #TabsToolbar:not([customizing]) { |
| 162 | + visibility: collapse; |
| 163 | + } |
| 164 | + :root[sizemode="fullscreen"] #nav-bar > .titlebar-buttonbox-container { |
| 165 | + display: flex !important; |
| 166 | + } |
| 167 | + :root[customtitlebar] |
| 168 | + #toolbar-menubar:is([autohide=""], [autohide="true"]) |
| 169 | + ~ #nav-bar { |
| 170 | + > .titlebar-buttonbox-container { |
| 171 | + display: flex !important; |
| 172 | + } |
| 173 | + :root[sizemode="normal"] & { |
| 174 | + > .titlebar-spacer { |
| 175 | + display: flex !important; |
| 176 | + } |
| 177 | + } |
| 178 | + :root[sizemode="maximized"] & { |
| 179 | + > .titlebar-spacer[type="post-tabs"] { |
| 180 | + display: flex !important; |
| 181 | + } |
| 182 | + @media -moz-pref("userchrome.force-window-controls-on-left.enabled"), |
| 183 | + (-moz-gtk-csd-reversed-placement), |
| 184 | + (-moz-platform: macos) { |
| 185 | + > .titlebar-spacer[type="post-tabs"] { |
| 186 | + display: none !important; |
| 187 | + } |
| 188 | + > .titlebar-spacer[type="pre-tabs"] { |
| 189 | + display: flex !important; |
| 190 | + } |
| 191 | + } |
| 192 | + } |
| 193 | + } |
| 194 | + } |
| 195 | +`; |
0 commit comments