Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added: option to show tab subtitle with URL #1924

Open
wants to merge 2 commits into
base: v5
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/_locales/dict.setup-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2666,6 +2666,10 @@ Przykłady: "*", "ctrl+$", "ctrl+alt+g"`,
zh_TW: '分頁切換間的最小延遲(毫秒)',
ja: 'タブ切り替え間の最小遅延(ミリ秒)',
},
'settings.tabs_show_subtitle': {
en: 'Show tab subtitle with URL',
ru: 'Показывать подзаголовок вкладки с URL',
},

// - New tab position
'settings.move_new_tab_pin': {
Expand Down
1 change: 1 addition & 0 deletions src/defaults/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ export const DEFAULT_SETTINGS: SettingsState = {
tabWarmupOnHover: true,
tabSwitchDelay: 0,
forceDiscard: true,
showTabSubtitle: false,

// New tab position
moveNewTabPin: 'start',
Expand Down
4 changes: 4 additions & 0 deletions src/page.setup/components/settings.tabs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ section(ref="el")
//- label="settings.tab_warmup_on_hover"
//- v-model:value="Settings.state.tabWarmupOnHover"
//- @update:value="Settings.saveDebounced(150)")
ToggleField(
label="settings.tabs_show_subtitle"
v-model:value="Settings.state.showTabSubtitle"
@update:value="Settings.saveDebounced(150)")
NumField.-inline(
label="settings.tabs_switch_delay"
v-model:value="Settings.state.tabSwitchDelay"
Expand Down
3 changes: 3 additions & 0 deletions src/sidebar/components/tab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@
@blur="onCustomTitleBlur"
@keydown="onCustomTitlteKD")
.title(v-else) {{tab.reactive.customTitle ?? tab.reactive.title}}
.subtitle(
v-if="tab.reactive.url && Settings.state.showTabSubtitle"
) {{ tab.reactive.url.replace(/^https?:\/\//, '') }}
.close(
v-if="!iconOnly && Settings.state.tabRmBtn !== 'none'"
@mousedown.stop="onMouseDownClose"
Expand Down
20 changes: 20 additions & 0 deletions src/styles/themes/proton/sidebar/tab.styl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
--tabs-margin: var(--general-margin)
--tabs-indent: 10px
--tabs-font: rem(15) sans-serif
--tabs-subtitle-font: rem(12) sans-serif
--tabs-count-font: rem(9) sans-serif
--tabs-border-radius: var(--general-border-radius)
--tabs-inner-gap: 5px
Expand Down Expand Up @@ -576,6 +577,25 @@
.Tab[data-active="true"] .title
color: var(--tabs-activated-fg)

// ---
// -- Subtitle
// -
.Tab .subtitle{
position: relative
color: var(--tabs-normal-fg)
white-space: nowrap
overflow: hidden
transition: transform var(--d-fast)
font: var(--tabs-subtitle-font)
opacity: 0.7
}

.Tab[data-audible="true"] .t-box .subtitle,
.Tab[data-muted="true"] .t-box .subtitle,
.Tab[data-paused="true"] .t-box .subtitle{
transform: translateX(var(--audio-btn-offset));
}

// ---
// -- Container highlight
// -
Expand Down
1 change: 1 addition & 0 deletions src/types/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ export interface SettingsState {
tabWarmupOnHover: boolean
tabSwitchDelay: number
forceDiscard: boolean
showTabSubtitle: boolean

// New tab position
moveNewTabPin: (typeof SETTINGS_OPTIONS.moveNewTabPin)[number]
Expand Down