Skip to content

Commit

Permalink
Felixse master (felixse#25)
Browse files Browse the repository at this point in the history
* Un-swap Ubuntu yellow and cyan (felixse#291)

The build-in Ubuntu profile has the yellows and cyans swapped. This fixes that.

* Add dark and light mode SVG icons for felixse#203 (felixse#290)

* Ap/ssh Implemented SSH by using the exsting infrastructure (felixse#293)

* Appveyor builds (felixse#6)

* SSH implemented.

* Implementing SSH by using the existing app infrastructure.

* Refactored to new command instead of a profile

* Update .gitignore

* fix: new line bug in verbatim string (felixse#294)

* Read whole terminal frame at once to avoid console data append glitches (felixse#299)

* Read whole terminal frame at once to avoid console data append glitches

* Simplify calculation logic with Math.Max

* Move back referencing <None Include="FluentTerminal.App_TemporaryKey.pfx" /> since it's used during AppVeyor GitHub Releases deployment

* Dev/overlay control (felixse#278)

* Creating a control for the overlay

* using Interactivity

* trying to bind by reference

* fix bindings

* remove unused packages

* Move getter/setter to show method

* Convert to AutoProperty

* Make text copied notification configurable

* cache settings, removed unused file

* Less conflicting default keybindings (felixse#309)

Many of FluentTerminal's default keybindings collide with commonly used
default keys in various terminal apps. Use defaults that are less likely
to cause problems to provide a better out-of-the-box experience. Many of
the bindings are inspired by gnome-terminal's defaults.

Also, the `false` modifiers in the default keybinding specifications
have been removed. This makes it easier to see which modifiers are
actually in use.
  • Loading branch information
maxhora authored Apr 10, 2019
1 parent 9b406f6 commit 089fb24
Show file tree
Hide file tree
Showing 11 changed files with 151 additions and 86 deletions.
49 changes: 13 additions & 36 deletions FluentTerminal.App.Services/Implementation/DefaultValueProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ public ICollection<KeyBinding> GetDefaultKeyBindings(Command command)
new KeyBinding
{
Command = nameof(Command.ToggleWindow),
Ctrl = false,
Alt = false,
Shift = false,
Key = (int)ExtendedVirtualKey.Scroll
}
};
Expand All @@ -52,8 +49,6 @@ public ICollection<KeyBinding> GetDefaultKeyBindings(Command command)
{
Command = nameof(Command.NextTab),
Ctrl = true,
Alt = false,
Shift = false,
Key = (int)ExtendedVirtualKey.Tab
}
};
Expand All @@ -65,7 +60,6 @@ public ICollection<KeyBinding> GetDefaultKeyBindings(Command command)
{
Command = nameof(Command.PreviousTab),
Ctrl = true,
Alt = false,
Shift = true,
Key = (int)ExtendedVirtualKey.Tab
}
Expand All @@ -85,9 +79,7 @@ public ICollection<KeyBinding> GetDefaultKeyBindings(Command command)
new KeyBinding
{
Command = command.ToString(),
Ctrl = true,
Alt = false,
Shift = false,
Alt = true,
Key = (int)ExtendedVirtualKey.Number1 + (command - Command.SwitchToTerm1)
}
};
Expand All @@ -99,8 +91,7 @@ public ICollection<KeyBinding> GetDefaultKeyBindings(Command command)
{
Command = nameof(Command.NewTab),
Ctrl = true,
Alt = false,
Shift = false,
Shift = true,
Key = (int)ExtendedVirtualKey.T
}
};
Expand All @@ -112,8 +103,7 @@ public ICollection<KeyBinding> GetDefaultKeyBindings(Command command)
{
Command = nameof(Command.ConfigurableNewTab),
Ctrl = true,
Alt = false,
Shift = true,
Alt = true,
Key = (int)ExtendedVirtualKey.T
}
};
Expand All @@ -138,7 +128,6 @@ public ICollection<KeyBinding> GetDefaultKeyBindings(Command command)
{
Command = nameof(Command.ChangeTabTitle),
Ctrl = true,
Alt = false,
Shift = true,
Key = (int)ExtendedVirtualKey.R
}
Expand All @@ -151,8 +140,7 @@ public ICollection<KeyBinding> GetDefaultKeyBindings(Command command)
{
Command = nameof(Command.CloseTab),
Ctrl = true,
Alt = false,
Shift = false,
Shift = true,
Key = (int)ExtendedVirtualKey.W
}
};
Expand All @@ -164,8 +152,7 @@ public ICollection<KeyBinding> GetDefaultKeyBindings(Command command)
{
Command = nameof(Command.NewWindow),
Ctrl = true,
Alt = false,
Shift = false,
Shift = true,
Key = (int)ExtendedVirtualKey.N
}
};
Expand All @@ -177,8 +164,7 @@ public ICollection<KeyBinding> GetDefaultKeyBindings(Command command)
{
Command = nameof(Command.ConfigurableNewWindow),
Ctrl = true,
Alt = false,
Shift = true,
Alt = true,
Key = (int)ExtendedVirtualKey.N
}
};
Expand All @@ -190,8 +176,7 @@ public ICollection<KeyBinding> GetDefaultKeyBindings(Command command)
{
Command = nameof(Command.ShowSettings),
Ctrl = true,
Alt = false,
Shift = false,
Shift = true,
Key = (int)ExtendedVirtualKey.Comma
}
};
Expand All @@ -203,8 +188,7 @@ public ICollection<KeyBinding> GetDefaultKeyBindings(Command command)
{
Command = nameof(Command.Copy),
Ctrl = true,
Alt = false,
Shift = false,
Shift = true,
Key = (int)ExtendedVirtualKey.C
}
};
Expand All @@ -216,8 +200,7 @@ public ICollection<KeyBinding> GetDefaultKeyBindings(Command command)
{
Command = nameof(Command.Paste),
Ctrl = true,
Alt = false,
Shift = false,
Shift = true,
Key = (int)ExtendedVirtualKey.V
}
};
Expand All @@ -230,8 +213,7 @@ public ICollection<KeyBinding> GetDefaultKeyBindings(Command command)
{
Command = nameof(Command.PasteWithoutNewlines),
Ctrl = true,
Alt = false,
Shift = true,
Alt = true,
Key = (int)ExtendedVirtualKey.V
}
};
Expand All @@ -243,8 +225,7 @@ public ICollection<KeyBinding> GetDefaultKeyBindings(Command command)
{
Command = nameof(Command.Search),
Ctrl = true,
Alt = false,
Shift = false,
Shift = true,
Key = (int)ExtendedVirtualKey.F
}
};
Expand All @@ -255,9 +236,7 @@ public ICollection<KeyBinding> GetDefaultKeyBindings(Command command)
new KeyBinding
{
Command = nameof(Command.ToggleFullScreen),
Ctrl = false,
Alt = true,
Shift = false,
Key = (int)ExtendedVirtualKey.Enter
}
};
Expand All @@ -269,8 +248,7 @@ public ICollection<KeyBinding> GetDefaultKeyBindings(Command command)
{
Command = nameof(Command.SelectAll),
Ctrl = true,
Alt = false,
Shift = false,
Shift = true,
Key = (int)ExtendedVirtualKey.A
}
};
Expand All @@ -282,8 +260,7 @@ public ICollection<KeyBinding> GetDefaultKeyBindings(Command command)
{
Command = nameof(Command.Clear),
Ctrl = true,
Alt = false,
Shift = false,
Alt = true,
Key = (int)ExtendedVirtualKey.L
}
};
Expand Down
51 changes: 51 additions & 0 deletions FluentTerminal.App.ViewModels/OverlayViewModel.cs
Original file line number Diff line number Diff line change
@@ -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;
}

}
}
15 changes: 15 additions & 0 deletions FluentTerminal.App.ViewModels/Settings/TerminalPageViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,20 @@ public bool BoldText
}
}

public bool ShowTextCopied
{
get => _terminalOptions.ShowTextCopied;
set
{
if (_terminalOptions.ShowTextCopied != value)
{
_terminalOptions.ShowTextCopied = value;
_settingsService.SaveTerminalOptions(_terminalOptions);
RaisePropertyChanged();
}
}
}

public IEnumerable<FontInfo> Fonts { get; }

public int FontSize
Expand Down Expand Up @@ -223,6 +237,7 @@ private async Task RestoreDefaults()
BoldText = defaults.BoldText;
BackgroundOpacity = defaults.BackgroundOpacity;
ScrollBackLimit = defaults.ScrollBackLimit.ToString();
ShowTextCopied = defaults.ShowTextCopied;
}
}

Expand Down
52 changes: 14 additions & 38 deletions FluentTerminal.App.ViewModels/TerminalViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -38,6 +36,8 @@ public TerminalViewModel(ISettingsService settingsService, ITrayProcessCommunica
SettingsService.ApplicationSettingsChanged += OnApplicationSettingsChanged;
SettingsService.KeyBindingsChanged += OnKeyBindingsChanged;

_terminalOptions = SettingsService.GetTerminalOptions();

TrayProcessCommunicationService = trayProcessCommunicationService;

DialogService = dialogService;
Expand All @@ -52,10 +52,6 @@ public TerminalViewModel(ISettingsService settingsService, ITrayProcessCommunica
TabThemes = new ObservableCollection<TabTheme>(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);
Expand All @@ -69,6 +65,9 @@ public TerminalViewModel(ISettingsService settingsService, ITrayProcessCommunica
Terminal.SizeChanged += Terminal_SizeChanged;
Terminal.TitleChanged += Terminal_TitleChanged;
Terminal.Closed += Terminal_Closed;

Overlay = new OverlayViewModel(dispatcherTimer);

}

public event EventHandler Activated;
Expand Down Expand Up @@ -135,12 +134,6 @@ public bool HasNewOutput
set => Set(ref _hasNewOutput, value);
}

public string ResizeOverlayContent
{
get => _resizeOverlayContent;
set => Set(ref _resizeOverlayContent, value);
}

public string SearchText
{
get => _searchText;
Expand All @@ -153,23 +146,6 @@ public string SearchText

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;
Expand All @@ -191,6 +167,8 @@ public TabTheme TabTheme

public Terminal Terminal { get; private set; }

public OverlayViewModel Overlay { get; private set; }

public TerminalTheme TerminalTheme
{
get => _terminalTheme;
Expand Down Expand Up @@ -306,14 +284,9 @@ private async void OnKeyBindingsChanged(object sender, EventArgs e)
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));
}

Expand All @@ -335,6 +308,10 @@ private async void Terminal_KeyboardCommandReceived(object sender, string e)
{
var selection = await Terminal.GetSelectedText().ConfigureAwait(true);
ClipboardService.SetText(selection);
if(_terminalOptions.ShowTextCopied)
{
Overlay.Show("Text copied");
}
break;
}
case nameof(Command.Paste):
Expand Down Expand Up @@ -384,8 +361,7 @@ private void Terminal_OutputReceived(object sender, byte[] e)

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)
Expand Down
Loading

0 comments on commit 089fb24

Please sign in to comment.