Skip to content

Commit 0265883

Browse files
committed
enhance: notification popup
1 parent 6eb226e commit 0265883

File tree

3 files changed

+23
-5
lines changed

3 files changed

+23
-5
lines changed

src/Commands/Command.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,11 @@ public bool Exec()
7474
}
7575

7676
if (string.IsNullOrEmpty(e.Data))
77+
{
78+
errs.Add(string.Empty);
7779
return;
80+
}
81+
7882
if (TraitErrorAsOutput)
7983
OnReadline(e.Data);
8084

@@ -89,6 +93,7 @@ public bool Exec()
8993
return;
9094
if (REG_PROGRESS().IsMatch(e.Data))
9195
return;
96+
9297
errs.Add(e.Data);
9398
};
9499

src/Views/LauncherPage.axaml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,19 +112,24 @@
112112
<Border Margin="6" HorizontalAlignment="Stretch" VerticalAlignment="Top" Effect="drop-shadow(0 0 8 #8F000000)">
113113
<Border Padding="8" CornerRadius="6" Background="{DynamicResource Brush.Popup}">
114114
<Grid RowDefinitions="26,Auto">
115-
<Grid Grid.Row="0" ColumnDefinitions="Auto,*,Auto" Margin="8,0">
115+
<Grid Grid.Row="0" ColumnDefinitions="Auto,*,Auto,Auto" Margin="8,0">
116116
<Path Grid.Column="0" Width="14" Height="14" Data="{StaticResource Icons.Error}" Fill="Red" IsVisible="{Binding IsError}"/>
117117
<Path Grid.Column="0" Width="14" Height="14" Data="{StaticResource Icons.Info}" Fill="Green" IsVisible="{Binding !IsError}"/>
118118
<TextBlock Grid.Column="1" Margin="8,0,0,0" FontWeight="Bold" FontSize="14" Text="{DynamicResource Text.Launcher.Error}" IsVisible="{Binding IsError}"/>
119119
<TextBlock Grid.Column="1" Margin="8,0,0,0" FontWeight="Bold" FontSize="14" Text="{DynamicResource Text.Launcher.Info}" IsVisible="{Binding !IsError}"/>
120-
<Button Grid.Column="2" Classes="icon_button" Width="16" Height="16" Click="OnDismissNotification">
120+
<Button Grid.Column="2" Classes="icon_button" Width="16" Height="16" Click="OnCopyNotification">
121+
<Path Width="12" Height="12" Data="{StaticResource Icons.Copy}"/>
122+
</Button>
123+
<Button Grid.Column="3" Classes="icon_button" Width="16" Height="16" Margin="8,0,0,0" Click="OnDismissNotification">
121124
<Path Width="10" Height="10" Data="{StaticResource Icons.Window.Close}"/>
122125
</Button>
123126
</Grid>
124127

125-
<ScrollViewer Grid.Row="1" Margin="8" MaxHeight="100" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
126-
<SelectableTextBlock TextWrapping="Wrap" Text="{Binding Message}"/>
127-
</ScrollViewer>
128+
<Border Grid.Row="1" Margin="8" Background="{DynamicResource Brush.Contents}" BorderThickness="1" BorderBrush="{DynamicResource Brush.Border2}">
129+
<ScrollViewer MaxHeight="200" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
130+
<TextBlock Margin="4,2" TextWrapping="NoWrap" Text="{Binding Message}"/>
131+
</ScrollViewer>
132+
</Border>
128133
</Grid>
129134
</Border>
130135
</Border>

src/Views/LauncherPage.axaml.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,14 @@ private void OnMaskClicked(object sender, PointerPressedEventArgs e)
3232
OnPopupCancel(sender, e);
3333
}
3434

35+
private void OnCopyNotification(object sender, RoutedEventArgs e)
36+
{
37+
if (sender is Button { DataContext: Models.Notification notice })
38+
App.CopyText(notice.Message);
39+
40+
e.Handled = true;
41+
}
42+
3543
private void OnDismissNotification(object sender, RoutedEventArgs e)
3644
{
3745
if (sender is Button { DataContext: Models.Notification notice } &&

0 commit comments

Comments
 (0)