Skip to content
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
537 changes: 537 additions & 0 deletions Sources/CodexBar/CompactOverviewRow.swift

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions Sources/CodexBar/Localization.swift
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,10 @@ func codexBarLocalizedResourceLocale() -> Locale {
return codexBarLocale(forLanguage: bundleURL.deletingPathExtension().lastPathComponent)
}

func codexBarUsesRightToLeftLayout() -> Bool {
Locale.Language(identifier: codexBarLocalizedResourceLocale().identifier).characterDirection == .rightToLeft
}

private func codexBarLocale(forLanguage language: String) -> Locale {
guard !language.isEmpty else { return .current }
let normalized = language.lowercased()
Expand Down
22 changes: 18 additions & 4 deletions Sources/CodexBar/MenuCardView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@ import AppKit
import CodexBarCore
import SwiftUI

extension View {
func usageMenuCardProviderTitleStyle() -> some View {
self
.font(.headline)
.fontWeight(.semibold)
}

func usageMenuCardMetricTitleStyle() -> some View {
self
.font(.body)
.fontWeight(.medium)
}
}

/// SwiftUI card used inside the NSMenu to mirror Apple's rich menu panels.
struct UsageMenuCardView: View {
struct Model {
Expand Down Expand Up @@ -187,7 +201,7 @@ struct UsageMenuCardView: View {
@Environment(\.menuItemHighlighted) private var isHighlighted
@Environment(\.menuCardRefreshMonitor) private var refreshMonitor

static func popupMetricTitle(provider: UsageProvider, metric: Model.Metric) -> String {
nonisolated static func popupMetricTitle(provider: UsageProvider, metric: Model.Metric) -> String {
if provider == .openrouter, metric.id == "primary" {
return L("API key limit")
}
Expand Down Expand Up @@ -311,8 +325,8 @@ private struct UsageMenuCardHeaderView: View {
var body: some View {
VStack(alignment: .leading, spacing: UsageMenuCardLayout.headerLineSpacing) {
HStack(alignment: .firstTextBaseline, spacing: UsageMenuCardLayout.headerColumnSpacing) {
Text(self.model.providerName).font(.headline)
.fontWeight(.semibold)
Text(self.model.providerName)
.usageMenuCardProviderTitleStyle()
.lineLimit(1).truncationMode(.tail).layoutPriority(1)
Spacer()
Text(self.model.email).font(.subheadline)
Expand Down Expand Up @@ -656,7 +670,7 @@ private struct UsageMenuCardUsageContentView: View {
}

var body: some View {
VStack(alignment: .leading, spacing: 12) {
VStack(alignment: .leading, spacing: UsageMenuCardLayout.metricSpacing) {
if let split = self.doubaoSplitMetrics {
if !split.coding.isEmpty {
self.groupHeader("Coding Plan")
Expand Down
17 changes: 17 additions & 0 deletions Sources/CodexBar/PreferencesMenuPane.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ struct MenuPane: View {
@Bindable var settings: SettingsStore
@Bindable var store: UsageStore

static func compactOverviewAvailable(mergeIcons: Bool) -> Bool {
mergeIcons
}

var body: some View {
Form {
Section {
Expand Down Expand Up @@ -45,6 +49,19 @@ struct MenuPane: View {
}

Section {
SettingsMenuPicker(
selection: self.$settings.mergedOverviewLayout,
options: MenuSettingsMenuOptions.mergedOverviewLayouts,
label: {
SettingsRowLabel(
L("overview_layout_title"),
subtitle: L("overview_layout_subtitle"))
},
optionLabel: { layout in
Text(layout.label)
})
.disabled(!Self.compactOverviewAvailable(mergeIcons: self.settings.mergeIcons))

Toggle(L("show_provider_changelog_links_title"), isOn: self.$settings.providerChangelogLinksEnabled)

Toggle(isOn: self.$settings.showOptionalCreditsAndExtraUsage) {
Expand Down
1 change: 1 addition & 0 deletions Sources/CodexBar/PreferencesMenuPicker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ enum MenuBarSettingsMenuOptions {
}

enum MenuSettingsMenuOptions {
static let mergedOverviewLayouts = MergedOverviewLayout.allCases
static let weeklyProgressWorkDays: [Int?] = [nil, 4, 5, 7]
static let multiAccountLayouts = MultiAccountMenuLayout.allCases
static let usageBarsFill = UsageBarsFillOption.allCases
Expand Down
7 changes: 7 additions & 0 deletions Sources/CodexBar/Resources/ar.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,13 @@
"multi_account_layout_segmented" = "مقسم";
"multi_account_layout_stacked" = "مكدس";
"overview_tab_providers_title" = "نظرة عامة على مزودي تبويب";
"overview_layout_title" = "تخطيط النظرة العامة";
"overview_layout_subtitle" = "اختر مقدار المعلومات التي تعرضها النظرة العامة.";
"overview_layout_detailed" = "مفصل";
"overview_layout_compact" = "المزوّدون والمقاييس والأشرطة";
"overview_layout_provider_bars" = "المزوّدون والأشرطة";
"overview_layout_bars_only" = "الأشرطة فقط";
"overview_compact_no_bars" = "لا توجد أشرطة استخدام";
"configure" = "تكوين...";
"overview_enable_merge_icons_hint" = "تفعيل أيقونات الدمج لتكوين مزودي تبويب النظرة العامة.";
"overview_no_providers_hint" = "لا يوجد مزودون مفعلون متاحون للنظرة العامة.";
Expand Down
7 changes: 7 additions & 0 deletions Sources/CodexBar/Resources/ca.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,13 @@
"multi_account_layout_segmented" = "Segmentat";
"multi_account_layout_stacked" = "Apilat";
"overview_tab_providers_title" = "Proveïdors de la pestanya Resum";
"overview_layout_title" = "Disseny del Resum";
"overview_layout_subtitle" = "Trieu quanta informació mostra el Resum.";
"overview_layout_detailed" = "Detallat";
"overview_layout_compact" = "Proveïdors, mètriques i barres";
"overview_layout_provider_bars" = "Proveïdors i barres";
"overview_layout_bars_only" = "Només barres";
"overview_compact_no_bars" = "No hi ha barres d’ús";
"configure" = "Configureu…";
"overview_enable_merge_icons_hint" = "Activeu Combina les icones per configurar els proveïdors de la pestanya Resum.";
"overview_no_providers_hint" = "No hi ha proveïdors activats disponibles per al Resum.";
Expand Down
7 changes: 7 additions & 0 deletions Sources/CodexBar/Resources/de.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,13 @@
"multi_account_layout_segmented" = "Segmentiert";
"multi_account_layout_stacked" = "Gestapelt";
"overview_tab_providers_title" = "Anbieter von Übersichtsregisterkarten";
"overview_layout_title" = "Übersichtslayout";
"overview_layout_subtitle" = "Wählen Sie aus, wie viele Informationen die Übersicht anzeigt.";
"overview_layout_detailed" = "Detailliert";
"overview_layout_compact" = "Anbieter, Metriken und Balken";
"overview_layout_provider_bars" = "Anbieter und Balken";
"overview_layout_bars_only" = "Nur Balken";
"overview_compact_no_bars" = "Keine Nutzungsbalken";
"configure" = "Konfigurieren…";
"overview_enable_merge_icons_hint" = "Aktivieren Sie \"Symbole zusammenführen\", um Anbieter für die Registerkarte \"Übersicht\" zu konfigurieren.";
"overview_no_providers_hint" = "Für die Übersicht sind keine aktivierten Anbieter verfügbar.";
Expand Down
7 changes: 7 additions & 0 deletions Sources/CodexBar/Resources/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,13 @@
"multi_account_layout_segmented" = "Segmented";
"multi_account_layout_stacked" = "Stacked";
"overview_tab_providers_title" = "Overview providers";
"overview_layout_title" = "Overview layout";
"overview_layout_subtitle" = "Choose how much information Overview shows.";
"overview_layout_detailed" = "Detailed";
"overview_layout_compact" = "Providers, metrics & bars";
"overview_layout_provider_bars" = "Providers & bars";
"overview_layout_bars_only" = "Bars only";
"overview_compact_no_bars" = "No usage bars";
"configure" = "Configure…";
"overview_enable_merge_icons_hint" = "Turn on Merge icons to configure Overview providers.";
"overview_no_providers_hint" = "No enabled providers available for Overview.";
Expand Down
7 changes: 7 additions & 0 deletions Sources/CodexBar/Resources/es.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,13 @@
"multi_account_layout_segmented" = "Segmentado";
"multi_account_layout_stacked" = "Apilado";
"overview_tab_providers_title" = "Proveedores de la pestaña Resumen";
"overview_layout_title" = "Diseño de Resumen";
"overview_layout_subtitle" = "Elige cuánta información muestra Resumen.";
"overview_layout_detailed" = "Detallado";
"overview_layout_compact" = "Proveedores, métricas y barras";
"overview_layout_provider_bars" = "Proveedores y barras";
"overview_layout_bars_only" = "Solo barras";
"overview_compact_no_bars" = "No hay barras de uso";
"configure" = "Configurar…";
"overview_enable_merge_icons_hint" = "Activa Combinar iconos para configurar los proveedores de la pestaña Resumen.";
"overview_no_providers_hint" = "No hay proveedores activados disponibles para Resumen.";
Expand Down
7 changes: 7 additions & 0 deletions Sources/CodexBar/Resources/fa.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,13 @@
"multi_account_layout_segmented" = "بخش بندی شده";
"multi_account_layout_stacked" = "انباشته شده";
"overview_tab_providers_title" = "ارائه دهندگان تب مرور کلی";
"overview_layout_title" = "چیدمان نمای کلی";
"overview_layout_subtitle" = "میزان اطلاعات نمایش‌داده‌شده در نمای کلی را انتخاب کنید.";
"overview_layout_detailed" = "با جزئیات";
"overview_layout_compact" = "ارائه‌دهندگان، معیارها و نوارها";
"overview_layout_provider_bars" = "ارائه‌دهندگان و نوارها";
"overview_layout_bars_only" = "فقط نوارها";
"overview_compact_no_bars" = "نوار مصرفی وجود ندارد";
"configure" = "پیکربندی کن...";
"overview_enable_merge_icons_hint" = "فعال سازی Merge Icons برای پیکربندی ارائه دهندگان تب نمای کلی.";
"overview_no_providers_hint" = "هیچ ارائه دهنده فعالی برای مرور کلی در دسترس نیست.";
Expand Down
7 changes: 7 additions & 0 deletions Sources/CodexBar/Resources/fr.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,13 @@
"multi_account_layout_segmented" = "Segmenté";
"multi_account_layout_stacked" = "Empilé";
"overview_tab_providers_title" = "Fournisseurs d'onglets de présentation";
"overview_layout_title" = "Disposition de la vue d’ensemble";
"overview_layout_subtitle" = "Choisissez la quantité d’informations affichée dans la vue d’ensemble.";
"overview_layout_detailed" = "Détaillée";
"overview_layout_compact" = "Fournisseurs, métriques et barres";
"overview_layout_provider_bars" = "Fournisseurs et barres";
"overview_layout_bars_only" = "Barres uniquement";
"overview_compact_no_bars" = "Aucune barre d’utilisation";
"configure" = "Configurer…";
"overview_enable_merge_icons_hint" = "Activez Fusionner les icônes pour configurer les fournisseurs d'onglets Présentation.";
"overview_no_providers_hint" = "Aucun fournisseur activé disponible pour la présentation.";
Expand Down
7 changes: 7 additions & 0 deletions Sources/CodexBar/Resources/gl.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,13 @@
"multi_account_layout_segmented" = "Segmentado";
"multi_account_layout_stacked" = "Apilado";
"overview_tab_providers_title" = "Provedores da lapela Resumo";
"overview_layout_title" = "Deseño do Resumo";
"overview_layout_subtitle" = "Escolle canta información mostra o Resumo.";
"overview_layout_detailed" = "Detallado";
"overview_layout_compact" = "Provedores, métricas e barras";
"overview_layout_provider_bars" = "Provedores e barras";
"overview_layout_bars_only" = "Só barras";
"overview_compact_no_bars" = "Non hai barras de uso";
"configure" = "Configurar…";
"overview_enable_merge_icons_hint" = "Activa Combinar as iconas para configurar os provedores da lapela Resumo.";
"overview_no_providers_hint" = "Non hai provedores activados dispoñibles para o Resumo.";
Expand Down
7 changes: 7 additions & 0 deletions Sources/CodexBar/Resources/id.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,13 @@
"multi_account_layout_segmented" = "Tersegmentasi";
"multi_account_layout_stacked" = "Bertumpuk";
"overview_tab_providers_title" = "Penyedia tab ikhtisar";
"overview_layout_title" = "Tata letak Ikhtisar";
"overview_layout_subtitle" = "Pilih seberapa banyak informasi yang ditampilkan Ikhtisar.";
"overview_layout_detailed" = "Terperinci";
"overview_layout_compact" = "Penyedia, metrik, dan bilah";
"overview_layout_provider_bars" = "Penyedia dan bilah";
"overview_layout_bars_only" = "Hanya bilah";
"overview_compact_no_bars" = "Tidak ada bilah penggunaan";
"configure" = "Konfigurasi…";
"overview_enable_merge_icons_hint" = "Aktifkan Gabung Ikon untuk mengonfigurasi penyedia tab Ikhtisar.";
"overview_no_providers_hint" = "Tidak ada penyedia aktif untuk Ikhtisar.";
Expand Down
7 changes: 7 additions & 0 deletions Sources/CodexBar/Resources/it.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,13 @@
"multi_account_layout_segmented" = "Segmentato";
"multi_account_layout_stacked" = "Impilato";
"overview_tab_providers_title" = "Provider della scheda Panoramica";
"overview_layout_title" = "Layout Panoramica";
"overview_layout_subtitle" = "Scegli quante informazioni mostrare in Panoramica.";
"overview_layout_detailed" = "Dettagliato";
"overview_layout_compact" = "Provider, metriche e barre";
"overview_layout_provider_bars" = "Provider e barre";
"overview_layout_bars_only" = "Solo barre";
"overview_compact_no_bars" = "Nessuna barra di utilizzo";
"configure" = "Configura…";
"overview_enable_merge_icons_hint" = "Abilita Unisci icone per configurare i provider della scheda Panoramica.";
"overview_no_providers_hint" = "Nessun provider attivo disponibile per Panoramica.";
Expand Down
7 changes: 7 additions & 0 deletions Sources/CodexBar/Resources/ja.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,13 @@
"multi_account_layout_segmented" = "セグメント";
"multi_account_layout_stacked" = "スタック";
"overview_tab_providers_title" = "概要タブのプロバイダ";
"overview_layout_title" = "概要のレイアウト";
"overview_layout_subtitle" = "概要に表示する情報量を選択します。";
"overview_layout_detailed" = "詳細";
"overview_layout_compact" = "プロバイダー、指標、バー";
"overview_layout_provider_bars" = "プロバイダーとバー";
"overview_layout_bars_only" = "バーのみ";
"overview_compact_no_bars" = "使用量バーはありません";
"configure" = "設定…";
"overview_enable_merge_icons_hint" = "概要タブのプロバイダを設定するには「アイコンを統合」を有効にしてください。";
"overview_no_providers_hint" = "概要に使用できる有効なプロバイダがありません。";
Expand Down
7 changes: 7 additions & 0 deletions Sources/CodexBar/Resources/ko.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,13 @@
"multi_account_layout_segmented" = "분할";
"multi_account_layout_stacked" = "쌓기";
"overview_tab_providers_title" = "개요 탭 공급자";
"overview_layout_title" = "개요 레이아웃";
"overview_layout_subtitle" = "개요에 표시할 정보의 양을 선택합니다.";
"overview_layout_detailed" = "자세히";
"overview_layout_compact" = "제공자, 지표 및 막대";
"overview_layout_provider_bars" = "제공자 및 막대";
"overview_layout_bars_only" = "막대만";
"overview_compact_no_bars" = "사용량 막대 없음";
"configure" = "구성…";
"overview_enable_merge_icons_hint" = "개요 탭 공급자를 구성하려면 아이콘 병합을 사용하세요.";
"overview_no_providers_hint" = "개요에 사용할 수 있는 활성화된 공급자가 없습니다.";
Expand Down
7 changes: 7 additions & 0 deletions Sources/CodexBar/Resources/nl.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,13 @@
"multi_account_layout_segmented" = "Gesegmenteerd";
"multi_account_layout_stacked" = "Gestapeld";
"overview_tab_providers_title" = "Overzicht tabblad aanbieders";
"overview_layout_title" = "Overzichtsindeling";
"overview_layout_subtitle" = "Kies hoeveel informatie het overzicht toont.";
"overview_layout_detailed" = "Gedetailleerd";
"overview_layout_compact" = "Providers, metrieken en balken";
"overview_layout_provider_bars" = "Providers en balken";
"overview_layout_bars_only" = "Alleen balken";
"overview_compact_no_bars" = "Geen gebruiksbalken";
"configure" = "Configureer…";
"overview_enable_merge_icons_hint" = "Schakel Pictogrammen samenvoegen in om de providers van tabbladen Overzicht te configureren.";
"overview_no_providers_hint" = "Er zijn geen ingeschakelde providers beschikbaar voor Overzicht.";
Expand Down
7 changes: 7 additions & 0 deletions Sources/CodexBar/Resources/pl.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,13 @@
"multi_account_layout_segmented" = "Segmentowy";
"multi_account_layout_stacked" = "Ułożony";
"overview_tab_providers_title" = "Dostawcy zakładki Przegląd";
"overview_layout_title" = "Układ Przeglądu";
"overview_layout_subtitle" = "Wybierz, ile informacji ma wyświetlać Przegląd.";
"overview_layout_detailed" = "Szczegółowy";
"overview_layout_compact" = "Dostawcy, metryki i paski";
"overview_layout_provider_bars" = "Dostawcy i paski";
"overview_layout_bars_only" = "Tylko paski";
"overview_compact_no_bars" = "Brak pasków użycia";
"configure" = "Skonfiguruj…";
"overview_enable_merge_icons_hint" = "Włącz Scal ikony, aby skonfigurować dostawców zakładki Przegląd.";
"overview_no_providers_hint" = "Brak włączonych dostawców dla Przeglądu.";
Expand Down
7 changes: 7 additions & 0 deletions Sources/CodexBar/Resources/pt-BR.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,13 @@
"multi_account_layout_segmented" = "Segmentado";
"multi_account_layout_stacked" = "Empilhado";
"overview_tab_providers_title" = "Provedores da aba Visão geral";
"overview_layout_title" = "Layout da Visão geral";
"overview_layout_subtitle" = "Escolha quanta informação a Visão geral mostra.";
"overview_layout_detailed" = "Detalhado";
"overview_layout_compact" = "Provedores, métricas e barras";
"overview_layout_provider_bars" = "Provedores e barras";
"overview_layout_bars_only" = "Somente barras";
"overview_compact_no_bars" = "Sem barras de uso";
"configure" = "Configurar…";
"overview_enable_merge_icons_hint" = "Ative Mesclar Ícones para configurar provedores da aba Visão geral.";
"overview_no_providers_hint" = "Nenhum provedor ativado disponível para Visão geral.";
Expand Down
7 changes: 7 additions & 0 deletions Sources/CodexBar/Resources/ru.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,13 @@
"multi_account_layout_segmented" = "Сегментированный";
"multi_account_layout_stacked" = "Стопкой";
"overview_tab_providers_title" = "Провайдеры вкладки «Обзор»";
"overview_layout_title" = "Макет обзора";
"overview_layout_subtitle" = "Выберите, сколько информации показывать в обзоре.";
"overview_layout_detailed" = "Подробный";
"overview_layout_compact" = "Провайдеры, показатели и индикаторы";
"overview_layout_provider_bars" = "Провайдеры и индикаторы";
"overview_layout_bars_only" = "Только индикаторы";
"overview_compact_no_bars" = "Нет индикаторов использования";
"configure" = "Настроить…";
"overview_enable_merge_icons_hint" = "Включите «Объединять значки», чтобы настроить провайдеров вкладки «Обзор».";
"overview_no_providers_hint" = "Нет включённых провайдеров для обзора.";
Expand Down
7 changes: 7 additions & 0 deletions Sources/CodexBar/Resources/sv.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,13 @@
"multi_account_layout_segmented" = "Segmenterad";
"multi_account_layout_stacked" = "Staplad";
"overview_tab_providers_title" = "Leverantörer på översiktsfliken";
"overview_layout_title" = "Översiktslayout";
"overview_layout_subtitle" = "Välj hur mycket information som visas i översikten.";
"overview_layout_detailed" = "Detaljerad";
"overview_layout_compact" = "Leverantörer, mätvärden och staplar";
"overview_layout_provider_bars" = "Leverantörer och staplar";
"overview_layout_bars_only" = "Endast staplar";
"overview_compact_no_bars" = "Inga användningsstaplar";
"configure" = "Konfigurera…";
"overview_enable_merge_icons_hint" = "Aktivera Slå ihop ikoner för att konfigurera leverantörer på översiktsfliken.";
"overview_no_providers_hint" = "Inga aktiverade leverantörer är tillgängliga för översikten.";
Expand Down
7 changes: 7 additions & 0 deletions Sources/CodexBar/Resources/th.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,13 @@
"multi_account_layout_segmented" = "แบ่งกลุ่ม";
"multi_account_layout_stacked" = "ซ้อนกัน";
"overview_tab_providers_title" = "ผู้ให้บริการแท็บภาพรวม";
"overview_layout_title" = "เค้าโครงภาพรวม";
"overview_layout_subtitle" = "เลือกปริมาณข้อมูลที่จะแสดงในภาพรวม";
"overview_layout_detailed" = "แบบละเอียด";
"overview_layout_compact" = "ผู้ให้บริการ เมตริก และแถบ";
"overview_layout_provider_bars" = "ผู้ให้บริการและแถบ";
"overview_layout_bars_only" = "เฉพาะแถบ";
"overview_compact_no_bars" = "ไม่มีแถบการใช้งาน";
"configure" = "กําหนดค่า...";
"overview_enable_merge_icons_hint" = "เปิดใช้งานไอคอนผสานเพื่อกําหนดค่าผู้ให้บริการแท็บภาพรวม";
"overview_no_providers_hint" = "ไม่มีผู้ให้บริการที่เปิดใช้งานสําหรับภาพรวม";
Expand Down
Loading