Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0a4a1baeba | ||
|
|
14d111c4de | ||
|
|
db73d7e1cb |
No files matched your search
@@ -15,7 +15,10 @@ namespace FluentTerminal.App.Services.Implementation
|
||||
ConfirmClosingWindows = false,
|
||||
UnderlineSelectedTab = false,
|
||||
NewTerminalLocation = NewTerminalLocation.Tab,
|
||||
TabsPosition = TabsPosition.Top
|
||||
TabsPosition = TabsPosition.Top,
|
||||
CopyOnSelect = false,
|
||||
MouseMiddleClickAction = MouseAction.None,
|
||||
MouseRightClickAction = MouseAction.ContextMenu
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -132,7 +132,7 @@ namespace FluentTerminal.App.ViewModels.Settings
|
||||
|
||||
private async Task RestoreDefaults()
|
||||
{
|
||||
var result = await _dialogService.ShowMessageDialogAsnyc("Please confirm", "Are you sure you want to restore the general settings?", DialogButton.OK, DialogButton.Cancel).ConfigureAwait(false);
|
||||
var result = await _dialogService.ShowMessageDialogAsnyc("Please confirm", "Are you sure you want to restore the general settings?", DialogButton.OK, DialogButton.Cancel).ConfigureAwait(true);
|
||||
|
||||
if (result == DialogButton.OK)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,135 @@
|
||||
using FluentTerminal.App.Services;
|
||||
using FluentTerminal.Models;
|
||||
using FluentTerminal.Models.Enums;
|
||||
using GalaSoft.MvvmLight;
|
||||
using GalaSoft.MvvmLight.Command;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FluentTerminal.App.ViewModels.Settings
|
||||
{
|
||||
public class MousePageViewModel : ViewModelBase
|
||||
{
|
||||
private readonly ISettingsService _settingsService;
|
||||
private readonly IDialogService _dialogService;
|
||||
private readonly IDefaultValueProvider _defaultValueProvider;
|
||||
private readonly ApplicationSettings _applicationSettings;
|
||||
private bool _editingMouseRightClickAction;
|
||||
private bool _editingMouseMiddleClickAction;
|
||||
|
||||
public MousePageViewModel(ISettingsService settingsService, IDialogService dialogService, IDefaultValueProvider defaultValueProvider)
|
||||
{
|
||||
_settingsService = settingsService;
|
||||
_dialogService = dialogService;
|
||||
_defaultValueProvider = defaultValueProvider;
|
||||
_applicationSettings = _settingsService.GetApplicationSettings();
|
||||
|
||||
RestoreDefaultsCommand = new RelayCommand(async () => await RestoreDefaults().ConfigureAwait(false));
|
||||
}
|
||||
|
||||
public bool CopyOnSelect
|
||||
{
|
||||
get => _applicationSettings.CopyOnSelect;
|
||||
set
|
||||
{
|
||||
if (_applicationSettings.CopyOnSelect != value)
|
||||
{
|
||||
_applicationSettings.CopyOnSelect = value;
|
||||
_settingsService.SaveApplicationSettings(_applicationSettings);
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public MouseAction MouseRightClickAction
|
||||
{
|
||||
get => _applicationSettings.MouseRightClickAction;
|
||||
set
|
||||
{
|
||||
if (_applicationSettings.MouseRightClickAction != value && !_editingMouseRightClickAction)
|
||||
{
|
||||
_editingMouseRightClickAction = true;
|
||||
_applicationSettings.MouseRightClickAction = value;
|
||||
_settingsService.SaveApplicationSettings(_applicationSettings);
|
||||
RaisePropertyChanged();
|
||||
RaisePropertyChanged(nameof(MouseRightClickNoneIsSelected));
|
||||
RaisePropertyChanged(nameof(MouseRightClickContextMenuIsSelected));
|
||||
RaisePropertyChanged(nameof(MouseRightClickPasteIsSelected));
|
||||
_editingMouseRightClickAction = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool MouseRightClickNoneIsSelected
|
||||
{
|
||||
get => MouseRightClickAction == MouseAction.None;
|
||||
set => MouseRightClickAction = MouseAction.None;
|
||||
}
|
||||
|
||||
public bool MouseRightClickContextMenuIsSelected
|
||||
{
|
||||
get => MouseRightClickAction == MouseAction.ContextMenu;
|
||||
set => MouseRightClickAction = MouseAction.ContextMenu;
|
||||
}
|
||||
|
||||
public bool MouseRightClickPasteIsSelected
|
||||
{
|
||||
get => MouseRightClickAction == MouseAction.Paste;
|
||||
set => MouseRightClickAction = MouseAction.Paste;
|
||||
}
|
||||
|
||||
public MouseAction MouseMiddleClickAction
|
||||
{
|
||||
get => _applicationSettings.MouseMiddleClickAction;
|
||||
set
|
||||
{
|
||||
if (_applicationSettings.MouseMiddleClickAction != value && !_editingMouseMiddleClickAction)
|
||||
{
|
||||
_editingMouseMiddleClickAction = true;
|
||||
_applicationSettings.MouseMiddleClickAction = value;
|
||||
_settingsService.SaveApplicationSettings(_applicationSettings);
|
||||
RaisePropertyChanged();
|
||||
RaisePropertyChanged(nameof(MouseMiddleClickNoneIsSelected));
|
||||
RaisePropertyChanged(nameof(MouseMiddleClickContextMenuIsSelected));
|
||||
RaisePropertyChanged(nameof(MouseMiddleClickPasteIsSelected));
|
||||
_editingMouseMiddleClickAction = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool MouseMiddleClickNoneIsSelected
|
||||
{
|
||||
get => MouseMiddleClickAction == MouseAction.None;
|
||||
set => MouseMiddleClickAction = MouseAction.None;
|
||||
}
|
||||
|
||||
public bool MouseMiddleClickContextMenuIsSelected
|
||||
{
|
||||
get => MouseMiddleClickAction == MouseAction.ContextMenu;
|
||||
set => MouseMiddleClickAction = MouseAction.ContextMenu;
|
||||
}
|
||||
|
||||
public bool MouseMiddleClickPasteIsSelected
|
||||
{
|
||||
get => MouseMiddleClickAction == MouseAction.Paste;
|
||||
set => MouseMiddleClickAction = MouseAction.Paste;
|
||||
}
|
||||
|
||||
public RelayCommand RestoreDefaultsCommand { get; }
|
||||
|
||||
private async Task RestoreDefaults()
|
||||
{
|
||||
var result = await _dialogService.ShowMessageDialogAsnyc("Please confirm", "Are you sure you want to restore the mouse settings?", DialogButton.OK, DialogButton.Cancel).ConfigureAwait(true);
|
||||
|
||||
if (result == DialogButton.OK)
|
||||
{
|
||||
var defaults = _defaultValueProvider.GetDefaultApplicationSettings();
|
||||
CopyOnSelect = defaults.CopyOnSelect;
|
||||
MouseMiddleClickAction = defaults.MouseMiddleClickAction;
|
||||
MouseRightClickAction = defaults.MouseRightClickAction;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,7 @@ namespace FluentTerminal.App.ViewModels
|
||||
Shell = new ProfilesPageViewModel(settingsService, dialogService, defaultValueProvider, fileSystemService);
|
||||
Terminal = new TerminalPageViewModel(settingsService, dialogService, defaultValueProvider, systemFontService);
|
||||
Themes = new ThemesPageViewModel(settingsService, dialogService, defaultValueProvider, themeParserFactory, fileSystemService);
|
||||
Mouse = new MousePageViewModel(settingsService, dialogService, defaultValueProvider);
|
||||
}
|
||||
|
||||
public event EventHandler Closed;
|
||||
@@ -24,6 +25,7 @@ namespace FluentTerminal.App.ViewModels
|
||||
public ProfilesPageViewModel Shell { get; }
|
||||
public TerminalPageViewModel Terminal { get; }
|
||||
public ThemesPageViewModel Themes { get; }
|
||||
public MousePageViewModel Mouse { get; }
|
||||
|
||||
public void Close()
|
||||
{
|
||||
|
||||
@@ -24,7 +24,6 @@ namespace FluentTerminal.App.ViewModels
|
||||
private readonly ShellProfile _shellProfile;
|
||||
private readonly string _startupDirectory;
|
||||
private readonly ITrayProcessCommunicationService _trayProcessCommunicationService;
|
||||
private ApplicationSettings _applicationSettings;
|
||||
private bool _isSelected;
|
||||
private string _resizeOverlayContent;
|
||||
private string _searchText;
|
||||
@@ -54,7 +53,7 @@ namespace FluentTerminal.App.ViewModels
|
||||
|
||||
_dialogService = dialogService;
|
||||
_keyboardCommandService = keyboardCommandService;
|
||||
_applicationSettings = applicationSettings;
|
||||
ApplicationSettings = applicationSettings;
|
||||
_startupDirectory = startupDirectory;
|
||||
_shellProfile = shellProfile;
|
||||
_applicationView = applicationView;
|
||||
@@ -70,6 +69,8 @@ namespace FluentTerminal.App.ViewModels
|
||||
CloseSearchPanelCommand = new RelayCommand(CloseSearchPanel);
|
||||
}
|
||||
|
||||
public ApplicationSettings ApplicationSettings { get; private set; }
|
||||
|
||||
public event EventHandler Closed;
|
||||
|
||||
public RelayCommand CloseCommand { get; }
|
||||
@@ -100,7 +101,7 @@ namespace FluentTerminal.App.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsUnderlined => IsSelected && _applicationSettings.UnderlineSelectedTab;
|
||||
public bool IsUnderlined => IsSelected && ApplicationSettings.UnderlineSelectedTab;
|
||||
|
||||
public string ResizeOverlayContent
|
||||
{
|
||||
@@ -151,9 +152,10 @@ namespace FluentTerminal.App.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public void CloseView()
|
||||
public async Task CloseView()
|
||||
{
|
||||
_terminalView.Close();
|
||||
await _trayProcessCommunicationService.CloseTerminal(_terminalId).ConfigureAwait(true);
|
||||
}
|
||||
|
||||
public Task FocusTerminal()
|
||||
@@ -240,7 +242,7 @@ namespace FluentTerminal.App.ViewModels
|
||||
{
|
||||
await _applicationView.RunOnDispatcherThread(() =>
|
||||
{
|
||||
_applicationSettings = e;
|
||||
ApplicationSettings = e;
|
||||
RaisePropertyChanged(nameof(IsUnderlined));
|
||||
});
|
||||
}
|
||||
@@ -332,7 +334,7 @@ namespace FluentTerminal.App.ViewModels
|
||||
|
||||
private async Task TryClose()
|
||||
{
|
||||
if (_applicationSettings.ConfirmClosingTabs)
|
||||
if (ApplicationSettings.ConfirmClosingTabs)
|
||||
{
|
||||
var result = await _dialogService.ShowMessageDialogAsnyc("Please confirm", "Are you sure you want to close this tab?", DialogButton.OK, DialogButton.Cancel).ConfigureAwait(true);
|
||||
|
||||
|
||||
Binary file not shown.
@@ -25,7 +25,7 @@
|
||||
<GenerateAppInstallerFile>False</GenerateAppInstallerFile>
|
||||
<AppInstallerUpdateFrequency>1</AppInstallerUpdateFrequency>
|
||||
<AppInstallerCheckForUpdateFrequency>OnApplicationRun</AppInstallerCheckForUpdateFrequency>
|
||||
<AppxSymbolPackageEnabled>False</AppxSymbolPackageEnabled>
|
||||
<AppxSymbolPackageEnabled>True</AppxSymbolPackageEnabled>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@@ -143,6 +143,9 @@
|
||||
<Compile Include="Views\SettingsPage.xaml.cs">
|
||||
<DependentUpon>SettingsPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Views\SettingsPages\MouseSettings.xaml.cs">
|
||||
<DependentUpon>MouseSettings.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Views\SettingsPages\ThemeSettings.xaml.cs">
|
||||
<DependentUpon>ThemeSettings.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@@ -284,6 +287,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Views\SettingsPages\MouseSettings.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Views\SettingsPages\ThemeSettings.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" xmlns:uap5="http://schemas.microsoft.com/appx/manifest/uap/windows10/5" xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities" xmlns:desktop="http://schemas.microsoft.com/appx/manifest/desktop/windows10" IgnorableNamespaces="uap mp desktop rescap">
|
||||
<Identity Name="53621FSApps.FluentTerminal" Publisher="CN=BDC72197-B634-438A-B863-16DCB7D90C85" Version="0.1.12.0" />
|
||||
<Identity Name="53621FSApps.FluentTerminal" Publisher="CN=BDC72197-B634-438A-B863-16DCB7D90C85" Version="0.1.13.0" />
|
||||
<mp:PhoneIdentity PhoneProductId="f7225014-f405-4342-ad2e-ebf6ac60ea2c" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
|
||||
<Properties>
|
||||
<DisplayName>Fluent Terminal</DisplayName>
|
||||
|
||||
@@ -57,6 +57,14 @@
|
||||
ToolTipService.ToolTip="Keybindings" />
|
||||
</NavigationViewItem.Icon>
|
||||
</NavigationViewItem>
|
||||
<NavigationViewItem Content="Mouse" Tag="mouse">
|
||||
<NavigationViewItem.Icon>
|
||||
<FontIcon
|
||||
FontFamily="/Assets/settingsicons.ttf#settingsicons"
|
||||
Glyph="g"
|
||||
ToolTipService.ToolTip="Keybindings" />
|
||||
</NavigationViewItem.Icon>
|
||||
</NavigationViewItem>
|
||||
<NavigationViewItem Content="Themes" Tag="themes">
|
||||
<NavigationViewItem.Icon>
|
||||
<FontIcon
|
||||
|
||||
@@ -103,6 +103,10 @@ namespace FluentTerminal.App.Views
|
||||
case "keyBindings":
|
||||
ContentFrame.Navigate(typeof(KeyBindingSettings), ViewModel.KeyBindings);
|
||||
break;
|
||||
|
||||
case "mouse":
|
||||
ContentFrame.Navigate(typeof(MouseSettings), ViewModel.Mouse);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
<Page
|
||||
x:Class="FluentTerminal.App.Views.SettingsPages.MouseSettings"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
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"
|
||||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="32" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid Grid.Row="1" Margin="24,00,0,24">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock
|
||||
Margin="0,10,0,0"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="28"
|
||||
Style="{StaticResource TitleTextBlockStyle}"
|
||||
Text="Mouse" />
|
||||
<CommandBar
|
||||
Grid.Column="1"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Top"
|
||||
Background="{ThemeResource SystemControlBackgroundAltHighBrush}"
|
||||
DefaultLabelPosition="Right">
|
||||
<AppBarButton
|
||||
Command="{x:Bind ViewModel.RestoreDefaultsCommand}"
|
||||
Icon="Undo"
|
||||
Label="Restore Defaults" />
|
||||
</CommandBar>
|
||||
</Grid>
|
||||
<StackPanel Grid.Row="2" Margin="24,0,0,0">
|
||||
<ToggleSwitch
|
||||
Margin="0,0,0,24"
|
||||
Header="Copy on select"
|
||||
IsOn="{x:Bind ViewModel.CopyOnSelect, Mode=TwoWay}" />
|
||||
<TextBlock Margin="0,0,0,8" Text="Middle button action" />
|
||||
<RadioButton
|
||||
Content="Nothing"
|
||||
GroupName="MiddleButton"
|
||||
IsChecked="{x:Bind ViewModel.MouseMiddleClickNoneIsSelected, Mode=TwoWay}" />
|
||||
<RadioButton
|
||||
Content="Context menu"
|
||||
GroupName="MiddleButton"
|
||||
IsChecked="{x:Bind ViewModel.MouseMiddleClickContextMenuIsSelected, Mode=TwoWay}" />
|
||||
<RadioButton
|
||||
Margin="0,0,0,24"
|
||||
Content="Paste"
|
||||
GroupName="MiddleButton"
|
||||
IsChecked="{x:Bind ViewModel.MouseMiddleClickPasteIsSelected, Mode=TwoWay}" />
|
||||
<TextBlock Margin="0,0,0,8" Text="Right button action" />
|
||||
<RadioButton
|
||||
Content="Nothing"
|
||||
GroupName="RightButton"
|
||||
IsChecked="{x:Bind ViewModel.MouseRightClickNoneIsSelected, Mode=TwoWay}" />
|
||||
<RadioButton
|
||||
Content="Context menu"
|
||||
GroupName="RightButton"
|
||||
IsChecked="{x:Bind ViewModel.MouseRightClickContextMenuIsSelected, Mode=TwoWay}" />
|
||||
<RadioButton
|
||||
Margin="0,0,0,24"
|
||||
Content="Paste"
|
||||
GroupName="RightButton"
|
||||
IsChecked="{x:Bind ViewModel.MouseRightClickPasteIsSelected, Mode=TwoWay}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Page>
|
||||
@@ -0,0 +1,24 @@
|
||||
using FluentTerminal.App.ViewModels.Settings;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
|
||||
namespace FluentTerminal.App.Views.SettingsPages
|
||||
{
|
||||
public sealed partial class MouseSettings : Page
|
||||
{
|
||||
public MouseSettings()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
}
|
||||
|
||||
public MousePageViewModel ViewModel { get; private set; }
|
||||
|
||||
protected override void OnNavigatedTo(NavigationEventArgs e)
|
||||
{
|
||||
if (e.Parameter is MousePageViewModel viewModel)
|
||||
{
|
||||
ViewModel = viewModel;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
using FluentTerminal.App.ViewModels;
|
||||
using FluentTerminal.Models;
|
||||
using FluentTerminal.Models.Enums;
|
||||
using FluentTerminal.RuntimeComponent.Enums;
|
||||
using FluentTerminal.RuntimeComponent.Interfaces;
|
||||
using FluentTerminal.RuntimeComponent.WebAllowedObjects;
|
||||
using Newtonsoft.Json;
|
||||
@@ -209,16 +210,6 @@ namespace FluentTerminal.App.Views
|
||||
await ViewModel.OnViewIsReady(this).ConfigureAwait(true);
|
||||
}
|
||||
|
||||
public void OnRightClick(int x, int y, bool hasSelection)
|
||||
{
|
||||
_dispatcherJobs.Add(() =>
|
||||
{
|
||||
var flyout = (MenuFlyout)_webView.ContextFlyout;
|
||||
_copyMenuItem.IsEnabled = hasSelection;
|
||||
flyout.ShowAt(_webView, new Point(x, y));
|
||||
});
|
||||
}
|
||||
|
||||
private void Paste_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
OnKeyboardCommand(nameof(Command.Paste));
|
||||
@@ -260,5 +251,49 @@ namespace FluentTerminal.App.Views
|
||||
{
|
||||
SearchTextBox.Focus(FocusState.Programmatic);
|
||||
}
|
||||
|
||||
public void OnMouseClick(MouseButton mouseButton, int x, int y, bool hasSelection)
|
||||
{
|
||||
_dispatcherJobs.Add(() =>
|
||||
{
|
||||
if (mouseButton == MouseButton.Middle)
|
||||
{
|
||||
if (ViewModel.ApplicationSettings.MouseMiddleClickAction == MouseAction.ContextMenu)
|
||||
{
|
||||
ShowContextMenu(x, y, hasSelection);
|
||||
}
|
||||
else if (ViewModel.ApplicationSettings.MouseMiddleClickAction == MouseAction.Paste)
|
||||
{
|
||||
OnKeyboardCommand(nameof(Command.Paste));
|
||||
}
|
||||
}
|
||||
else if (mouseButton == MouseButton.Right)
|
||||
{
|
||||
if (ViewModel.ApplicationSettings.MouseRightClickAction == MouseAction.ContextMenu)
|
||||
{
|
||||
ShowContextMenu(x, y, hasSelection);
|
||||
}
|
||||
else if (ViewModel.ApplicationSettings.MouseRightClickAction == MouseAction.Paste)
|
||||
{
|
||||
OnKeyboardCommand(nameof(Command.Paste));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void OnSelectionChanged(string selection)
|
||||
{
|
||||
if (ViewModel.ApplicationSettings.CopyOnSelect)
|
||||
{
|
||||
_dispatcherJobs.Add(() => OnKeyboardCommand(nameof(Command.Copy)));
|
||||
}
|
||||
}
|
||||
|
||||
private void ShowContextMenu(int x, int y, bool terminalHasSelection)
|
||||
{
|
||||
var flyout = (MenuFlyout)_webView.ContextFlyout;
|
||||
_copyMenuItem.IsEnabled = terminalHasSelection;
|
||||
flyout.ShowAt(_webView, new Point(x, y));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -50,6 +50,10 @@ function createTerminal(options, theme, keyBindings) {
|
||||
terminalBridge.notifyTitleChanged(title);
|
||||
});
|
||||
|
||||
term.on('selection', function () {
|
||||
terminalBridge.notifySelectionChanged(term.getSelection());
|
||||
});
|
||||
|
||||
term.open(terminalContainer);
|
||||
term.winptyCompatInit();
|
||||
term.fit();
|
||||
@@ -62,7 +66,9 @@ function createTerminal(options, theme, keyBindings) {
|
||||
}
|
||||
|
||||
window.onmouseup = function (e) {
|
||||
if (e.button == 2) {
|
||||
if (e.button == 1) {
|
||||
terminalBridge.notifyMiddleClick(e.clientX, e.clientY, term.hasSelection());
|
||||
} else if (e.button == 2) {
|
||||
terminalBridge.notifyRightClick(e.clientX, e.clientY, term.hasSelection());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,5 +9,8 @@ namespace FluentTerminal.Models
|
||||
public bool UnderlineSelectedTab { get; set; }
|
||||
public NewTerminalLocation NewTerminalLocation { get; set; }
|
||||
public TabsPosition TabsPosition { get; set; }
|
||||
public bool CopyOnSelect { get; set; }
|
||||
public MouseAction MouseMiddleClickAction { get; set; }
|
||||
public MouseAction MouseRightClickAction { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace FluentTerminal.Models.Enums
|
||||
{
|
||||
public enum MouseAction
|
||||
{
|
||||
None,
|
||||
ContextMenu,
|
||||
Paste
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace FluentTerminal.RuntimeComponent.Enums
|
||||
{
|
||||
public enum MouseButton
|
||||
{
|
||||
Left,
|
||||
Middle,
|
||||
Right
|
||||
}
|
||||
}
|
||||
@@ -107,6 +107,7 @@
|
||||
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Enums\MouseButton.cs" />
|
||||
<Compile Include="Interfaces\ITerminalEventListener.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="WebAllowedObjects\TerminalBridge.cs" />
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
namespace FluentTerminal.RuntimeComponent.Interfaces
|
||||
using FluentTerminal.RuntimeComponent.Enums;
|
||||
|
||||
namespace FluentTerminal.RuntimeComponent.Interfaces
|
||||
{
|
||||
public interface ITerminalEventListener
|
||||
{
|
||||
@@ -8,6 +10,8 @@
|
||||
|
||||
void OnKeyboardCommand(string command);
|
||||
|
||||
void OnRightClick(int x, int y, bool hasSelection);
|
||||
void OnMouseClick(MouseButton mouseButton, int x, int y, bool hasSelection);
|
||||
|
||||
void OnSelectionChanged(string selection);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using FluentTerminal.RuntimeComponent.Interfaces;
|
||||
using FluentTerminal.RuntimeComponent.Enums;
|
||||
using FluentTerminal.RuntimeComponent.Interfaces;
|
||||
using Windows.Foundation.Metadata;
|
||||
|
||||
namespace FluentTerminal.RuntimeComponent.WebAllowedObjects
|
||||
@@ -30,7 +31,17 @@ namespace FluentTerminal.RuntimeComponent.WebAllowedObjects
|
||||
|
||||
public void NotifyRightClick(int x, int y, bool hasSelection)
|
||||
{
|
||||
_terminalEventListener.OnRightClick(x, y, hasSelection);
|
||||
_terminalEventListener.OnMouseClick(MouseButton.Right, x, y, hasSelection);
|
||||
}
|
||||
|
||||
public void NotifyMiddleClick(int x, int y, bool hasSelection)
|
||||
{
|
||||
_terminalEventListener.OnMouseClick(MouseButton.Middle, x, y, hasSelection);
|
||||
}
|
||||
|
||||
public void NotifySelectionChanged(string selection)
|
||||
{
|
||||
_terminalEventListener.OnSelectionChanged(selection);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ using System.Threading.Tasks;
|
||||
using Windows.ApplicationModel;
|
||||
using Windows.ApplicationModel.AppService;
|
||||
using Windows.Foundation.Collections;
|
||||
using System;
|
||||
|
||||
namespace FluentTerminal.SystemTray.Services
|
||||
{
|
||||
@@ -72,17 +73,21 @@ namespace FluentTerminal.SystemTray.Services
|
||||
_appServiceConnection = null;
|
||||
}
|
||||
|
||||
private void OnRequestReceived(AppServiceConnection sender, AppServiceRequestReceivedEventArgs args)
|
||||
private async void OnRequestReceived(AppServiceConnection sender, AppServiceRequestReceivedEventArgs args)
|
||||
{
|
||||
var messageType = (string)args.Request.Message[MessageKeys.Type];
|
||||
var messageContent = (string)args.Request.Message[MessageKeys.Content];
|
||||
|
||||
if (messageType == nameof(CreateTerminalRequest))
|
||||
{
|
||||
var deferral = args.GetDeferral();
|
||||
|
||||
var request = JsonConvert.DeserializeObject<CreateTerminalRequest>(messageContent);
|
||||
var response = _terminalsManager.CreateTerminal(request);
|
||||
|
||||
args.Request.SendResponseAsync(CreateMessage(response));
|
||||
await args.Request.SendResponseAsync(CreateMessage(response));
|
||||
|
||||
deferral.Complete();
|
||||
}
|
||||
else if (messageType == nameof(ResizeTerminalRequest))
|
||||
{
|
||||
@@ -105,7 +110,7 @@ namespace FluentTerminal.SystemTray.Services
|
||||
{
|
||||
var request = JsonConvert.DeserializeObject<TerminalExitedRequest>(messageContent);
|
||||
_terminalsManager.CloseTerminal(request.TerminalId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private ValueSet CreateMessage(object content)
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace FluentTerminal.SystemTray.Services
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return new CreateTerminalResponse { Error = e.Message };
|
||||
return new CreateTerminalResponse { Error = e.ToString() };
|
||||
}
|
||||
|
||||
terminal.ConnectionClosed += OnTerminalConnectionClosed;
|
||||
|
||||
Reference in new issue
Block a user