Compare commits

..
5 Commits
23 changed files with 283 additions and 206 deletions

No files matched your search

+2 -2
View File
@@ -222,9 +222,9 @@ namespace FluentTerminal.App
return windowId;
}
private void OnApplicationSettingsChanged(object sender, EventArgs e)
private void OnApplicationSettingsChanged(object sender, ApplicationSettings e)
{
_applicationSettings = _settingsService.GetApplicationSettings();
_applicationSettings = e;
}
private void OnMainViewModelClosed(object sender, EventArgs e)
@@ -139,7 +139,6 @@
<Compile Include="ViewModels\ShellProfileViewModel.cs" />
<Compile Include="ViewModels\ThemeViewModel.cs" />
<Compile Include="ViewModels\TerminalViewModel.cs" />
<Compile Include="Views\BindableColorsTitleBar.cs" />
<Compile Include="Views\ITerminalView.cs" />
<Compile Include="Views\KeyBindingsView.xaml.cs">
<DependentUpon>KeyBindingsView.xaml</DependentUpon>
+1 -1
View File
@@ -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.9.0" />
<Identity Name="53621FSApps.FluentTerminal" Publisher="CN=BDC72197-B634-438A-B863-16DCB7D90C85" Version="0.1.10.0" />
<mp:PhoneIdentity PhoneProductId="f7225014-f405-4342-ad2e-ebf6ac60ea2c" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
<Properties>
<DisplayName>Fluent Terminal</DisplayName>
@@ -6,10 +6,10 @@ namespace FluentTerminal.App.Services
{
public interface ISettingsService
{
event EventHandler CurrentThemeChanged;
event EventHandler TerminalOptionsChanged;
event EventHandler ApplicationSettingsChanged;
event EventHandler KeyBindingsChanged;
event EventHandler<Guid> CurrentThemeChanged;
event EventHandler<TerminalOptions> TerminalOptionsChanged;
event EventHandler<ApplicationSettings> ApplicationSettingsChanged;
event EventHandler<KeyBindings> KeyBindingsChanged;
Guid GetDefaultShellProfileId();
ShellProfile GetDefaultShellProfile();
@@ -158,8 +158,10 @@ namespace FluentTerminal.App.Services.Implementation
BellStyle = BellStyle.None,
CursorBlink = true,
CursorStyle = CursorStyle.Block,
ScrollBarStyle = ScrollBarStyle.Hidden,
FontFamily = "Consolas",
FontSize = 13
FontSize = 13,
BackgroundOpacity = 0.8
};
}
@@ -201,7 +203,6 @@ namespace FluentTerminal.App.Services.Implementation
Author = "xterm.js",
Name = "Xterm.js Default",
PreInstalled = true,
BackgroundOpacity = 0.8,
Colors = new TerminalColors
{
Black = "#2e3436",
@@ -234,7 +235,6 @@ namespace FluentTerminal.App.Services.Implementation
Author = "Microsoft",
Name = "PowerShell",
PreInstalled = true,
BackgroundOpacity = 0.8,
Colors = new TerminalColors
{
Black = "#000000",
@@ -267,7 +267,6 @@ namespace FluentTerminal.App.Services.Implementation
Author = "Hans Kokx",
Name = "Homebrew",
PreInstalled = true,
BackgroundOpacity = 0.8,
Colors = new TerminalColors
{
Black = "#000000",
@@ -21,10 +21,10 @@ namespace FluentTerminal.App.Services.Implementation
private readonly ApplicationDataContainer _shellProfiles;
private readonly ApplicationDataContainer _roamingSettings;
public event EventHandler CurrentThemeChanged;
public event EventHandler TerminalOptionsChanged;
public event EventHandler ApplicationSettingsChanged;
public event EventHandler KeyBindingsChanged;
public event EventHandler<Guid> CurrentThemeChanged;
public event EventHandler<TerminalOptions> TerminalOptionsChanged;
public event EventHandler<ApplicationSettings> ApplicationSettingsChanged;
public event EventHandler<KeyBindings> KeyBindingsChanged;
public SettingsService(IDefaultValueProvider defaultValueProvider)
{
@@ -65,7 +65,7 @@ namespace FluentTerminal.App.Services.Implementation
{
_roamingSettings.Values[CurrentThemeKey] = id;
CurrentThemeChanged?.Invoke(this, EventArgs.Empty);
CurrentThemeChanged?.Invoke(this, id);
}
public void SaveTheme(TerminalTheme theme)
@@ -74,7 +74,7 @@ namespace FluentTerminal.App.Services.Implementation
if (theme.Id == GetCurrentThemeId())
{
CurrentThemeChanged?.Invoke(this, EventArgs.Empty);
CurrentThemeChanged?.Invoke(this, theme.Id);
}
}
@@ -101,7 +101,7 @@ namespace FluentTerminal.App.Services.Implementation
public void SaveTerminalOptions(TerminalOptions terminalOptions)
{
_roamingSettings.WriteValueAsJson(nameof(TerminalOptions), terminalOptions);
TerminalOptionsChanged?.Invoke(this, EventArgs.Empty);
TerminalOptionsChanged?.Invoke(this, terminalOptions);
}
public ApplicationSettings GetApplicationSettings()
@@ -112,7 +112,7 @@ namespace FluentTerminal.App.Services.Implementation
public void SaveApplicationSettings(ApplicationSettings applicationSettings)
{
_roamingSettings.WriteValueAsJson(nameof(ApplicationSettings), applicationSettings);
ApplicationSettingsChanged?.Invoke(this, EventArgs.Empty);
ApplicationSettingsChanged?.Invoke(this, applicationSettings);
}
public KeyBindings GetKeyBindings()
@@ -136,7 +136,7 @@ namespace FluentTerminal.App.Services.Implementation
public void SaveKeyBindings(KeyBindings keyBindings)
{
_roamingSettings.WriteValueAsJson(nameof(KeyBindings), keyBindings);
KeyBindingsChanged?.Invoke(this, EventArgs.Empty);
KeyBindingsChanged?.Invoke(this, keyBindings);
}
public Guid GetDefaultShellProfileId()
+16 -8
View File
@@ -1,5 +1,4 @@
using FluentTerminal.App.Dialogs;
using FluentTerminal.App.Services;
using FluentTerminal.App.Services;
using FluentTerminal.Models;
using FluentTerminal.Models.Enums;
using GalaSoft.MvvmLight;
@@ -38,6 +37,7 @@ namespace FluentTerminal.App.ViewModels
_settingsService = settingsService;
_settingsService.CurrentThemeChanged += OnCurrentThemeChanged;
_settingsService.ApplicationSettingsChanged += OnApplicationSettingsChanged;
_settingsService.TerminalOptionsChanged += OnTerminalOptionsChanged;
_trayProcessCommunicationService = trayProcessCommunicationService;
_dialogService = dialogService;
_keyboardCommandService = keyboardCommandService;
@@ -49,8 +49,9 @@ namespace FluentTerminal.App.ViewModels
_keyboardCommandService.RegisterCommandHandler(Command.NewWindow, NewWindow);
_keyboardCommandService.RegisterCommandHandler(Command.ShowSettings, ShowSettings);
var currentTheme = _settingsService.GetCurrentTheme();
var options = _settingsService.GetTerminalOptions();
Background = currentTheme.Colors.Background;
BackgroundOpacity = currentTheme.BackgroundOpacity;
BackgroundOpacity = options.BackgroundOpacity;
_applicationSettings = _settingsService.GetApplicationSettings();
AddTerminalCommand = new RelayCommand(() => AddTerminal(null, false));
@@ -64,6 +65,14 @@ namespace FluentTerminal.App.ViewModels
SystemNavigationManagerPreview.GetForCurrentView().CloseRequested += OnCloseRequest;
}
private async void OnTerminalOptionsChanged(object sender, TerminalOptions e)
{
await _dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
{
BackgroundOpacity = e.BackgroundOpacity;
});
}
public RelayCommand AddTerminalCommand { get; }
public string Background
@@ -151,9 +160,9 @@ namespace FluentTerminal.App.ViewModels
NewWindowRequested?.Invoke(this, EventArgs.Empty);
}
private async void OnApplicationSettingsChanged(object sender, EventArgs e)
private async void OnApplicationSettingsChanged(object sender, ApplicationSettings e)
{
await _dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => _applicationSettings = _settingsService.GetApplicationSettings());
await _dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => _applicationSettings = e);
}
private async void OnCloseRequest(object sender, SystemNavigationCloseRequestedPreviewEventArgs e)
@@ -182,13 +191,12 @@ namespace FluentTerminal.App.ViewModels
deferral.Complete();
}
private async void OnCurrentThemeChanged(object sender, System.EventArgs e)
private async void OnCurrentThemeChanged(object sender, Guid e)
{
await _dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
{
var currentTheme = _settingsService.GetCurrentTheme();
var currentTheme = _settingsService.GetTheme(e);
Background = currentTheme.Colors.Background;
BackgroundOpacity = currentTheme.BackgroundOpacity;
});
}
@@ -17,6 +17,7 @@ namespace FluentTerminal.App.ViewModels.Settings
private readonly IDialogService _dialogService;
private readonly IDefaultValueProvider _defaultValueProvider;
private bool _isEditingCursorStyle;
private bool _isEditingScrollBarStyle;
public bool BarIsSelected
{
@@ -30,6 +31,30 @@ namespace FluentTerminal.App.ViewModels.Settings
set => CursorStyle = CursorStyle.Block;
}
public bool UnderlineIsSelected
{
get => CursorStyle == CursorStyle.Underline;
set => CursorStyle = CursorStyle.Underline;
}
public bool HiddenIsSelected
{
get => ScrollBarStyle == ScrollBarStyle.Hidden;
set => ScrollBarStyle = ScrollBarStyle.Hidden;
}
public bool AutoHidingIsSelected
{
get => ScrollBarStyle == ScrollBarStyle.AutoHiding;
set => ScrollBarStyle = ScrollBarStyle.AutoHiding;
}
public bool VisibleIsSelected
{
get => ScrollBarStyle == ScrollBarStyle.Visible;
set => ScrollBarStyle = ScrollBarStyle.Visible;
}
public bool CursorBlink
{
get => _terminalOptions.CursorBlink;
@@ -58,6 +83,20 @@ namespace FluentTerminal.App.ViewModels.Settings
}
}
public double BackgroundOpacity
{
get => _terminalOptions.BackgroundOpacity;
set
{
if (_terminalOptions.BackgroundOpacity != value)
{
_terminalOptions.BackgroundOpacity = value;
_settingsService.SaveTerminalOptions(_terminalOptions);
RaisePropertyChanged();
}
}
}
public IEnumerable<string> Fonts { get; }
public int FontSize
@@ -76,12 +115,6 @@ namespace FluentTerminal.App.ViewModels.Settings
public IEnumerable<int> Sizes { get; }
public bool UnderlineIsSelected
{
get => CursorStyle == CursorStyle.Underline;
set => CursorStyle = CursorStyle.Underline;
}
public RelayCommand RestoreDefaultsCommand { get; }
private CursorStyle CursorStyle
@@ -103,17 +136,38 @@ namespace FluentTerminal.App.ViewModels.Settings
}
}
private ScrollBarStyle ScrollBarStyle
{
get => _terminalOptions.ScrollBarStyle;
set
{
if (_terminalOptions.ScrollBarStyle != value && !_isEditingScrollBarStyle)
{
_isEditingScrollBarStyle = true;
_terminalOptions.ScrollBarStyle = value;
_settingsService.SaveTerminalOptions(_terminalOptions);
RaisePropertyChanged();
RaisePropertyChanged(nameof(HiddenIsSelected));
RaisePropertyChanged(nameof(AutoHidingIsSelected));
RaisePropertyChanged(nameof(VisibleIsSelected));
_isEditingScrollBarStyle = false;
}
}
}
private async Task RestoreDefaults()
{
var result = await _dialogService.ShowMessageDialogAsnyc("Please confirm", "Are you sure you want to restore the default terminal options?", DialogButton.OK, DialogButton.Cancel).ConfigureAwait(false);
var result = await _dialogService.ShowMessageDialogAsnyc("Please confirm", "Are you sure you want to restore the default terminal options?", DialogButton.OK, DialogButton.Cancel).ConfigureAwait(true);
if (result == DialogButton.OK)
{
var defaults = _defaultValueProvider.GetDefaultTerminalOptions();
CursorBlink = defaults.CursorBlink;
CursorStyle = defaults.CursorStyle;
ScrollBarStyle = defaults.ScrollBarStyle;
FontFamily = defaults.FontFamily;
FontSize = defaults.FontSize;
BackgroundOpacity = defaults.BackgroundOpacity;
}
}
@@ -14,6 +14,7 @@ namespace FluentTerminal.App.ViewModels.Settings
private readonly IDialogService _dialogService;
private readonly ISettingsService _settingsService;
private ThemeViewModel _selectedTheme;
private double _backgroundOpacity;
public ThemesPageViewModel(ISettingsService settingsService, IDialogService dialogService, IDefaultValueProvider defaultValueProvider)
{
@@ -23,6 +24,10 @@ namespace FluentTerminal.App.ViewModels.Settings
CreateThemeCommand = new RelayCommand(CreateTheme);
_settingsService.TerminalOptionsChanged += OnTerminalOptionsChanged;
BackgroundOpacity = _settingsService.GetTerminalOptions().BackgroundOpacity;
var activeThemeId = _settingsService.GetCurrentThemeId();
foreach (var theme in _settingsService.GetThemes())
{
@@ -40,8 +45,19 @@ namespace FluentTerminal.App.ViewModels.Settings
SelectedTheme = Themes.First(t => t.IsActive);
}
private void OnTerminalOptionsChanged(object sender, TerminalOptions e)
{
BackgroundOpacity = e.BackgroundOpacity;
}
public RelayCommand CreateThemeCommand { get; }
public double BackgroundOpacity
{
get => _backgroundOpacity;
set => Set(ref _backgroundOpacity, value);
}
public ThemeViewModel SelectedTheme
{
get => _selectedTheme;
@@ -58,7 +74,6 @@ namespace FluentTerminal.App.ViewModels.Settings
Id = Guid.NewGuid(),
PreInstalled = false,
Name = "New Theme",
BackgroundOpacity = defaultTheme.BackgroundOpacity,
Colors = new TerminalColors(defaultTheme.Colors)
};
@@ -64,12 +64,11 @@ namespace FluentTerminal.App.ViewModels
_dispatcher = CoreApplication.GetCurrentView().Dispatcher;
}
private async void OnKeyBindingsChanged(object sender, EventArgs e)
private async void OnKeyBindingsChanged(object sender, KeyBindings e)
{
await _dispatcher.RunAsync(CoreDispatcherPriority.Normal, async () =>
{
var keyBindings = _settingsService.GetKeyBindings();
await _terminalView.ChangeKeyBindings(GetKeyBindingsCollection(keyBindings)).ConfigureAwait(false);
await _terminalView.ChangeKeyBindings(GetKeyBindingsCollection(e)).ConfigureAwait(false);
});
}
@@ -201,16 +200,16 @@ namespace FluentTerminal.App.ViewModels
CloseRequested?.Invoke(this, EventArgs.Empty);
}
private async void OnApplicationSettingsChanged(object sender, EventArgs e)
private async void OnApplicationSettingsChanged(object sender, ApplicationSettings e)
{
await _dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => _applicationSettings = _settingsService.GetApplicationSettings());
await _dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => _applicationSettings = e);
}
private async void OnCurrentThemeChanged(object sender, EventArgs e)
private async void OnCurrentThemeChanged(object sender, Guid e)
{
await _dispatcher.RunAsync(CoreDispatcherPriority.Normal, async () =>
{
var currentTheme = _settingsService.GetCurrentTheme();
var currentTheme = _settingsService.GetTheme(e);
await _terminalView.ChangeTheme(currentTheme.Colors).ConfigureAwait(true);
});
}
@@ -253,12 +252,11 @@ namespace FluentTerminal.App.ViewModels
ShowResizeOverlay = false;
}
private async void OnTerminalOptionsChanged(object sender, EventArgs e)
private async void OnTerminalOptionsChanged(object sender, TerminalOptions e)
{
await _dispatcher.RunAsync(CoreDispatcherPriority.Normal, async () =>
{
var options = _settingsService.GetTerminalOptions();
await _terminalView.ChangeOptions(options).ConfigureAwait(true);
await _terminalView.ChangeOptions(e).ConfigureAwait(true);
});
}
@@ -31,7 +31,6 @@ namespace FluentTerminal.App.ViewModels
private Color _cursorAccent;
private Color _cyan;
private string _fallBackAuthor;
private double _fallBackBackgroundOpacity;
private TerminalColors _fallBackColors;
private string _fallBackName;
private Color _foreground;
@@ -55,7 +54,6 @@ namespace FluentTerminal.App.ViewModels
Name = _theme.Name;
Author = _theme.Author;
Id = _theme.Id;
BackgroundOpacity = _theme.BackgroundOpacity;
Black = _theme.Colors.Black.ToColor();
Red = _theme.Colors.Red.ToColor();
@@ -263,7 +261,6 @@ namespace FluentTerminal.App.ViewModels
{
_theme.Name = Name;
_theme.Author = Author;
_theme.BackgroundOpacity = BackgroundOpacity;
_theme.Colors.Black = Black.ToColorString(false);
_theme.Colors.Red = Red.ToColorString(false);
@@ -326,7 +323,6 @@ namespace FluentTerminal.App.ViewModels
Name = _fallBackName;
Author = _fallBackAuthor;
BackgroundOpacity = _fallBackBackgroundOpacity;
InEditMode = false;
}
@@ -357,7 +353,6 @@ namespace FluentTerminal.App.ViewModels
_fallBackColors = new TerminalColors(_theme.Colors);
_fallBackName = Name;
_fallBackAuthor = Author;
_fallBackBackgroundOpacity = BackgroundOpacity;
InEditMode = true;
}
@@ -1,100 +0,0 @@
using Windows.UI;
using Windows.UI.Core;
using Windows.UI.ViewManagement;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using System;
namespace FluentTerminal.App.Views
{
public sealed class BindableColorsTitleBar : Control
{
private readonly ApplicationViewTitleBar _titleBar;
private readonly UISettings _uiSettings;
private readonly CoreDispatcher _dispatcher;
private bool _customValues;
private Color? _buttonForeground;
private Color? _buttonHoverBackground;
private Color? _buttonPressedBackground;
private Color? _buttonHoverForeground;
private Color? _buttonPressedForeground;
private Color? _inactiveForeground;
public BindableColorsTitleBar()
{
_uiSettings = new UISettings();
_uiSettings.ColorValuesChanged += OnColorValuesChanged;
_titleBar = ApplicationView.GetForCurrentView().TitleBar;
_titleBar = ApplicationView.GetForCurrentView().TitleBar;
_titleBar.ButtonBackgroundColor = Colors.Transparent;
_titleBar.ButtonInactiveBackgroundColor = Colors.Transparent;
_titleBar.ButtonForegroundColor = (Color)Resources["SystemBaseHighColor"];
_dispatcher = Window.Current.Dispatcher;
_buttonHoverBackground = _titleBar.ButtonHoverBackgroundColor = Color.FromArgb(24, 255, 255, 255);
_buttonPressedBackground = _titleBar.ButtonPressedBackgroundColor = Color.FromArgb(48, 255, 255, 255);
}
private async void OnColorValuesChanged(UISettings sender, object args)
{
await _dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
{
if (!_customValues)
{
_titleBar.ButtonForegroundColor = (Color)Resources["SystemBaseHighColor"];
}
});
}
public Color TitleBarForeground
{
get { return (Color)GetValue(TitleBarForegroundProperty); }
set { SetValue(TitleBarForegroundProperty, value); }
}
public static readonly DependencyProperty TitleBarForegroundProperty =
DependencyProperty.Register(nameof(TitleBarForeground), typeof(Color), typeof(BindableColorsTitleBar), new PropertyMetadata(Colors.Transparent, TitleBarForegroundChanged));
private static void TitleBarForegroundChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs args)
{
if (dependencyObject is BindableColorsTitleBar titleBarControl)
{
var color = (Color)args.NewValue;
titleBarControl._buttonForeground = titleBarControl._titleBar.ButtonForegroundColor = color;
titleBarControl._buttonPressedForeground = titleBarControl._titleBar.ButtonPressedForegroundColor = color;
titleBarControl._buttonHoverForeground = titleBarControl._titleBar.ButtonHoverForegroundColor = color;
titleBarControl._inactiveForeground = titleBarControl._titleBar.InactiveForegroundColor = Color.FromArgb(128, color.R, color.G, color.B);
}
}
public void RestoreColors()
{
_titleBar.ButtonForegroundColor = _buttonForeground;
_titleBar.ButtonHoverBackgroundColor = _buttonHoverBackground;
_titleBar.ButtonPressedBackgroundColor = _buttonPressedBackground;
_titleBar.ButtonPressedForegroundColor = _buttonPressedForeground;
_titleBar.ButtonHoverForegroundColor = _buttonHoverForeground;
_titleBar.InactiveForegroundColor = _inactiveForeground;
_customValues = true;
}
public void ResetTitleBar()
{
_titleBar.ButtonForegroundColor = (Color)Resources["SystemBaseHighColor"];
_titleBar.ButtonHoverBackgroundColor = null;
_titleBar.ButtonPressedBackgroundColor = null;
_titleBar.ButtonPressedForegroundColor = null;
_titleBar.ButtonHoverForegroundColor = null;
_titleBar.InactiveForegroundColor = null;
_customValues = false;
}
}
}
@@ -1,7 +1,12 @@
using FluentTerminal.App.ViewModels;
using FluentTerminal.App.Views.SettingsPages;
using System.Linq;
using System;
using System.Threading.Tasks;
using Windows.ApplicationModel.Core;
using Windows.Foundation;
using Windows.UI;
using Windows.UI.Core;
using Windows.UI.Core.Preview;
using Windows.UI.ViewManagement;
using Windows.UI.Xaml;
@@ -12,6 +17,11 @@ namespace FluentTerminal.App.Views
{
public sealed partial class SettingsPage : Page
{
private readonly UISettings _uiSettings;
private readonly ApplicationViewTitleBar _titleBar;
private readonly CoreDispatcher _dispatcher;
private bool _onThemesPage;
public SettingsPage()
{
InitializeComponent();
@@ -26,9 +36,61 @@ namespace FluentTerminal.App.Views
coreTitleBar.LayoutMetricsChanged += TitleBar_LayoutMetricsChanged;
CoreTitleBarHeight = coreTitleBar.Height;
_titleBar = ApplicationView.GetForCurrentView().TitleBar;
_dispatcher = Window.Current.Dispatcher;
SetTitleBarColors();
_uiSettings = new UISettings();
_uiSettings.ColorValuesChanged += OnColorValuesChanged;
SystemNavigationManagerPreview.GetForCurrentView().CloseRequested += SettingsPage_CloseRequested;
}
private void OnColorValuesChanged(UISettings sender, object args)
{
if (_onThemesPage == false)
{
SetTitleBarColors();
}
}
private IAsyncAction SetTitleBarColors()
{
return _dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
{
_titleBar.ButtonBackgroundColor = Colors.Transparent;
_titleBar.ButtonInactiveBackgroundColor = Colors.Transparent;
_titleBar.ButtonForegroundColor = (Color)Resources["SystemBaseHighColor"];
_titleBar.ButtonHoverForegroundColor = (Color)Resources["SystemBaseHighColor"];
_titleBar.ButtonPressedForegroundColor = (Color)Resources["SystemBaseHighColor"];
if (Application.Current.RequestedTheme == ApplicationTheme.Light)
{
_titleBar.ButtonHoverBackgroundColor = (Color)Resources["SystemChromeMediumColor"];
_titleBar.ButtonPressedBackgroundColor = (Color)Resources["SystemChromeHighColor"];
}
else
{
_titleBar.ButtonHoverBackgroundColor = (Color)Resources["SystemChromeLowColor"];
_titleBar.ButtonPressedBackgroundColor = (Color)Resources["SystemChromeMediumLowColor"];
}
});
}
private IAsyncAction SetTitleBarColorsForThemesPage()
{
return _dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
{
_titleBar.ButtonBackgroundColor = Colors.Transparent;
_titleBar.ButtonInactiveBackgroundColor = Colors.Transparent;
_titleBar.ButtonForegroundColor = Colors.White;
_titleBar.ButtonHoverForegroundColor = Colors.White;
_titleBar.ButtonPressedForegroundColor = Colors.White;
_titleBar.ButtonHoverBackgroundColor = Color.FromArgb(24, 255, 255, 255);
_titleBar.ButtonPressedBackgroundColor = Color.FromArgb(48, 255, 255, 255);
});
}
public double CoreTitleBarHeight { get; }
public SettingsViewModel ViewModel { get; private set; }
@@ -48,6 +110,8 @@ namespace FluentTerminal.App.Views
private void NavigationView_SelectionChanged(NavigationView sender, NavigationViewSelectionChangedEventArgs args)
{
_onThemesPage = false;
if (args.SelectedItem is NavigationViewItem item)
{
switch (item.Tag)
@@ -62,6 +126,7 @@ namespace FluentTerminal.App.Views
case "themes":
ContentFrame.Navigate(typeof(ThemeSettings), ViewModel.Themes);
_onThemesPage = true;
break;
case "terminal":
@@ -73,6 +138,15 @@ namespace FluentTerminal.App.Views
break;
}
}
if (_onThemesPage)
{
SetTitleBarColorsForThemesPage();
}
else
{
SetTitleBarColors();
}
}
private void SettingsPage_CloseRequested(object sender, SystemNavigationCloseRequestedPreviewEventArgs e)
@@ -135,7 +135,7 @@
Header="Name"
IsEnabled="{x:Bind InEditMode, Mode=OneWay}"
IsSpellCheckEnabled="False"
Text="{x:Bind Arguments, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
Text="{x:Bind Name, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
<StackPanel Margin="0,24,0,0" Orientation="Horizontal">
<TextBox
@@ -34,27 +34,61 @@
Label="Restore Defaults" />
</CommandBar>
</Grid>
<StackPanel Grid.Row="2" Margin="24,0,0,0">
<ComboBox
Width="200"
Margin="0,0,0,24"
Header="Font Family"
ItemsSource="{x:Bind ViewModel.Fonts}"
SelectedValue="{x:Bind ViewModel.FontFamily, Mode=TwoWay}" />
<ComboBox
Width="200"
Margin="0,0,0,24"
Header="Font Size"
ItemsSource="{x:Bind ViewModel.Sizes}"
SelectedValue="{x:Bind ViewModel.FontSize, Mode=TwoWay}" />
<ToggleSwitch
Margin="0,0,0,24"
Header="Blinking Cursor"
IsOn="{x:Bind ViewModel.CursorBlink, Mode=TwoWay}" />
<TextBlock Margin="0,0,0,8" Text="Cursor Style" />
<RadioButton Content="Block" IsChecked="{x:Bind ViewModel.BlockIsSelected, Mode=TwoWay}" />
<RadioButton Content="Underline" IsChecked="{x:Bind ViewModel.UnderlineIsSelected, Mode=TwoWay}" />
<RadioButton Content="Bar" IsChecked="{x:Bind ViewModel.BarIsSelected, Mode=TwoWay}" />
</StackPanel>
<ScrollViewer Grid.Row="2" Margin="24,0,0,0">
<StackPanel>
<ComboBox
Width="200"
Margin="0,0,0,24"
Header="Font family"
ItemsSource="{x:Bind ViewModel.Fonts}"
SelectedValue="{x:Bind ViewModel.FontFamily, Mode=TwoWay}" />
<ComboBox
Width="200"
Margin="0,0,0,24"
Header="Font size"
ItemsSource="{x:Bind ViewModel.Sizes}"
SelectedValue="{x:Bind ViewModel.FontSize, Mode=TwoWay}" />
<Slider
Width="200"
Margin="0,0,0,24"
HorizontalAlignment="Left"
Header="Background opacity"
Maximum="1"
Minimum="0"
StepFrequency="0.01"
Value="{x:Bind ViewModel.BackgroundOpacity, Mode=TwoWay}" />
<ToggleSwitch
Margin="0,0,0,24"
Header="Blinking cursor"
IsOn="{x:Bind ViewModel.CursorBlink, Mode=TwoWay}" />
<TextBlock Margin="0,0,0,8" Text="Cursor style" />
<RadioButton
Content="Block"
GroupName="Cursor"
IsChecked="{x:Bind ViewModel.BlockIsSelected, Mode=TwoWay}" />
<RadioButton
Content="Underline"
GroupName="Cursor"
IsChecked="{x:Bind ViewModel.UnderlineIsSelected, Mode=TwoWay}" />
<RadioButton
Content="Bar"
GroupName="Cursor"
IsChecked="{x:Bind ViewModel.BarIsSelected, Mode=TwoWay}" />
<TextBlock Margin="0,24,0,8" Text="Scrollbar style" />
<RadioButton
Content="Hidden"
GroupName="ScrollBar"
IsChecked="{x:Bind ViewModel.HiddenIsSelected, Mode=TwoWay}" />
<RadioButton
Content="Auto hiding"
GroupName="ScrollBar"
IsChecked="{x:Bind ViewModel.AutoHidingIsSelected, Mode=TwoWay}" />
<RadioButton
Content="Visible"
GroupName="ScrollBar"
IsChecked="{x:Bind ViewModel.VisibleIsSelected, Mode=TwoWay}" />
</StackPanel>
</ScrollViewer>
</Grid>
</Page>
@@ -13,7 +13,7 @@
BackgroundSource="HostBackdrop"
FallbackColor="{x:Bind ViewModel.SelectedTheme.Background, Mode=OneWay}"
TintColor="{x:Bind ViewModel.SelectedTheme.Background, Mode=OneWay}"
TintOpacity="{x:Bind ViewModel.SelectedTheme.BackgroundOpacity, Mode=OneWay}" />
TintOpacity="{x:Bind ViewModel.BackgroundOpacity, Mode=OneWay}" />
</Grid.Background>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="160" />
@@ -24,7 +24,6 @@
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<views:BindableColorsTitleBar x:Name="TitleBar" TitleBarForeground="White" />
<Border
Grid.RowSpan="3"
Grid.Column="0"
@@ -133,7 +132,7 @@
Margin="0,0,6,0">
<SymbolIcon Symbol="Add" />
</Viewbox>
<TextBlock Text="Create new" Style="{StaticResource CaptionTextBlockStyle}" />
<TextBlock Style="{StaticResource CaptionTextBlockStyle}" Text="Create new" />
</StackPanel>
</Button.Content>
</Button>
@@ -282,15 +281,6 @@
Text="Click on a color to edit"
Visibility="{x:Bind InEditMode, Mode=OneWay, Converter={StaticResource TrueToVisibleConverter}}" />
</Grid>
<Slider
Margin="0,24,0,0"
Header="Background Opacity"
Maximum="1"
Minimum="0"
RequestedTheme="Dark"
StepFrequency="0.01"
Visibility="{x:Bind InEditMode, Mode=OneWay, Converter={StaticResource TrueToVisibleConverter}}"
Value="{x:Bind BackgroundOpacity, Mode=TwoWay}" />
</StackPanel>
</DataTemplate>
</ContentControl.ContentTemplate>
@@ -20,12 +20,6 @@ namespace FluentTerminal.App.Views.SettingsPages
{
ViewModel = viewModel;
}
TitleBar.RestoreColors();
}
protected override void OnNavigatedFrom(NavigationEventArgs e)
{
TitleBar.ResetTitleBar();
}
}
}
+1 -4
View File
@@ -12,10 +12,7 @@
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid
x:Name="WebViewContainer"
Grid.Row="0"
Margin="12" />
<Grid x:Name="WebViewContainer" Grid.Row="0" />
<Grid
Grid.Row="0"
Margin="12"
+14
View File
@@ -25,6 +25,8 @@ function createTerminal(options, theme, keyBindings) {
options = JSON.parse(options);
setScrollBarStyle(options.scrollBarStyle);
var terminalOptions = {
fontFamily: options.fontFamily,
fontSize: options.fontSize,
@@ -121,6 +123,18 @@ function changeOptions(options) {
term.setOption('cursorStyle', options.cursorStyle);
term.setOption('fontFamily', options.fontFamily);
term.setOption('fontSize', options.fontSize);
setScrollBarStyle(options.scrollBarStyle);
}
function setScrollBarStyle(scrollBarStyle) {
if (scrollBarStyle == 'hidden') {
document.getElementById('terminal-container').style['-ms-overflow-style'] = 'none';
} else if (scrollBarStyle == 'autoHiding') {
document.getElementById('terminal-container').style['-ms-overflow-style'] = '-ms-autohiding-scrollbar';
} else if (scrollBarStyle == 'visible') {
document.getElementById('terminal-container').style['-ms-overflow-style'] = 'scrollbar';
}
}
function changeKeyBindings(keyBindings) {
+2 -8
View File
@@ -2,23 +2,17 @@
margin: 0;
}
html {
-ms-overflow-style: none;
html, body {
background: transparent;
height: 100%;
}
body {
background: transparent;
height: 100%;
}
#terminal-container {
width: 100%;
height: 100%;
margin: 0;
}
.terminal {
background: transparent !important;
padding: 12px;
}
@@ -0,0 +1,9 @@
namespace FluentTerminal.Models.Enums
{
public enum ScrollBarStyle
{
Hidden,
AutoHiding,
Visible
}
}
+4
View File
@@ -13,5 +13,9 @@ namespace FluentTerminal.Models
public bool CursorBlink { get; set; }
public BellStyle BellStyle { get; set; }
public ScrollBarStyle ScrollBarStyle { get; set; }
public double BackgroundOpacity { get; set; }
}
}
-1
View File
@@ -8,7 +8,6 @@ namespace FluentTerminal.Models
public string Name { get; set; }
public string Author { get; set; }
public bool PreInstalled { get; set; }
public double BackgroundOpacity { get; set; }
public TerminalColors Colors { get; set; }
}
}