diff --git a/src/Resources/Locales/de_DE.axaml b/src/Resources/Locales/de_DE.axaml
index bb78b8e7c..bfee0947e 100644
--- a/src/Resources/Locales/de_DE.axaml
+++ b/src/Resources/Locales/de_DE.axaml
@@ -503,6 +503,8 @@
Andere Tabs schließen
Rechte Tabs schließen
Kopiere Repository-Pfad
+ In neues Fenster verschieben
+ In neues Fenster kopieren
Repositories
Einfügen
Vor {0} Tagen
diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml
index 655f6e976..20d0d810e 100644
--- a/src/Resources/Locales/en_US.axaml
+++ b/src/Resources/Locales/en_US.axaml
@@ -500,6 +500,8 @@
Close Other Tabs
Close Tabs to the Right
Copy Repository Path
+ Move into New Window
+ Copy into New Window
Repositories
Paste
{0} days ago
diff --git a/src/Resources/Locales/es_ES.axaml b/src/Resources/Locales/es_ES.axaml
index 4ef06eae9..5c22f0da8 100644
--- a/src/Resources/Locales/es_ES.axaml
+++ b/src/Resources/Locales/es_ES.axaml
@@ -503,6 +503,8 @@
Cerrar Otras Pestañas
Cerrar Pestañas a la Derecha
Copiar Ruta del Repositorio
+ Mover a Nueva Ventana
+ Copiar a Nueva Ventana
Repositorios
Pegar
Hace {0} días
diff --git a/src/Resources/Locales/fr_FR.axaml b/src/Resources/Locales/fr_FR.axaml
index 919dfeac8..332422747 100644
--- a/src/Resources/Locales/fr_FR.axaml
+++ b/src/Resources/Locales/fr_FR.axaml
@@ -411,6 +411,8 @@
Fermer les autres onglets
Fermer les onglets à droite
Copier le chemin vers le dépôt
+ Déplacer vers une nouvelle fenêtre
+ Copier vers une nouvelle fenêtre
Dépôts
Coller
il y a {0} jours
diff --git a/src/Resources/Locales/it_IT.axaml b/src/Resources/Locales/it_IT.axaml
index c12e3e53c..abcd13fbf 100644
--- a/src/Resources/Locales/it_IT.axaml
+++ b/src/Resources/Locales/it_IT.axaml
@@ -431,6 +431,8 @@
Chiudi Altri Tab
Chiudi i Tab a Destra
Copia Percorso Repository
+ Sposta in Nuova Finestra
+ Copia in Nuova Finestra
Repository
Incolla
{0} giorni fa
diff --git a/src/Resources/Locales/ja_JP.axaml b/src/Resources/Locales/ja_JP.axaml
index 32c41f216..d65ab3710 100644
--- a/src/Resources/Locales/ja_JP.axaml
+++ b/src/Resources/Locales/ja_JP.axaml
@@ -410,6 +410,8 @@
他のタブを閉じる
右のタブを閉じる
リポジトリパスをコピー
+ 新しいウィンドウに移動
+ 新しいウィンドウにコピー
リポジトリ
貼り付け
{0} 日前
diff --git a/src/Resources/Locales/pt_BR.axaml b/src/Resources/Locales/pt_BR.axaml
index 3fbac432f..331fb195e 100644
--- a/src/Resources/Locales/pt_BR.axaml
+++ b/src/Resources/Locales/pt_BR.axaml
@@ -373,6 +373,8 @@
Fechar Outras Abas
Fechar Abas à Direita
Copiar Caminho do Repositório
+ Mover para Nova Janela
+ Copiar para Nova Janela
Repositórios
Colar
{0} dias atrás
diff --git a/src/Resources/Locales/ru_RU.axaml b/src/Resources/Locales/ru_RU.axaml
index 413b99e32..7aeddf5f7 100644
--- a/src/Resources/Locales/ru_RU.axaml
+++ b/src/Resources/Locales/ru_RU.axaml
@@ -503,6 +503,8 @@
Закрыть другие вкладки
Закрыть вкладки справа
Копировать путь репозитория
+ Переместить в новое окно
+ Копировать в новое окно
Репозитории
Вставить
{0} дней назад
diff --git a/src/Resources/Locales/ta_IN.axaml b/src/Resources/Locales/ta_IN.axaml
index 3a0c8e532..3947c4f55 100644
--- a/src/Resources/Locales/ta_IN.axaml
+++ b/src/Resources/Locales/ta_IN.axaml
@@ -410,6 +410,8 @@
பிற தாவல்களை மூடு
வலதுபுறத்தில் உள்ள தாவல்களை மூடு
களஞ்சிய பாதை நகலெடு
+ புதிய சாளரத்திற்கு நகர்த்து
+ புதிய சாளரத்திற்கு நகலெடு
களஞ்சியங்கள்
ஒட்டு
{0} நாட்களுக்கு முன்பு
diff --git a/src/Resources/Locales/uk_UA.axaml b/src/Resources/Locales/uk_UA.axaml
index 46e42fcda..2b6c9c1b8 100644
--- a/src/Resources/Locales/uk_UA.axaml
+++ b/src/Resources/Locales/uk_UA.axaml
@@ -415,6 +415,8 @@
Закрити інші вкладки
Закрити вкладки праворуч
Копіювати шлях до сховища
+ Перемістити в нове вікно
+ Копіювати в нове вікно
Сховища
Вставити
{0} днів тому
diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml
index 711ab12f3..afc34083a 100644
--- a/src/Resources/Locales/zh_CN.axaml
+++ b/src/Resources/Locales/zh_CN.axaml
@@ -504,6 +504,8 @@
关闭其他标签页
关闭右侧标签页
复制仓库路径
+ 移动到新窗口
+ 复制到新窗口
新标签页
粘贴
{0}天前
diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml
index 61956e97f..ec3cdb254 100644
--- a/src/Resources/Locales/zh_TW.axaml
+++ b/src/Resources/Locales/zh_TW.axaml
@@ -504,6 +504,8 @@
關閉其他分頁
關閉右側分頁
複製存放庫路徑
+ 移動到新視窗
+ 複製到新視窗
新分頁
貼上
{0} 天前
diff --git a/src/ViewModels/Launcher.cs b/src/ViewModels/Launcher.cs
index b079ccf61..c7dcd6667 100644
--- a/src/ViewModels/Launcher.cs
+++ b/src/ViewModels/Launcher.cs
@@ -50,7 +50,15 @@ public IDisposable Switcher
private set => SetProperty(ref _switcher, value);
}
- public Launcher(string startupRepo)
+ public bool IsSecondaryWindow
+ {
+ get => _isSecondaryWindow;
+ set => SetProperty(ref _isSecondaryWindow, value);
+ }
+
+ public event Action OnRequestClose;
+
+ public Launcher(string startupRepo, bool isSecondaryWindow = false)
{
_ignoreIndexChange = true;
@@ -116,6 +124,8 @@ public Launcher(string startupRepo)
if (string.IsNullOrEmpty(_title))
UpdateTitle();
+
+ IsSecondaryWindow = isSecondaryWindow;
}
public void Quit()
@@ -273,6 +283,13 @@ public void CloseTab(LauncherPage page)
}
else
{
+ if (IsSecondaryWindow)
+ {
+ OnRequestClose?.Invoke();
+
+ return;
+ }
+
App.Quit(0);
}
@@ -495,6 +512,24 @@ public ContextMenu CreateContextForPageTab(LauncherPage page)
if (page.Node.IsRepository)
{
+ var moveToNewWindow = new MenuItem();
+ moveToNewWindow.Header = App.Text("PageTabBar.Tab.MoveToNewWindow");
+ moveToNewWindow.Click += (_, e) =>
+ {
+ MoveToNewWindow(page);
+ e.Handled = true;
+ };
+ menu.Items.Add(moveToNewWindow);
+
+ var copyToNewWindow = new MenuItem();
+ copyToNewWindow.Header = App.Text("PageTabBar.Tab.CopyToNewWindow");
+ copyToNewWindow.Click += (_, e) =>
+ {
+ CopyToNewWindow(page);
+ e.Handled = true;
+ };
+ menu.Items.Add(copyToNewWindow);
+
var bookmark = new MenuItem();
bookmark.Header = App.Text("PageTabBar.Tab.Bookmark");
bookmark.Icon = App.CreateMenuIcon("Icons.Bookmark");
@@ -534,6 +569,21 @@ public ContextMenu CreateContextForPageTab(LauncherPage page)
return menu;
}
+ public void MoveToNewWindow(LauncherPage page)
+ {
+ NewWindow(page);
+ CloseTab(page);
+ }
+
+ public void CopyToNewWindow(LauncherPage page) => NewWindow(page);
+
+ private void NewWindow(LauncherPage page)
+ {
+ var newWindow = new Views.Launcher() { DataContext = new Launcher(page.Node.Id, true) };
+ newWindow.RegisterOnRequestClose();
+ newWindow.Show();
+ }
+
private string GetRepositoryGitDir(string repo)
{
var fullpath = Path.Combine(repo, ".git");
@@ -611,5 +661,6 @@ private void UpdateTitle()
private bool _ignoreIndexChange = false;
private string _title = string.Empty;
private IDisposable _switcher = null;
+ private bool _isSecondaryWindow = false;
}
}
diff --git a/src/Views/Launcher.axaml.cs b/src/Views/Launcher.axaml.cs
index 4c8a4f9a1..8786a16ac 100644
--- a/src/Views/Launcher.axaml.cs
+++ b/src/Views/Launcher.axaml.cs
@@ -5,6 +5,7 @@
using Avalonia.Input;
using Avalonia.Interactivity;
using Avalonia.Platform;
+using Avalonia.Threading;
using Avalonia.VisualTree;
namespace SourceGit.Views
@@ -85,6 +86,12 @@ public Launcher()
WindowStartupLocation = WindowStartupLocation.CenterScreen;
}
+ public void RegisterOnRequestClose()
+ {
+ if (DataContext is ViewModels.Launcher vm)
+ vm.OnRequestClose += () => Dispatcher.UIThread.Post(Close);
+ }
+
public void BringToTop()
{
if (WindowState == WindowState.Minimized)