Skip to content

armgit / peel

Public Imported from GitHub
0

Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.

Say when Terminal opens with another profile than new windows use

Țugui Dragoș23b55f800c61
diff --git a/Localization/Peel/Localizable.xcstrings b/Localization/Peel/Localizable.xcstrings
index f5c55889..833eba5f 100644
--- a/Localization/Peel/Localizable.xcstrings
+++ b/Localization/Peel/Localizable.xcstrings
@@ -43794,6 +43794,112 @@
}
}
},
+ "Every new window uses this theme, while Terminal opens with %@. Choose the theme again below to open with it too." : {
+ "localizations" : {
+ "cs" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Každé nové okno používá tento motiv, zatímco Terminál se otevírá s motivem %@. Chcete-li, aby se s tímto motivem i otevíral, zvolte ho níže znovu."
+ }
+ },
+ "de" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Jedes neue Fenster verwendet dieses Thema, während Terminal mit „%@“ geöffnet wird. Wähle das Thema unten erneut, damit Terminal auch damit geöffnet wird."
+ }
+ },
+ "es" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Todas las ventanas nuevas usan este tema, mientras que Terminal se abre con %@. Vuelve a elegir el tema abajo para que también se abra con él."
+ }
+ },
+ "fr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Chaque nouvelle fenêtre utilise ce thème, tandis que Terminal s’ouvre avec %@. Choisissez à nouveau ce thème ci-dessous pour que Terminal s’ouvre aussi avec lui."
+ }
+ },
+ "it" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Ogni nuova finestra usa questo tema, mentre Terminale si apre con %@. Scegli di nuovo il tema qui sotto perché Terminale si apra anche con questo."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "新規ウインドウはすべてこのテーマを使用しますが、ターミナルは“%@”で開きます。このテーマで開くようにするには、以下でテーマをもう一度選んでください。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "새로운 윈도우는 모두 이 테마를 사용하지만, 터미널은 ‘%@’(으)로 열립니다. 터미널도 이 테마로 열리게 하려면 아래에서 이 테마를 다시 선택하십시오."
+ }
+ },
+ "nl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Elk nieuw venster gebruikt dit thema, terwijl Terminal opent met %@. Kies het thema hieronder opnieuw om Terminal er ook mee te laten openen."
+ }
+ },
+ "pl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Każde nowe okno używa tego motywu, a Terminal otwiera się z motywem %@. Wybierz ten motyw ponownie poniżej, aby Terminal otwierał się również z nim."
+ }
+ },
+ "pt" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Toda nova janela usa este tema, enquanto o Terminal abre com %@. Escolha o tema de novo abaixo para abrir com ele também."
+ }
+ },
+ "ro" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Fiecare fereastră nouă folosește această temă, în timp ce Terminal se deschide cu %@. Alegeți din nou tema mai jos pentru ca Terminal să se deschidă și cu ea."
+ }
+ },
+ "ru" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Эта тема используется в каждом новом окне, а Терминал открывается с темой «%@». Выберите эту тему еще раз ниже, чтобы Терминал тоже открывался с ней."
+ }
+ },
+ "sv" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Varje nytt fönster använder det här temat, medan Terminal öppnas med %@. Välj temat igen nedan om du vill att Terminal ska öppnas med det också."
+ }
+ },
+ "tr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Her yeni pencere bu temayı kullanır, Terminal ise %@ temasıyla açılır. Terminal’in de bu temayla açılması için temayı aşağıdan yeniden seçin."
+ }
+ },
+ "uk" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Кожне нове вікно використовує цю тему, а Термінал відкривається з темою «%@». Виберіть цю тему нижче ще раз, щоб і Термінал відкривався з нею."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "每个新窗口都会使用此主题,而“终端”打开时使用的是“%@”。在下方再次选取此主题,“终端”打开时也会使用它。"
+ }
+ },
+ "zh-Hant" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "每個新視窗都會使用此主題,而「終端機」則會以「%@」打開。在下方再次選擇此主題,「終端機」也會以它打開。"
+ }
+ }
+ }
+ },
"Every tool is in the sidebar." : {
"localizations" : {
"cs" : {
diff --git a/Peel/Model/TerminalLibrary.swift b/Peel/Model/TerminalLibrary.swift
index 2427f64c..5d9e305a 100644
--- a/Peel/Model/TerminalLibrary.swift
+++ b/Peel/Model/TerminalLibrary.swift
@@ -19,6 +19,9 @@ final class TerminalLibrary {
private let home: URL
private var ledger: TerminalThemeLedger
private(set) var themeInUse: TerminalTheme?
+ /// The profile Terminal's first window opens with when it isn't the theme new windows use: Terminal keeps the two
+ /// apart, in Settings > General.
+ private(set) var opensWith: String?
private(set) var profileInUse: String?
private(set) var canPutBack = false
private(set) var isTerminalOpen = false
@@ -49,6 +52,8 @@ final class TerminalLibrary {
func refresh() {
profileInUse = settings.profileName(for: .newWindows)
themeInUse = ledger.theme(in: settings)
+ let startup = settings.profileName(for: .startup)
+ opensWith = themeInUse != nil && startup != themeInUse?.profileName ? startup : nil
canPutBack = ledger.canPutBack
isTerminalOpen = settings.isTerminalOpen
quietsLogin = HushLogin.isOn(in: home)
diff --git a/Peel/Views/Terminal/TerminalPage.swift b/Peel/Views/Terminal/TerminalPage.swift
index 7fc1296e..a7f54a25 100644
--- a/Peel/Views/Terminal/TerminalPage.swift
+++ b/Peel/Views/Terminal/TerminalPage.swift
@@ -143,11 +143,17 @@ private struct TerminalThemeInUse: View {
VStack(alignment: .leading, spacing: 6) {
Text(verbatim: terminal.themeInUse?.name ?? terminal.profileInUse ?? String(localized: Tool.terminal.title))
.font(.title3.weight(.semibold))
- Text(terminal.themeInUse == nil
- ? "Choose a theme below, and Terminal opens with it."
- : "Terminal opens with this theme, and every new window uses it.")
- .foregroundStyle(.secondary)
- .fixedSize(horizontal: false, vertical: true)
+ Group {
+ if let startup = terminal.opensWith {
+ Text("Every new window uses this theme, while Terminal opens with \(startup). Choose the theme again below to open with it too.")
+ } else if terminal.themeInUse == nil {
+ Text("Choose a theme below, and Terminal opens with it.")
+ } else {
+ Text("Terminal opens with this theme, and every new window uses it.")
+ }
+ }
+ .foregroundStyle(.secondary)
+ .fixedSize(horizontal: false, vertical: true)
FlowLayout(spacing: 8) {
Button(terminal.isTerminalOpen ? "Open a New Window" : "Open Terminal") {
terminal.openTerminal()
diff --git a/PeelTests/TerminalLibrariesTests.swift b/PeelTests/TerminalLibrariesTests.swift
index 70b30ee3..cb0adcf5 100644
--- a/PeelTests/TerminalLibrariesTests.swift
+++ b/PeelTests/TerminalLibrariesTests.swift
@@ -178,6 +178,26 @@ struct TerminalLibrariesTests {
#expect(library.options == [])
}
+ @Test func saysWhenTerminalOpensWithAProfileOtherThanNewWindows() throws {
+ let made = try MadeUpDefaults()
+ defer { made.forget() }
+ let theme = try #require(TerminalThemeCatalog.all.first)
+ let terminal = FakeTerminalSettings()
+ terminal.names = [.newWindows: theme.profileName, .startup: "Basic"]
+
+ let library = TerminalLibrary(settings: terminal, defaults: made.defaults)
+ #expect(library.themeInUse == theme)
+ #expect(library.opensWith == "Basic")
+
+ terminal.names[.startup] = theme.profileName
+ library.refresh()
+ #expect(library.opensWith == nil)
+
+ terminal.names[.startup] = nil
+ library.refresh()
+ #expect(library.opensWith == nil)
+ }
+
@Test func aRefusalIsForgottenWhenThePageGoes() throws {
let home = try madeUpHome()
defer { try? FileManager.default.removeItem(at: home) }