Skip to content

Commit 7c520c5

Browse files
gave92Marco Gavelli
authored andcommitted
Hide pane when no terminals
1 parent 35c79ac commit 7c520c5

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

src/Files.App/Utils/Terminal/ConPTY/Terminal.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ private static SafeFileHandle GetConsoleScreenBuffer()
138138
{
139139
var file = CreateFile(
140140
"CONOUT$",
141-
(FILE_ACCESS_FLAGS)(Win32PInvoke.GENERIC_WRITE | Win32PInvoke.GENERIC_READ),
141+
Win32PInvoke.GENERIC_WRITE | Win32PInvoke.GENERIC_READ,
142142
FILE_SHARE_MODE.FILE_SHARE_WRITE,
143143
null,
144144
FILE_CREATION_DISPOSITION.OPEN_EXISTING,

src/Files.App/ViewModels/MainPageViewModel.cs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,8 @@ public MainPageViewModel()
174174
DismissSponsorPromptCommand = new RelayCommand(ExecuteDismissSponsorPromptCommand);
175175
TerminalAddCommand = new RelayCommand<ShellProfile>((e) =>
176176
{
177+
if (Terminals.IsEmpty())
178+
IsTerminalViewOpen = true;
177179
Terminals.Add(new TerminalView(e ?? TerminalSelectedProfile)
178180
{
179181
Tag = $"Terminal {Terminals.Count}"
@@ -206,6 +208,8 @@ public MainPageViewModel()
206208
(terminal as IDisposable)?.Dispose();
207209
Terminals.Remove(terminal);
208210
SelectedTerminal = int.Min(SelectedTerminal, Terminals.Count - 1);
211+
if (Terminals.IsEmpty())
212+
IsTerminalViewOpen = false;
209213
OnPropertyChanged(nameof(ActiveTerminal));
210214
OnPropertyChanged(nameof(TerminalNames));
211215
});
@@ -245,7 +249,20 @@ public MainPageViewModel()
245249
OnPropertyChanged(nameof(ShowStatusBar));
246250
break;
247251
}
248-
};
252+
if (e.PropertyName == nameof(ActiveTerminal))
253+
{
254+
if (ActiveTerminal is TerminalView termView)
255+
{
256+
GetTerminalFolder = termView.GetTerminalFolder;
257+
SetTerminalFolder = termView.SetTerminalFolder;
258+
}
259+
else
260+
{
261+
GetTerminalFolder = null;
262+
SetTerminalFolder = null;
263+
}
264+
}
265+
};
249266

250267
GeneralSettingsService.PropertyChanged += (s, e) =>
251268
{

0 commit comments

Comments
 (0)