-
Notifications
You must be signed in to change notification settings - Fork 447
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
Dev/overlay control #278
Conversation
@@ -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"; |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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}");
}
There was a problem hiding this comment.
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?
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.