diff --git a/FluentTerminal.App.ViewModels/OverlayViewModel.cs b/FluentTerminal.App.ViewModels/OverlayViewModel.cs new file mode 100644 index 0000000..6f912cc --- /dev/null +++ b/FluentTerminal.App.ViewModels/OverlayViewModel.cs @@ -0,0 +1,51 @@ +using FluentTerminal.App.Services; +using GalaSoft.MvvmLight; +using System; + +namespace FluentTerminal.App.ViewModels +{ + public class OverlayViewModel : ViewModelBase + { + private readonly IDispatcherTimer _overlayTimer; + private bool _showOverlay; + private string _overlayContent; + + public OverlayViewModel(IDispatcherTimer dispatcherTimer) + { + _overlayTimer = dispatcherTimer; + _overlayTimer.Interval = new TimeSpan(0, 0, 2); + _overlayTimer.Tick += OnResizeOverlayTimerFinished; + } + + public bool ShowOverlay + { + get => _showOverlay; + set => Set(ref _showOverlay, value); + } + + public string OverlayContent + { + get => _overlayContent; + set => Set(ref _overlayContent, value); + } + + public void Show(string message) + { + OverlayContent = message; + ShowOverlay = true; + + if (_overlayTimer.IsEnabled) + { + _overlayTimer.Stop(); + } + _overlayTimer.Start(); + } + + private void OnResizeOverlayTimerFinished(object sender, object e) + { + _overlayTimer.Stop(); + ShowOverlay = false; + } + + } +} diff --git a/FluentTerminal.App.ViewModels/Settings/TerminalPageViewModel.cs b/FluentTerminal.App.ViewModels/Settings/TerminalPageViewModel.cs index a880cc7..c5af0b2 100644 --- a/FluentTerminal.App.ViewModels/Settings/TerminalPageViewModel.cs +++ b/FluentTerminal.App.ViewModels/Settings/TerminalPageViewModel.cs @@ -150,6 +150,20 @@ namespace FluentTerminal.App.ViewModels.Settings } } + public bool ShowTextCopied + { + get => _terminalOptions.ShowTextCopied; + set + { + if (_terminalOptions.ShowTextCopied != value) + { + _terminalOptions.ShowTextCopied = value; + _settingsService.SaveTerminalOptions(_terminalOptions); + RaisePropertyChanged(); + } + } + } + public IEnumerable Fonts { get; } public int FontSize @@ -223,6 +237,7 @@ namespace FluentTerminal.App.ViewModels.Settings BoldText = defaults.BoldText; BackgroundOpacity = defaults.BackgroundOpacity; ScrollBackLimit = defaults.ScrollBackLimit.ToString(); + ShowTextCopied = defaults.ShowTextCopied; } } diff --git a/FluentTerminal.App.ViewModels/TerminalViewModel.cs b/FluentTerminal.App.ViewModels/TerminalViewModel.cs index 50c0f69..a62ca81 100644 --- a/FluentTerminal.App.ViewModels/TerminalViewModel.cs +++ b/FluentTerminal.App.ViewModels/TerminalViewModel.cs @@ -15,15 +15,13 @@ namespace FluentTerminal.App.ViewModels public class TerminalViewModel : ViewModelBase { private readonly IKeyboardCommandService _keyboardCommandService; - private readonly IDispatcherTimer _resizeOverlayTimer; private bool _isSelected; private bool _hasNewOutput; - private string _resizeOverlayContent; private string _searchText; - private bool _showResizeOverlay; private bool _showSearchPanel; private TabTheme _tabTheme; private TerminalTheme _terminalTheme; + private TerminalOptions _terminalOptions; private string _tabTitle; private string _shellTitle; private bool _hasCustomTitle; @@ -38,6 +36,8 @@ namespace FluentTerminal.App.ViewModels SettingsService.ApplicationSettingsChanged += OnApplicationSettingsChanged; SettingsService.KeyBindingsChanged += OnKeyBindingsChanged; + _terminalOptions = SettingsService.GetTerminalOptions(); + TrayProcessCommunicationService = trayProcessCommunicationService; DialogService = dialogService; @@ -52,10 +52,6 @@ namespace FluentTerminal.App.ViewModels TabThemes = new ObservableCollection(SettingsService.GetTabThemes()); TabTheme = TabThemes.FirstOrDefault(t => t.Id == ShellProfile.TabThemeId); - _resizeOverlayTimer = dispatcherTimer; - _resizeOverlayTimer.Interval = new TimeSpan(0, 0, 2); - _resizeOverlayTimer.Tick += OnResizeOverlayTimerFinished; - CloseCommand = new RelayCommand(async () => await TryClose().ConfigureAwait(false)); FindNextCommand = new RelayCommand(FindNext); FindPreviousCommand = new RelayCommand(FindPrevious); @@ -69,6 +65,9 @@ namespace FluentTerminal.App.ViewModels Terminal.SizeChanged += Terminal_SizeChanged; Terminal.TitleChanged += Terminal_TitleChanged; Terminal.Closed += Terminal_Closed; + + Overlay = new OverlayViewModel(dispatcherTimer); + } public event EventHandler Activated; @@ -135,12 +134,6 @@ namespace FluentTerminal.App.ViewModels set => Set(ref _hasNewOutput, value); } - public string ResizeOverlayContent - { - get => _resizeOverlayContent; - set => Set(ref _resizeOverlayContent, value); - } - public string SearchText { get => _searchText; @@ -153,23 +146,6 @@ namespace FluentTerminal.App.ViewModels public ShellProfile ShellProfile { get; } - public bool ShowResizeOverlay - { - get => _showResizeOverlay; - set - { - Set(ref _showResizeOverlay, value); - if (value) - { - if (_resizeOverlayTimer.IsEnabled) - { - _resizeOverlayTimer.Stop(); - } - _resizeOverlayTimer.Start(); - } - } - } - public bool ShowSearchPanel { get => _showSearchPanel; @@ -191,6 +167,8 @@ namespace FluentTerminal.App.ViewModels public Terminal Terminal { get; private set; } + public OverlayViewModel Overlay { get; private set; } + public TerminalTheme TerminalTheme { get => _terminalTheme; @@ -306,14 +284,9 @@ namespace FluentTerminal.App.ViewModels await ApplicationView.RunOnDispatcherThread(() => KeyBindingsChanged?.Invoke(this, EventArgs.Empty)); } - private void OnResizeOverlayTimerFinished(object sender, object e) - { - _resizeOverlayTimer.Stop(); - ShowResizeOverlay = false; - } - private async void OnTerminalOptionsChanged(object sender, TerminalOptions e) { + _terminalOptions = e; await ApplicationView.RunOnDispatcherThread(() => OptionsChanged?.Invoke(this, e)); } @@ -335,6 +308,10 @@ namespace FluentTerminal.App.ViewModels { var selection = await Terminal.GetSelectedText().ConfigureAwait(true); ClipboardService.SetText(selection); + if(_terminalOptions.ShowTextCopied) + { + Overlay.Show("Text copied"); + } break; } case nameof(Command.Paste): @@ -384,8 +361,7 @@ namespace FluentTerminal.App.ViewModels private void Terminal_SizeChanged(object sender, TerminalSize e) { - ResizeOverlayContent = $"{e.Columns} x {e.Rows}"; - ShowResizeOverlay = true; + Overlay.Show($"{e.Columns} x {e.Rows}"); } private void Terminal_TitleChanged(object sender, string e) diff --git a/FluentTerminal.App/FluentTerminal.App.csproj b/FluentTerminal.App/FluentTerminal.App.csproj index 4299e5d..30d55f3 100644 --- a/FluentTerminal.App/FluentTerminal.App.csproj +++ b/FluentTerminal.App/FluentTerminal.App.csproj @@ -1,445 +1,452 @@ - - - - - Debug - x86 - {41020100-3414-4E0A-9A8E-92D3C4179DF8} - AppContainerExe - Properties - FluentTerminal.App - FluentTerminal.App - en-US - UAP - 10.0.16299.0 - 10.0.16299.0 - 14 - 512 - {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - true - FluentTerminal.App_TemporaryKey.pfx - F96F3E0E485F07E8E98DA6E5C06AA4B6F112B498 - False - Always - x86|x64 - False - 1 - OnApplicationRun - True - - - true - bin\x86\Debug\ - DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP - ;2008 - full - x86 - false - prompt - true - 7.1 - - - bin\x86\Release\ - TRACE;NETFX_CORE;WINDOWS_UWP - true - ;2008 - pdbonly - x86 - false - prompt - true - true - 7.1 - - - true - bin\ARM\Debug\ - DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP - ;2008 - full - ARM - false - prompt - true - - - bin\ARM\Release\ - TRACE;NETFX_CORE;WINDOWS_UWP - true - ;2008 - pdbonly - ARM - false - prompt - true - true - - - true - bin\x64\Debug\ - DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP - ;2008 - full - x64 - false - prompt - true - 7.1 - - - bin\x64\Release\ - TRACE;NETFX_CORE;WINDOWS_UWP - true - ;2008 - pdbonly - x64 - false - prompt - true - true - 7.1 - - - PackageReference - - - - - - - App.xaml - - - - - - - - - - - - - - - - - - - - - - - - InputDialog.xaml - - - ShellProfileSelectionDialog.xaml - - - - - - - - - - KeyBindingsView.xaml - - - MainPage.xaml - - - - CreateKeyBindingDialog.xaml - - - SettingsPage.xaml - - - About.xaml - - - MouseSettings.xaml - - - ThemeSettings.xaml - - - TerminalSettings.xaml - - - GeneralSettings.xaml - - - KeyBindingSettings.xaml - - - ShellProfileSettings.xaml - - - SshInfoDialog.xaml - - - TabBar.xaml - - - - - - TerminalColorPicker.xaml - - - - - - TerminalView.xaml - - - XtermTerminalView.xaml - - - - - Designer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - MSBuild:Compile - Designer - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - MSBuild:Compile - Designer - - - Designer - MSBuild:Compile - PreserveNewest - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - MSBuild:Compile - Designer - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - MSBuild:Compile - Designer - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - - - 4.9.1 - - - 2.4.3 - - - 6.2.8 - - - 5.1.0 - - - 5.1.0 - - - 2.0.0 - - - 12.0.1 - - - 1.21.0 - - - - - Windows Desktop Extensions for the UWP - - - - - {a1ad7385-f92e-46ac-a349-43dc99b1e72d} - FluentTerminal.App.Services - - - {44e8e225-f46c-47ec-9290-ffa08fccf1b5} - FluentTerminal.App.ViewModels - - - {5EA40453-A0AA-449E-8406-D6EA51D7E70E} - FluentTerminal.Models - - - {BAAE6239-343F-454C-977F-F81F91715961} - FluentTerminal.RuntimeComponent - - - - - 14.0 - - - - - - - - xcopy /y "$(SolutionDir)FluentTerminal.Client\dist" "$(ProjectDir)Client\" - + + + + + Debug + x86 + {41020100-3414-4E0A-9A8E-92D3C4179DF8} + AppContainerExe + Properties + FluentTerminal.App + FluentTerminal.App + en-US + UAP + 10.0.16299.0 + 10.0.16299.0 + 14 + 512 + {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + true + FluentTerminal.App_TemporaryKey.pfx + F96F3E0E485F07E8E98DA6E5C06AA4B6F112B498 + False + Always + x86|x64 + False + 1 + OnApplicationRun + True + + + true + bin\x86\Debug\ + DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP + ;2008 + full + x86 + false + prompt + true + 7.1 + + + bin\x86\Release\ + TRACE;NETFX_CORE;WINDOWS_UWP + true + ;2008 + pdbonly + x86 + false + prompt + true + true + 7.1 + + + true + bin\ARM\Debug\ + DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP + ;2008 + full + ARM + false + prompt + true + + + bin\ARM\Release\ + TRACE;NETFX_CORE;WINDOWS_UWP + true + ;2008 + pdbonly + ARM + false + prompt + true + true + + + true + bin\x64\Debug\ + DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP + ;2008 + full + x64 + false + prompt + true + 7.1 + + + bin\x64\Release\ + TRACE;NETFX_CORE;WINDOWS_UWP + true + ;2008 + pdbonly + x64 + false + prompt + true + true + 7.1 + + + PackageReference + + + + + + + App.xaml + + + + + + + + + + + + + + + + + + + + + + + + InputDialog.xaml + + + ShellProfileSelectionDialog.xaml + + + + + + + + + + KeyBindingsView.xaml + + + MainPage.xaml + + + + CreateKeyBindingDialog.xaml + + + OverlayView.xaml + + + SettingsPage.xaml + + + About.xaml + + + MouseSettings.xaml + + + ThemeSettings.xaml + + + TerminalSettings.xaml + + + GeneralSettings.xaml + + + KeyBindingSettings.xaml + + + ShellProfileSettings.xaml + + + SshInfoDialog.xaml + + + TabBar.xaml + + + + + + TerminalColorPicker.xaml + + + + + + TerminalView.xaml + + + XtermTerminalView.xaml + + + + + Designer + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + MSBuild:Compile + Designer + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + MSBuild:Compile + Designer + + + Designer + MSBuild:Compile + PreserveNewest + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + MSBuild:Compile + Designer + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + MSBuild:Compile + Designer + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + + + 4.9.1 + + + 2.4.3 + + + 6.2.8 + + + 5.1.0 + + + 5.1.0 + + + 2.0.0 + + + 12.0.1 + + + 1.21.0 + + + + + Windows Desktop Extensions for the UWP + + + + + {a1ad7385-f92e-46ac-a349-43dc99b1e72d} + FluentTerminal.App.Services + + + {44e8e225-f46c-47ec-9290-ffa08fccf1b5} + FluentTerminal.App.ViewModels + + + {5EA40453-A0AA-449E-8406-D6EA51D7E70E} + FluentTerminal.Models + + + {BAAE6239-343F-454C-977F-F81F91715961} + FluentTerminal.RuntimeComponent + + + + + 14.0 + + + + + + + + xcopy /y "$(SolutionDir)FluentTerminal.Client\dist" "$(ProjectDir)Client\" + + --> \ No newline at end of file diff --git a/FluentTerminal.App/Views/OverlayView.xaml b/FluentTerminal.App/Views/OverlayView.xaml new file mode 100644 index 0000000..bf16205 --- /dev/null +++ b/FluentTerminal.App/Views/OverlayView.xaml @@ -0,0 +1,22 @@ + + + + + + + + diff --git a/FluentTerminal.App/Views/OverlayView.xaml.cs b/FluentTerminal.App/Views/OverlayView.xaml.cs new file mode 100644 index 0000000..71ab8e1 --- /dev/null +++ b/FluentTerminal.App/Views/OverlayView.xaml.cs @@ -0,0 +1,12 @@ +using Windows.UI.Xaml.Controls; + +namespace FluentTerminal.App.Views +{ + public sealed partial class OverlayView : UserControl + { + public OverlayView() + { + InitializeComponent(); + } + } +} diff --git a/FluentTerminal.App/Views/SettingsPages/TerminalSettings.xaml b/FluentTerminal.App/Views/SettingsPages/TerminalSettings.xaml index c4b15f0..d4b3167 100644 --- a/FluentTerminal.App/Views/SettingsPages/TerminalSettings.xaml +++ b/FluentTerminal.App/Views/SettingsPages/TerminalSettings.xaml @@ -132,6 +132,12 @@ GroupName="ScrollBar" IsChecked="{x:Bind ViewModel.VisibleIsSelected, Mode=TwoWay}" /> + + + diff --git a/FluentTerminal.App/Views/TabBar.xaml b/FluentTerminal.App/Views/TabBar.xaml index 40c5b4c..0509fff 100644 --- a/FluentTerminal.App/Views/TabBar.xaml +++ b/FluentTerminal.App/Views/TabBar.xaml @@ -59,6 +59,7 @@ VerticalAlignment="Stretch" Background="Transparent" ToolTipService.ToolTip="{x:Bind TabTitle, Mode=OneWay}"> + @@ -66,6 +67,7 @@ + diff --git a/FluentTerminal.App/Views/TerminalView.xaml b/FluentTerminal.App/Views/TerminalView.xaml index 561e61c..f117cb8 100644 --- a/FluentTerminal.App/Views/TerminalView.xaml +++ b/FluentTerminal.App/Views/TerminalView.xaml @@ -4,27 +4,22 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:views="using:FluentTerminal.App.Views" d:DesignHeight="300" d:DesignWidth="600" mc:Ignorable="d"> + - - - - - - + + + +