Skip to content

Commit eaf5a3f

Browse files
authored
Merge pull request #5 from jeregon1/feature/net9-and-settings-ui
feat: upgrade to .NET 9 and add ShareX settings panel
2 parents 5cc5bf4 + 07bca54 commit eaf5a3f

10 files changed

Lines changed: 213 additions & 99 deletions

Flow.Launcher.Plugin.ShareX-Flow-Plugin.csproj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net5.0-windows</TargetFramework>
4+
<TargetFramework>net9.0-windows</TargetFramework>
5+
<UseWPF>true</UseWPF>
56
<AssemblyName>Flow.Launcher.Plugin.ShareX_Flow_Plugin</AssemblyName>
7+
<RootNamespace>Flow.Launcher.Plugin.ShareX_Flow_Plugin</RootNamespace>
68
<PackageId>Flow.Launcher.Plugin.ShareX_Flow_Plugin</PackageId>
79
<Authors>Dufguix</Authors>
810
<PackageProjectUrl>https://github.com/Dufguix/Flow.Launcher.Plugin.ShareX_Flow_Plugin</PackageProjectUrl>

Main.cs

Lines changed: 86 additions & 73 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
# ShareX Plugin for Flow Launcher
22

3-
## Plugin working
4-
All commands are based on ShareX HotkeyType Enum found on their [Github](https://github.com/ShareX/ShareX/blob/master/ShareX/Enums.cs).
3+
## Plugin behavior
4+
All commands are based on ShareX HotkeyType enum from [ShareX/Enums.cs](https://github.com/ShareX/ShareX/blob/master/ShareX/Enums.cs).
55

6-
There is currently no setting panel. It is based on **default** [ShareX](https://getsharex.com/downloads) installation path.
6+
The plugin now includes a settings panel in Flow Launcher:
7+
- Configure ShareX installation path (defaults to `C:\Program Files\ShareX\`).
8+
- Enable/disable auto close (`-autoclose`) after successful tasks.
9+
10+
When executing commands, the plugin starts ShareX with `-silent` and optionally `-autoclose`.
711

812
## Manual installation
9-
1) Open the solution with Visual Studio 2022.
10-
2) Run a release build.
11-
3) Copy the content of the ".\bin\Release\" folder.
12-
4) Paste to "C:\Users\username\AppData\Roaming\FlowLauncher\Plugins\ShareX" folder.
13+
1. Open the solution with Visual Studio 2026.
14+
2. Build in Release.
15+
3. Copy the content of `.\bin\Release\`.
16+
4. Paste into `C:\Users\<username>\AppData\Roaming\FlowLauncher\Plugins\ShareX`.

Settings.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
namespace Flow.Launcher.Plugin.ShareX_Flow_Plugin
2+
{
3+
public class Settings
4+
{
5+
public string SharexPath { get; set; } = "C:\\Program Files\\ShareX\\";
6+
public bool AutoClose { get; set; } = false;
7+
}
8+
}

SettingsView.xaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<UserControl x:Class="Flow.Launcher.Plugin.ShareX_Flow_Plugin.SettingsView"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
5+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6+
xmlns:local="clr-namespace:Flow.Launcher.Plugin.ShareX_Flow_Plugin"
7+
mc:Ignorable="d"
8+
d:DesignHeight="450"
9+
d:DesignWidth="800">
10+
11+
12+
13+
<StackPanel Margin="{DynamicResource SettingPanelMargin}" >
14+
<Grid Margin="{DynamicResource SettingPanelItemTopBottomMargin}">
15+
<Grid.ColumnDefinitions>
16+
<ColumnDefinition Width="Auto"/>
17+
<ColumnDefinition Width="Auto"/>
18+
<ColumnDefinition Width="Auto" />
19+
</Grid.ColumnDefinitions>
20+
<TextBlock Grid.Column="0" VerticalAlignment="Center" Text="ShareX installation path:" Margin="{DynamicResource SettingPanelItemRightMargin}" />
21+
<TextBox Grid.Column="1" Text="{Binding SharexPath, Mode=TwoWay}" IsReadOnly="False" Margin="{DynamicResource SettingPanelItemRightMargin}"/>
22+
<Button Grid.Column="2" HorizontalAlignment="Center" Content="{DynamicResource flowlauncher_plugin_url_plugin_choose}" Click="BrowseSharexPath" />
23+
</Grid>
24+
25+
<CheckBox
26+
Margin="{DynamicResource SettingPanelItemTopBottomMargin}"
27+
HorizontalAlignment="Left"
28+
VerticalAlignment="Center"
29+
Content="Close ShareX after successfully completing some tasks"
30+
IsChecked="{Binding AutoClose, Mode=TwoWay}" />
31+
</StackPanel>
32+
</UserControl>

SettingsView.xaml.cs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
using System.Windows.Controls;
2+
using System.Windows;
3+
4+
namespace Flow.Launcher.Plugin.ShareX_Flow_Plugin
5+
{
6+
public partial class SettingsView : UserControl
7+
{
8+
private readonly SettingsViewModel _viewModel;
9+
10+
public SettingsView(SettingsViewModel viewModel)
11+
{
12+
_viewModel = viewModel;
13+
DataContext = _viewModel;
14+
InitializeComponent();
15+
}
16+
17+
private void BrowseSharexPath(object sender, RoutedEventArgs e)
18+
{
19+
var dialog = new Microsoft.Win32.OpenFolderDialog
20+
{
21+
InitialDirectory = _viewModel.SharexPath,
22+
Title = "Select ShareX Installation Folder"
23+
};
24+
25+
if (dialog.ShowDialog() == true)
26+
{
27+
_viewModel.SharexPath = dialog.FolderName;
28+
}
29+
}
30+
}
31+
}

SettingsViewModel.cs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
namespace Flow.Launcher.Plugin.ShareX_Flow_Plugin
2+
{
3+
public class SettingsViewModel(Settings settings) : BaseModel
4+
{
5+
private readonly Settings _settings = settings;
6+
7+
public string SharexPath
8+
{
9+
get => _settings.SharexPath;
10+
set
11+
{
12+
if (_settings.SharexPath != value)
13+
{
14+
_settings.SharexPath = value;
15+
OnPropertyChanged();
16+
}
17+
}
18+
}
19+
20+
public bool AutoClose
21+
{
22+
get => _settings.AutoClose;
23+
set
24+
{
25+
if (_settings.AutoClose != value)
26+
{
27+
_settings.AutoClose = value;
28+
OnPropertyChanged();
29+
}
30+
}
31+
}
32+
}
33+
}

SharexCommand.cs

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,14 @@
66

77
namespace Flow.Launcher.Plugin.ShareX_Flow_Plugin
88
{
9-
class SharexCommand
9+
public record SharexCommand
1010
{
11-
public enum Cat {Upload, ScreenCapture, ScreenRecord, Tools, Other};
11+
public enum CategoryType { Upload, ScreenCapture, ScreenRecord, Tools, Other };
1212

13-
public String Title
14-
{ get; set; }
15-
16-
public String SubTitle
17-
{ get; set; }
18-
19-
public String Command
20-
{ get; set; }
21-
22-
public Cat Category
23-
{ get; set; }
24-
25-
public String IcoPath
26-
{ get; set; }
13+
public string Title { get; init; }
14+
public string SubTitle { get; init; }
15+
public string Command { get; init; }
16+
public CategoryType Category { get; init; }
17+
public string IcoPath { get; init; }
2718
}
2819
}

packages.lock.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"version": 1,
33
"dependencies": {
4-
"net5.0-windows7.0": {
4+
"net9.0-windows7.0": {
55
"Flow.Launcher.Plugin": {
66
"type": "Direct",
77
"requested": "[2.1.1, )",

plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"Name": "ShareX_Flow_Plugin",
55
"Description": "Run ShareX capture, OCR, ...",
66
"Author": "Dufguix",
7-
"Version": "1.0.0",
7+
"Version": "1.1.0",
88
"Language": "csharp",
99
"Website": "https://github.com/dufguix/Flow.Launcher.Plugin.ShareX",
1010
"IcoPath": "icon.png",

0 commit comments

Comments
 (0)