Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev/overlay control #278

Merged
merged 10 commits into from
Apr 9, 2019
Merged

Conversation

AndrewKralovec
Copy link
Contributor

This PR is to resolve issue 192. I created an Overlay Control & ViewModel to handle any text overlay messages needed on the terminal view. Currently this is used for two events, the terminal resize and the copied text.

image

image

@@ -335,6 +309,7 @@ private async void Terminal_KeyboardCommandReceived(object sender, string e)
{
var selection = await Terminal.GetSelectedText().ConfigureAwait(true);
ClipboardService.SetText(selection);
Overlay.OverlayContent = "Text copied";
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would make this configurable

Copy link
Contributor Author

@AndrewKralovec AndrewKralovec Apr 4, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you elaborate ? What do you mean by configurable?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not everybody might want to see this. I would add a toggle to the settings to activate/deactivate this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see now, yeah that is a good idea, Ill get on that.

Copy link
Contributor Author

@AndrewKralovec AndrewKralovec Apr 7, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@felixse , i was thinking about this feature. Instead of just adding a single toggle to the settings, would it be a good idea to create a list of possible overlay settings/events? The idea would be, create a list in the settings page. The list will have the possible overlay notifications (resize & text copied). This list will be bound to the terminal settings. You can toggle them on and off. In the Terminal View Model, we would pass this list to the overlay view model. Then continue to hook up the overlay events to the view, but instead of just sending a string in the show overlay, it would send an object, such as a dictionary of some sorts specifying the text and the settings name. In the overlay model, it would check the settings name to see if its in the list of events that are toggled on.

I was thinking this would make it more extensible, but if this is going to be a small feature, then it over kill.

Example/ proof of the concept.


public Dictionary<string, bool> OverlaySettings;
public TerminalPageViewModel()
{
    ... 
    // Would be moved to default settings
    OverlaySettings.Add("resize", false);
    OverlaySettings.Add("copied", false);
}


<StackPanel Margin="{StaticResource ItemMargin}">
    <TextBlock Margin="0,0,0,8" 
                Text="Overlay Notifications" />
    <ListView x:Name="listView1"
                ItemsSource="{x:Bind ViewModel.OverlaySettings}">
        <ListView.ItemTemplate>
            <DataTemplate >
                <ToggleSwitch
                    Margin="{StaticResource ItemMargin}"
                    Header="{Binding Key}"
                    IsOn="{Binding Value, Mode=TwoWay}" />
            </DataTemplate>
        </ListView.ItemTemplate>
    </ListView>
</StackPanel>

private void Terminal_SizeChanged(object sender, TerminalSize e)
{
    // Or whatever type is decided 
    Overlay.Show("resize", $"{e.Columns} x {e.Rows}");
    Overlay.Show(new { Name = "resize", Value = $"{e.Columns} x {e.Rows}" });
    OverlayEvent.?Invoke(this, $"{e.Columns} x {e.Rows}"); 
}

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

definitively possible, but I don't think there will be much more possible overlays. Maybe keep this in mind until a third overlay comes around?

FluentTerminal.App.ViewModels/OverlayViewModel.cs Outdated Show resolved Hide resolved
FluentTerminal.App.ViewModels/TerminalViewModel.cs Outdated Show resolved Hide resolved
@felixse felixse merged commit 0ea4722 into felixse:master Apr 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants