Skip to content

Commit 386987f

Browse files
committed
Open in... Menu
New Icons
1 parent cde5fc8 commit 386987f

File tree

9 files changed

+72
-22
lines changed

9 files changed

+72
-22
lines changed

src/SourceGit/Native/Linux.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System.Diagnostics;
1+
using System;
2+
using System.Diagnostics;
23
using System.IO;
34
using System.Runtime.Versioning;
45

@@ -30,14 +31,15 @@ public string FindGitExecutable()
3031

3132
public string FindVSCode()
3233
{
33-
if (File.Exists("/usr/share/code/code")) return "/usr/share/code/code";
34+
var toolPath = "/usr/share/code/code";
35+
if (File.Exists(toolPath)) return toolPath;
3436
return string.Empty;
3537
}
3638

3739
public string FindFleet()
3840
{
39-
var path = "~/.local/share/JetBrains/Toolbox/apps/fleet/bin/Fleet";
40-
if (File.Exists(path)) return path;
41+
var toolPath = $"{Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)}/.local/share/JetBrains/Toolbox/apps/fleet/bin/Fleet";
42+
if (File.Exists(toolPath)) return toolPath;
4143
return string.Empty;
4244
}
4345

src/SourceGit/Native/Windows.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,15 +103,15 @@ public string FindGitExecutable()
103103

104104
public string FindVSCode()
105105
{
106-
var vscodePath = Environment.ExpandEnvironmentVariables("%USERPROFILE%\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe");
107-
if (File.Exists(vscodePath)) return vscodePath;
106+
var toolPath = Environment.ExpandEnvironmentVariables($"{Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)}\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe");
107+
if (File.Exists(toolPath)) return toolPath;
108108
return string.Empty;
109109
}
110110

111111
public string FindFleet()
112112
{
113-
var vscodePath = Environment.ExpandEnvironmentVariables("%USERPROFILE%\\AppData\\Local\\Programs\\Fleet\\Fleet.exe");
114-
if (File.Exists(vscodePath)) return vscodePath;
113+
var toolPath = Environment.ExpandEnvironmentVariables($"{Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)}\\AppData\\Local\\Programs\\Fleet\\Fleet.exe");
114+
if (File.Exists(toolPath)) return toolPath;
115115
return string.Empty;
116116
}
117117

Lines changed: 13 additions & 0 deletions
Loading

src/SourceGit/Resources/Icons.axaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@
8080
<StreamGeometry x:Key="Icons.Eye">M520 168C291 168 95 311 16 512c79 201 275 344 504 344 229 0 425-143 504-344-79-201-275-344-504-344zm0 573c-126 0-229-103-229-229s103-229 229-229c126 0 229 103 229 229s-103 229-229 229zm0-367c-76 0-137 62-137 137s62 137 137 137S657 588 657 512s-62-137-137-137z</StreamGeometry>
8181
<StreamGeometry x:Key="Icons.EyeClose">M734 128c-33-19-74-8-93 25l-41 70c-28-6-58-9-90-9-294 0-445 298-445 298s82 149 231 236l-31 54c-19 33-8 74 25 93 33 19 74 8 93-25L759 222C778 189 767 147 734 128zM305 512c0-115 93-208 207-208 14 0 27 1 40 4l-37 64c-1 0-2 0-2 0-77 0-140 63-140 140 0 26 7 51 20 71l-37 64C324 611 305 564 305 512zM771 301 700 423c13 27 20 57 20 89 0 110-84 200-192 208l-51 89c12 1 24 2 36 2 292 0 446-298 446-298S895 388 771 301z</StreamGeometry>
8282
<StreamGeometry x:Key="Icons.Empty">M469 235V107h85v128h-85zm-162-94 85 85-60 60-85-85 60-60zm469 60-85 85-60-60 85-85 60 60zm-549 183A85 85 0 01302 341H722a85 85 0 0174 42l131 225A85 85 0 01939 652V832a85 85 0 01-85 85H171a85 85 0 01-85-85v-180a85 85 0 0112-43l131-225zM722 427H302l-100 171h255l10 29a59 59 0 002 5c2 4 5 9 9 14 8 9 18 17 34 17 16 0 26-7 34-17a72 72 0 0011-18l0-0 10-29h255l-100-171zM853 683H624a155 155 0 01-12 17C593 722 560 747 512 747c-48 0-81-25-99-47a155 155 0 01-12-17H171v149h683v-149z</StreamGeometry>
83-
<StreamGeometry x:Key="Icons.VSCode">M719 85 388 417l-209-165L87 299v427l92 47 210-164L720 939 939 850V171zM186 610V412l104 104zm526 55L514 512l198-153z</StreamGeometry>
8483
<StreamGeometry x:Key="Icons.Statistics">M447 561a26 26 0 0126 26v171H421v-171a26 26 0 0126-26zm-98 65a26 26 0 0126 26v104H323v-104a26 26 0 0126-26zm0 0M561 268a32 32 0 0132 30v457h-65V299a32 32 0 0132-32zm0 0M675 384a26 26 0 0126 26v348H649v-350a26 26 0 0126-24zm0 0M801 223v579H223V223h579M805 171H219A49 49 0 00171 219v585A49 49 0 00219 853h585A49 49 0 00853 805V219A49 49 0 00805 171z</StreamGeometry>
8584
<StreamGeometry x:Key="Icons.Hotkeys">M512 0C229.216 0 0 229.216 0 512c0 282.752 229.216 512 512 512s512-229.248 512-512c0-282.784-229.216-512-512-512z m0 957.92C266.112 957.92 66.08 757.888 66.08 512S266.112 66.08 512 66.08 957.92 266.112 957.92 512 757.888 957.92 512 957.92zM192 416h96a32 32 0 0 0 32-32v-32a32 32 0 0 0-32-32H192a32 32 0 0 0-32 32v32a32 32 0 0 0 32 32zM384 416h96a32 32 0 0 0 32-32v-32a32 32 0 0 0-32-32h-96a32 32 0 0 0-32 32v32a32 32 0 0 0 32 32zM576 416h96a32 32 0 0 0 32-32v-32a32 32 0 0 0-32-32h-96a32 32 0 0 0-32 32v32a32 32 0 0 0 32 32zM832 320h-64a32 32 0 0 0-32 32v128h-160a32 32 0 0 0-32 32v32a32 32 0 0 0 32 32h256a32 32 0 0 0 32-32v-192a32 32 0 0 0-32-32zM320 544v-32a32 32 0 0 0-32-32H192a32 32 0 0 0-32 32v32a32 32 0 0 0 32 32h96a32 32 0 0 0 32-32zM384 576h96a32 32 0 0 0 32-32v-32a32 32 0 0 0-32-32h-96a32 32 0 0 0-32 32v32a32 32 0 0 0 32 32zM800 640H256a32 32 0 0 0-32 32v32a32 32 0 0 0 32 32h544a32 32 0 0 0 32-32v-32a32 32 0 0 0-32-32z</StreamGeometry>
8685
<StreamGeometry x:Key="Icons.LayoutHorizontal">M875 117H149C109 117 75 151 75 192v640c0 41 34 75 75 75h725c41 0 75-34 75-75V192c0-41-34-75-75-75zM139 832V192c0-6 4-11 11-11h331v661H149c-6 0-11-4-11-11zm747 0c0 6-4 11-11 11H544v-661H875c6 0 11 4 11 11v640z</StreamGeometry>

src/SourceGit/Resources/Locales.Designer.cs

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/SourceGit/Resources/Locales.en.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1305,6 +1305,9 @@
13051305
<data name="Text.Preference.Appearance" xml:space="preserve">
13061306
<value>APPEARANCE</value>
13071307
</data>
1308+
<data name="Text.Repository.OpenWith" xml:space="preserve">
1309+
<value>Open in</value>
1310+
</data>
13081311
<data name="Text.SelfUpdate.Title" xml:space="preserve">
13091312
<value>Software Update</value>
13101313
</data>

src/SourceGit/Resources/Locales.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1305,6 +1305,9 @@
13051305
<data name="Text.Preference.Appearance" xml:space="preserve">
13061306
<value>Appearance</value>
13071307
</data>
1308+
<data name="Text.Repository.OpenWith" xml:space="preserve">
1309+
<value>Open in</value>
1310+
</data>
13081311
<data name="Text.SelfUpdate.Title" xml:space="preserve">
13091312
<value>Software Update</value>
13101313
</data>

src/SourceGit/Views/Repository.axaml

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,34 @@
1717
<Button Classes="icon_button" Width="32" Command="{Binding OpenInFileManager}" ToolTip.Tip="{DynamicResource Text.Repository.Explore}">
1818
<Path Width="15" Height="13" Data="{StaticResource Icons.Folder.Open}"/>
1919
</Button>
20-
21-
<Button Classes="icon_button" Width="32" Command="{Binding OpenInVSCode}" IsVisible="{Binding IsVSCodeFound}" ToolTip.Tip="{DynamicResource Text.Repository.VSCode}">
22-
<Path Width="13" Height="13" Data="{StaticResource Icons.VSCode}"/>
23-
</Button>
24-
<Button Classes="icon_button" Width="32" Command="{Binding OpenInFleet}" IsVisible="{Binding IsFleetFound}" ToolTip.Tip="{DynamicResource Text.Repository.Fleet}" Content="{SvgImage /Resources/ExternalToolIcons/fleet_icon.svg}" />
25-
2620
<Button Classes="icon_button" Width="32" Command="{Binding OpenInTerminal}" ToolTip.Tip="{DynamicResource Text.Repository.Terminal}">
27-
<Path Width="13" Height="13" Data="{StaticResource Icons.Terminal}"/>
21+
<Path Width="13" Height="13" Data="{StaticResource Icons.Terminal}"/>
2822
</Button>
2923

30-
<ToggleButton Width="32"
31-
Background="Transparent"
32-
IsChecked="{Binding IsSearching, Mode=TwoWay}"
33-
ToolTip.Tip="{DynamicResource Text.Repository.Search}">
34-
<Path Width="14" Height="14" Data="{StaticResource Icons.Search}"/>
35-
</ToggleButton>
24+
<Button Classes="icon_button" Width="32" ToolTip.Tip="{DynamicResource Text.Repository.OpenWith}">
25+
<Path Width="13" Height="13" Data="{StaticResource Icons.OpenWith}"/>
26+
<Button.Flyout>
27+
<MenuFlyout Placement="BottomEdgeAlignedLeft" VerticalOffset="-8">
28+
<MenuItem Header="{DynamicResource Text.Repository.Fleet}" Click="OpenInFleet">
29+
<MenuItem.Icon>
30+
<Svg Path="/Resources/ExternalToolIcons/fleet_icon.svg" Width="13" Height="13" />
31+
</MenuItem.Icon>
32+
</MenuItem>
33+
<MenuItem Header="{DynamicResource Text.Repository.VSCode}" Click="OpenInVSCode">
34+
<MenuItem.Icon>
35+
<Svg Path="/Resources/ExternalToolIcons/vscode_icon.svg" Width="13" Height="13" />
36+
</MenuItem.Icon>
37+
</MenuItem>
38+
</MenuFlyout>
39+
</Button.Flyout>
40+
</Button>
41+
<ToggleButton Width="32"
42+
Background="Transparent"
43+
IsChecked="{Binding IsSearching, Mode=TwoWay}"
44+
ToolTip.Tip="{DynamicResource Text.Repository.Search}">
45+
<Path Width="14" Height="14" Data="{StaticResource Icons.Search}"/>
46+
</ToggleButton>
47+
3648
</StackPanel>
3749

3850
<StackPanel Grid.Column="1" Orientation="Horizontal">

src/SourceGit/Views/Repository.axaml.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,5 +291,14 @@ private async void OpenStatistics(object sender, RoutedEventArgs e)
291291
e.Handled = true;
292292
}
293293
}
294+
295+
private void OpenInVSCode(object sender, RoutedEventArgs e)
296+
{
297+
(DataContext as ViewModels.Repository).OpenInVSCode();
298+
}
299+
private void OpenInFleet(object sender, RoutedEventArgs e)
300+
{
301+
(DataContext as ViewModels.Repository).OpenInFleet();
302+
}
294303
}
295304
}

0 commit comments

Comments
 (0)