Skip to content

A Swiss Army knife for developers.

Added Linux support (#929)

Etienne BAUDOUX1378eb261fc0
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 48c69bb12..fe1e306de 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -43,7 +43,7 @@ You can contribute to DevToys app by:
1. Install [**Xcode 14.2**](https://developer.apple.com/xcode/) or later. Run it at least once and allow it to install the built-in macOS and iOS tooling.
1. [**Visual Studio Code**](https://code.visualstudio.com/) or [**Visual Studio for Mac**](https://visualstudio.microsoft.com/vs/mac/) or [**JetBrains Rider**](https://www.jetbrains.com/rider/)
1. **.NET SDK**. This is required to build the app itself.
- * [.NET 7.0 SDK](https://dotnet.microsoft.com/download/dotnet-core/7.0) (**version 7.0 (SDK 7.0.101)** or later). If you're on a [Mac computer with Apple silicon processor](https://support.apple.com/en-us/HT211814), you need to install the Arm64 version of the SDK.
+ * [.NET 7.0 SDK](https://dotnet.microsoft.com/download/dotnet-core/7.0) (**version 7.0 (SDK 7.0.110)** or later). If you're on a [Mac computer with Apple silicon processor](https://support.apple.com/en-us/HT211814), you need to install the Arm64 version of the SDK.
> Use `dotnet --version` from the terminal to get the version installed.
1. [Node.js](https://nodejs.org/). This is required to build Monaco Editor.
2. If you're using an [Mac computer with Apple silicon processor](https://support.apple.com/en-us/HT211814), install [Rosetta 2](https://developer.apple.com/documentation/apple-silicon/about-the-rosetta-translation-environment) using the following command in a Terminal:
@@ -71,7 +71,7 @@ You can contribute to DevToys app by:
#### If you are using Visual Studio Code:
1. Open the repository in Visual Studio Code to edit the code.
-2. Install the `C#` extension.
+2. Install the [.NET MAUI](https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.dotnet-maui) extension.
1. In `Run and Debug`, select `Debug (macOS dektop app)` and press Start.
#### Special note for `DevToys.MacOS`
@@ -82,6 +82,40 @@ Most of the `DevToys.MacOS` app runs in a web browser (Safari). In order to acce
4. Return to Safari. Select Develop > {REMOTE INSPECTION TARGET} > 0.0.0.0, where the {REMOTE INSPECTION TARGET} placeholder is either the devices's plain name (for example, MacBook Pro) or the device's serial number (for example XMVM7VFF10). If multiple entries for 0.0.0.0 are present, select the entry that highlights the BlazorWebView. The BlazorWebView is highlighted in blue in macOS when the correct 0.0.0.0 entry is selected.
5. The Web Inspector window appears for the BlazorWebView.
+## From Linux
+
+### Prerequisites
+1. Make sure your machine has GTK4 installed. Distro like Ubuntu generally have it pre-installed.
+1. [**Visual Studio Code**](https://code.visualstudio.com/) or [**JetBrains Rider**](https://www.jetbrains.com/rider/)
+1. **.NET SDK**. This is required to build the app itself.
+ * [.NET 7.0 SDK](https://dotnet.microsoft.com/download/dotnet-core/7.0) (**version 7.0 (SDK 7.0.110)** or later).
+ > Use `dotnet --version` from the terminal to get the version installed.
+1. [Node.js](https://nodejs.org/). This is required to build Monaco Editor.
+
+### Finalize your environment
+1. Clone this repository.
+1. Open a Terminal command prompt in the root folder of this repository.
+1. Install Nuke.Build command line tooling with the following command from the command prompt:
+ ```
+ sudo dotnet tool install Nuke.GlobalTool --global
+ ```
+1. Restore all the dependencies with the following command:
+ ```
+ sudo bash init.sh
+ ```
+
+### Build, Run & Debug
+#### If you are using JetBains Rider:
+1. Open `src/DevToys-Linux.sln` with JetBrains Rider.
+1. Set `app/dev/platforms/desktop/DevToys.Linux` or `app/dev/platforms/desktop/DevToys.CLI` as startup project.
+1. Now you should be able to build and run DevToys on your machine.
+
+#### If you are using Visual Studio Code:
+1. Open the repository in Visual Studio Code to edit the code.
+2. Install the [C# Dev Kit](https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csdevkit) extension.
+1. In command palette (`Ctrl+Shift+P`), execute `.NET: Open Solution` and select `DevToys.Linux`.
+1. In Explorer (`Ctrl+Shift+E`), select `Solution Explorer` panel at the bottom of the screen. Right click on `DevToys.Linux` or `DevToys.CLI` project in the tree view, then `Debug` to start debugging.
+
# Internationalization and localization
There are two possibilities offered:
diff --git a/global.json b/global.json
index 89f0c8364..ad9c34b72 100644
--- a/global.json
+++ b/global.json
@@ -1,6 +1,6 @@
{
"sdk": {
- "version": "7.0.306",
+ "version": "7.0.110",
"rollForward": "latestMinor",
"allowPrerelease": false
},
diff --git a/init.sh b/init.sh
index b6457260c..b6febf3ae 100644
--- a/init.sh
+++ b/init.sh
@@ -6,19 +6,28 @@ set -eo pipefail
SCRIPT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)
SCRIPT_DIR="${SCRIPT_DIR}/"
-# Required to build macOS app. See https://stackoverflow.com/questions/55320965/resource-fork-finder-information-or-similar-detritus-not-allowed-error-when
-xattr -cr ./src/
+if [[ "$OSTYPE" == "darwin"* ]]; then
+ # Required to build macOS app. See https://stackoverflow.com/questions/55320965/resource-fork-finder-information-or-similar-detritus-not-allowed-error-when
+ xattr -cr ./src/
+fi
# Install .NET
. "./tools/Install-DotNet.sh" "$SCRIPT_DIR"
# Install .NET workloads
-echo "Installing .NET workloads"
-sudo dotnet workload install maui-maccatalyst
+if [[ "$OSTYPE" == "darwin"* ]]; then
+ echo "Installing .NET workloads"
+ sudo dotnet workload install maui-maccatalyst
+fi
# Restore NuGet solution dependencies
echo "Restoring all dependencies"
-SOLUTIONS=$(find ./src/ -iname "*DevToys-MacOS.sln" -print)
+if [[ "$OSTYPE" == "darwin"* ]]; then
+ SOLUTIONS=$(find ./src/ -iname "*DevToys-MacOS.sln" -print)
+else
+ SOLUTIONS=$(find ./src/ -iname "*DevToys-Linux.sln" -print)
+fi
+
for SOLUTION_FILE in $SOLUTIONS
do
echo "Restoring packages for $SOLUTION_FILE..."
diff --git a/src/DevToys-Linux.sln b/src/DevToys-Linux.sln
new file mode 100644
index 000000000..f5934530d
--- /dev/null
+++ b/src/DevToys-Linux.sln
@@ -0,0 +1,294 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.4.33122.133
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{0AC87D9B-BBEC-4DCE-A9D4-82A159E5E7C1}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "app", "app", "{C85D2D7C-3D69-482A-8AB6-BCA934220EC0}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "dev", "dev", "{B20E4027-0777-4A75-A848-609594E9A6B0}"
+ ProjectSection(SolutionItems) = preProject
+ app\dev\Directory.Build.props = app\dev\Directory.Build.props
+ app\dev\Directory.Build.targets = app\dev\Directory.Build.targets
+ EndProjectSection
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{4C40BF47-315A-4B60-9ED6-8D65B5E79C2C}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "platforms", "platforms", "{3D2285D5-0E44-4B1A-9B74-2BBE3108D5B7}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "shared", "shared", "{9771D1F8-D331-4B26-8E96-6024893009F4}"
+ ProjectSection(SolutionItems) = preProject
+ app\dev\shared\GlobalUsings.cs = app\dev\shared\GlobalUsings.cs
+ app\dev\shared\LinkerConfig.xml = app\dev\shared\LinkerConfig.xml
+ app\dev\shared\SharedAssemblyInfo.cs = app\dev\shared\SharedAssemblyInfo.cs
+ app\dev\shared\SharedAssemblyVersion.cs = app\dev\shared\SharedAssemblyVersion.cs
+ EndProjectSection
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{97141F3A-C655-4140-B09B-466DDC14F870}"
+ ProjectSection(SolutionItems) = preProject
+ .editorconfig = .editorconfig
+ Directory.Build.props = Directory.Build.props
+ Directory.Build.targets = Directory.Build.targets
+ Directory.Packages.props = Directory.Packages.props
+ Environment.props = Environment.props
+ spellcheckerexclusion.dic = spellcheckerexclusion.dic
+ EndProjectSection
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "desktops", "desktops", "{22EE9386-CEFA-47D8-97B2-09A63EDF7F2E}"
+ ProjectSection(SolutionItems) = preProject
+ app\dev\platforms\desktop\Directory.Build.props = app\dev\platforms\desktop\Directory.Build.props
+ app\dev\platforms\desktop\Directory.Build.targets = app\dev\platforms\desktop\Directory.Build.targets
+ EndProjectSection
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DevToys.CLI", "app\dev\platforms\desktop\DevToys.CLI\DevToys.CLI.csproj", "{8C72D38A-658D-4C9D-B0AD-2DA975BE7826}"
+ ProjectSection(ProjectDependencies) = postProject
+ {B6D48157-5257-4B60-B065-3B231B610A54} = {B6D48157-5257-4B60-B065-3B231B610A54}
+ EndProjectSection
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "_build", "build\_build.csproj", "{745FD4CA-84CC-45D8-A3E2-814A0B9C16C4}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DevToys.Api", "app\dev\DevToys.Api\DevToys.Api.csproj", "{89A4D88F-5AC0-436A-8EC5-8E98728CA89E}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DevToys.UnitTests", "app\tests\DevToys.UnitTests\DevToys.UnitTests.csproj", "{CCAB7530-4341-4C24-B4E8-28679BB6C4FB}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DevToys.Tools", "app\dev\DevToys.Tools\DevToys.Tools.csproj", "{B6D48157-5257-4B60-B065-3B231B610A54}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DevToys.Core", "app\dev\DevToys.Core\DevToys.Core.csproj", "{A730FA8A-3713-4F7A-915D-79098CA12DF0}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DevToys.Localization", "app\dev\DevToys.Localization\DevToys.Localization.csproj", "{12A1461D-3357-4007-BE15-9622E9513D09}"
+ ProjectSection(ProjectDependencies) = postProject
+ {DB6B033B-584E-43CF-AC96-4F6548C96ECA} = {DB6B033B-584E-43CF-AC96-4F6548C96ECA}
+ EndProjectSection
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "generators", "generators", "{FA3821C4-74BB-4927-ABCC-0D0A12E097A2}"
+ ProjectSection(SolutionItems) = preProject
+ generators\Directory.Build.props = generators\Directory.Build.props
+ generators\Directory.Build.targets = generators\Directory.Build.targets
+ EndProjectSection
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ResxHelperGenerator", "generators\ResxHelperGenerator\ResxHelperGenerator.csproj", "{DB6B033B-584E-43CF-AC96-4F6548C96ECA}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DevToys.Business", "app\dev\DevToys.Business\DevToys.Business.csproj", "{1C5D0B77-8509-4DA4-ADEC-359CC1A9E952}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DevToys.Blazor", "app\dev\DevToys.Blazor\DevToys.Blazor.csproj", "{565D2497-6078-4558-911C-EA7D3A25AB16}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DevToys.Linux", "app\dev\platforms\desktop\DevToys.Linux\DevToys.Linux.csproj", "{48531D2E-83C6-49F2-9ADD-C9490386718B}"
+ ProjectSection(ProjectDependencies) = postProject
+ {B6D48157-5257-4B60-B065-3B231B610A54} = {B6D48157-5257-4B60-B065-3B231B610A54}
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Debug|ARM64 = Debug|ARM64
+ Debug|x64 = Debug|x64
+ Debug|x86 = Debug|x86
+ Release|Any CPU = Release|Any CPU
+ Release|ARM64 = Release|ARM64
+ Release|x64 = Release|x64
+ Release|x86 = Release|x86
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {8C72D38A-658D-4C9D-B0AD-2DA975BE7826}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {8C72D38A-658D-4C9D-B0AD-2DA975BE7826}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {8C72D38A-658D-4C9D-B0AD-2DA975BE7826}.Debug|ARM64.ActiveCfg = Debug|Any CPU
+ {8C72D38A-658D-4C9D-B0AD-2DA975BE7826}.Debug|ARM64.Build.0 = Debug|Any CPU
+ {8C72D38A-658D-4C9D-B0AD-2DA975BE7826}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {8C72D38A-658D-4C9D-B0AD-2DA975BE7826}.Debug|x64.Build.0 = Debug|Any CPU
+ {8C72D38A-658D-4C9D-B0AD-2DA975BE7826}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {8C72D38A-658D-4C9D-B0AD-2DA975BE7826}.Debug|x86.Build.0 = Debug|Any CPU
+ {8C72D38A-658D-4C9D-B0AD-2DA975BE7826}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {8C72D38A-658D-4C9D-B0AD-2DA975BE7826}.Release|Any CPU.Build.0 = Release|Any CPU
+ {8C72D38A-658D-4C9D-B0AD-2DA975BE7826}.Release|ARM64.ActiveCfg = Release|Any CPU
+ {8C72D38A-658D-4C9D-B0AD-2DA975BE7826}.Release|ARM64.Build.0 = Release|Any CPU
+ {8C72D38A-658D-4C9D-B0AD-2DA975BE7826}.Release|x64.ActiveCfg = Release|Any CPU
+ {8C72D38A-658D-4C9D-B0AD-2DA975BE7826}.Release|x64.Build.0 = Release|Any CPU
+ {8C72D38A-658D-4C9D-B0AD-2DA975BE7826}.Release|x86.ActiveCfg = Release|Any CPU
+ {8C72D38A-658D-4C9D-B0AD-2DA975BE7826}.Release|x86.Build.0 = Release|Any CPU
+ {745FD4CA-84CC-45D8-A3E2-814A0B9C16C4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {745FD4CA-84CC-45D8-A3E2-814A0B9C16C4}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {745FD4CA-84CC-45D8-A3E2-814A0B9C16C4}.Debug|ARM64.ActiveCfg = Debug|Any CPU
+ {745FD4CA-84CC-45D8-A3E2-814A0B9C16C4}.Debug|ARM64.Build.0 = Debug|Any CPU
+ {745FD4CA-84CC-45D8-A3E2-814A0B9C16C4}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {745FD4CA-84CC-45D8-A3E2-814A0B9C16C4}.Debug|x64.Build.0 = Debug|Any CPU
+ {745FD4CA-84CC-45D8-A3E2-814A0B9C16C4}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {745FD4CA-84CC-45D8-A3E2-814A0B9C16C4}.Debug|x86.Build.0 = Debug|Any CPU
+ {745FD4CA-84CC-45D8-A3E2-814A0B9C16C4}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {745FD4CA-84CC-45D8-A3E2-814A0B9C16C4}.Release|Any CPU.Build.0 = Release|Any CPU
+ {745FD4CA-84CC-45D8-A3E2-814A0B9C16C4}.Release|ARM64.ActiveCfg = Release|Any CPU
+ {745FD4CA-84CC-45D8-A3E2-814A0B9C16C4}.Release|ARM64.Build.0 = Release|Any CPU
+ {745FD4CA-84CC-45D8-A3E2-814A0B9C16C4}.Release|x64.ActiveCfg = Release|Any CPU
+ {745FD4CA-84CC-45D8-A3E2-814A0B9C16C4}.Release|x64.Build.0 = Release|Any CPU
+ {745FD4CA-84CC-45D8-A3E2-814A0B9C16C4}.Release|x86.ActiveCfg = Release|Any CPU
+ {745FD4CA-84CC-45D8-A3E2-814A0B9C16C4}.Release|x86.Build.0 = Release|Any CPU
+ {89A4D88F-5AC0-436A-8EC5-8E98728CA89E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {89A4D88F-5AC0-436A-8EC5-8E98728CA89E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {89A4D88F-5AC0-436A-8EC5-8E98728CA89E}.Debug|ARM64.ActiveCfg = Debug|Any CPU
+ {89A4D88F-5AC0-436A-8EC5-8E98728CA89E}.Debug|ARM64.Build.0 = Debug|Any CPU
+ {89A4D88F-5AC0-436A-8EC5-8E98728CA89E}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {89A4D88F-5AC0-436A-8EC5-8E98728CA89E}.Debug|x64.Build.0 = Debug|Any CPU
+ {89A4D88F-5AC0-436A-8EC5-8E98728CA89E}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {89A4D88F-5AC0-436A-8EC5-8E98728CA89E}.Debug|x86.Build.0 = Debug|Any CPU
+ {89A4D88F-5AC0-436A-8EC5-8E98728CA89E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {89A4D88F-5AC0-436A-8EC5-8E98728CA89E}.Release|Any CPU.Build.0 = Release|Any CPU
+ {89A4D88F-5AC0-436A-8EC5-8E98728CA89E}.Release|ARM64.ActiveCfg = Release|Any CPU
+ {89A4D88F-5AC0-436A-8EC5-8E98728CA89E}.Release|ARM64.Build.0 = Release|Any CPU
+ {89A4D88F-5AC0-436A-8EC5-8E98728CA89E}.Release|x64.ActiveCfg = Release|Any CPU
+ {89A4D88F-5AC0-436A-8EC5-8E98728CA89E}.Release|x64.Build.0 = Release|Any CPU
+ {89A4D88F-5AC0-436A-8EC5-8E98728CA89E}.Release|x86.ActiveCfg = Release|Any CPU
+ {89A4D88F-5AC0-436A-8EC5-8E98728CA89E}.Release|x86.Build.0 = Release|Any CPU
+ {CCAB7530-4341-4C24-B4E8-28679BB6C4FB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {CCAB7530-4341-4C24-B4E8-28679BB6C4FB}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {CCAB7530-4341-4C24-B4E8-28679BB6C4FB}.Debug|ARM64.ActiveCfg = Debug|Any CPU
+ {CCAB7530-4341-4C24-B4E8-28679BB6C4FB}.Debug|ARM64.Build.0 = Debug|Any CPU
+ {CCAB7530-4341-4C24-B4E8-28679BB6C4FB}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {CCAB7530-4341-4C24-B4E8-28679BB6C4FB}.Debug|x64.Build.0 = Debug|Any CPU
+ {CCAB7530-4341-4C24-B4E8-28679BB6C4FB}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {CCAB7530-4341-4C24-B4E8-28679BB6C4FB}.Debug|x86.Build.0 = Debug|Any CPU
+ {CCAB7530-4341-4C24-B4E8-28679BB6C4FB}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {CCAB7530-4341-4C24-B4E8-28679BB6C4FB}.Release|Any CPU.Build.0 = Release|Any CPU
+ {CCAB7530-4341-4C24-B4E8-28679BB6C4FB}.Release|ARM64.ActiveCfg = Release|Any CPU
+ {CCAB7530-4341-4C24-B4E8-28679BB6C4FB}.Release|ARM64.Build.0 = Release|Any CPU
+ {CCAB7530-4341-4C24-B4E8-28679BB6C4FB}.Release|x64.ActiveCfg = Release|Any CPU
+ {CCAB7530-4341-4C24-B4E8-28679BB6C4FB}.Release|x64.Build.0 = Release|Any CPU
+ {CCAB7530-4341-4C24-B4E8-28679BB6C4FB}.Release|x86.ActiveCfg = Release|Any CPU
+ {CCAB7530-4341-4C24-B4E8-28679BB6C4FB}.Release|x86.Build.0 = Release|Any CPU
+ {B6D48157-5257-4B60-B065-3B231B610A54}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {B6D48157-5257-4B60-B065-3B231B610A54}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {B6D48157-5257-4B60-B065-3B231B610A54}.Debug|ARM64.ActiveCfg = Debug|Any CPU
+ {B6D48157-5257-4B60-B065-3B231B610A54}.Debug|ARM64.Build.0 = Debug|Any CPU
+ {B6D48157-5257-4B60-B065-3B231B610A54}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {B6D48157-5257-4B60-B065-3B231B610A54}.Debug|x64.Build.0 = Debug|Any CPU
+ {B6D48157-5257-4B60-B065-3B231B610A54}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {B6D48157-5257-4B60-B065-3B231B610A54}.Debug|x86.Build.0 = Debug|Any CPU
+ {B6D48157-5257-4B60-B065-3B231B610A54}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B6D48157-5257-4B60-B065-3B231B610A54}.Release|Any CPU.Build.0 = Release|Any CPU
+ {B6D48157-5257-4B60-B065-3B231B610A54}.Release|ARM64.ActiveCfg = Release|Any CPU
+ {B6D48157-5257-4B60-B065-3B231B610A54}.Release|ARM64.Build.0 = Release|Any CPU
+ {B6D48157-5257-4B60-B065-3B231B610A54}.Release|x64.ActiveCfg = Release|Any CPU
+ {B6D48157-5257-4B60-B065-3B231B610A54}.Release|x64.Build.0 = Release|Any CPU
+ {B6D48157-5257-4B60-B065-3B231B610A54}.Release|x86.ActiveCfg = Release|Any CPU
+ {B6D48157-5257-4B60-B065-3B231B610A54}.Release|x86.Build.0 = Release|Any CPU
+ {A730FA8A-3713-4F7A-915D-79098CA12DF0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {A730FA8A-3713-4F7A-915D-79098CA12DF0}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {A730FA8A-3713-4F7A-915D-79098CA12DF0}.Debug|ARM64.ActiveCfg = Debug|Any CPU
+ {A730FA8A-3713-4F7A-915D-79098CA12DF0}.Debug|ARM64.Build.0 = Debug|Any CPU
+ {A730FA8A-3713-4F7A-915D-79098CA12DF0}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {A730FA8A-3713-4F7A-915D-79098CA12DF0}.Debug|x64.Build.0 = Debug|Any CPU
+ {A730FA8A-3713-4F7A-915D-79098CA12DF0}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {A730FA8A-3713-4F7A-915D-79098CA12DF0}.Debug|x86.Build.0 = Debug|Any CPU
+ {A730FA8A-3713-4F7A-915D-79098CA12DF0}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {A730FA8A-3713-4F7A-915D-79098CA12DF0}.Release|Any CPU.Build.0 = Release|Any CPU
+ {A730FA8A-3713-4F7A-915D-79098CA12DF0}.Release|ARM64.ActiveCfg = Release|Any CPU
+ {A730FA8A-3713-4F7A-915D-79098CA12DF0}.Release|ARM64.Build.0 = Release|Any CPU
+ {A730FA8A-3713-4F7A-915D-79098CA12DF0}.Release|x64.ActiveCfg = Release|Any CPU
+ {A730FA8A-3713-4F7A-915D-79098CA12DF0}.Release|x64.Build.0 = Release|Any CPU
+ {A730FA8A-3713-4F7A-915D-79098CA12DF0}.Release|x86.ActiveCfg = Release|Any CPU
+ {A730FA8A-3713-4F7A-915D-79098CA12DF0}.Release|x86.Build.0 = Release|Any CPU
+ {12A1461D-3357-4007-BE15-9622E9513D09}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {12A1461D-3357-4007-BE15-9622E9513D09}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {12A1461D-3357-4007-BE15-9622E9513D09}.Debug|ARM64.ActiveCfg = Debug|Any CPU
+ {12A1461D-3357-4007-BE15-9622E9513D09}.Debug|ARM64.Build.0 = Debug|Any CPU
+ {12A1461D-3357-4007-BE15-9622E9513D09}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {12A1461D-3357-4007-BE15-9622E9513D09}.Debug|x64.Build.0 = Debug|Any CPU
+ {12A1461D-3357-4007-BE15-9622E9513D09}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {12A1461D-3357-4007-BE15-9622E9513D09}.Debug|x86.Build.0 = Debug|Any CPU
+ {12A1461D-3357-4007-BE15-9622E9513D09}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {12A1461D-3357-4007-BE15-9622E9513D09}.Release|Any CPU.Build.0 = Release|Any CPU
+ {12A1461D-3357-4007-BE15-9622E9513D09}.Release|ARM64.ActiveCfg = Release|Any CPU
+ {12A1461D-3357-4007-BE15-9622E9513D09}.Release|ARM64.Build.0 = Release|Any CPU
+ {12A1461D-3357-4007-BE15-9622E9513D09}.Release|x64.ActiveCfg = Release|Any CPU
+ {12A1461D-3357-4007-BE15-9622E9513D09}.Release|x64.Build.0 = Release|Any CPU
+ {12A1461D-3357-4007-BE15-9622E9513D09}.Release|x86.ActiveCfg = Release|Any CPU
+ {12A1461D-3357-4007-BE15-9622E9513D09}.Release|x86.Build.0 = Release|Any CPU
+ {DB6B033B-584E-43CF-AC96-4F6548C96ECA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {DB6B033B-584E-43CF-AC96-4F6548C96ECA}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {DB6B033B-584E-43CF-AC96-4F6548C96ECA}.Debug|ARM64.ActiveCfg = Debug|Any CPU
+ {DB6B033B-584E-43CF-AC96-4F6548C96ECA}.Debug|ARM64.Build.0 = Debug|Any CPU
+ {DB6B033B-584E-43CF-AC96-4F6548C96ECA}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {DB6B033B-584E-43CF-AC96-4F6548C96ECA}.Debug|x64.Build.0 = Debug|Any CPU
+ {DB6B033B-584E-43CF-AC96-4F6548C96ECA}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {DB6B033B-584E-43CF-AC96-4F6548C96ECA}.Debug|x86.Build.0 = Debug|Any CPU
+ {DB6B033B-584E-43CF-AC96-4F6548C96ECA}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {DB6B033B-584E-43CF-AC96-4F6548C96ECA}.Release|Any CPU.Build.0 = Release|Any CPU
+ {DB6B033B-584E-43CF-AC96-4F6548C96ECA}.Release|ARM64.ActiveCfg = Release|Any CPU
+ {DB6B033B-584E-43CF-AC96-4F6548C96ECA}.Release|ARM64.Build.0 = Release|Any CPU
+ {DB6B033B-584E-43CF-AC96-4F6548C96ECA}.Release|x64.ActiveCfg = Release|Any CPU
+ {DB6B033B-584E-43CF-AC96-4F6548C96ECA}.Release|x64.Build.0 = Release|Any CPU
+ {DB6B033B-584E-43CF-AC96-4F6548C96ECA}.Release|x86.ActiveCfg = Release|Any CPU
+ {DB6B033B-584E-43CF-AC96-4F6548C96ECA}.Release|x86.Build.0 = Release|Any CPU
+ {1C5D0B77-8509-4DA4-ADEC-359CC1A9E952}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {1C5D0B77-8509-4DA4-ADEC-359CC1A9E952}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {1C5D0B77-8509-4DA4-ADEC-359CC1A9E952}.Debug|ARM64.ActiveCfg = Debug|Any CPU
+ {1C5D0B77-8509-4DA4-ADEC-359CC1A9E952}.Debug|ARM64.Build.0 = Debug|Any CPU
+ {1C5D0B77-8509-4DA4-ADEC-359CC1A9E952}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {1C5D0B77-8509-4DA4-ADEC-359CC1A9E952}.Debug|x64.Build.0 = Debug|Any CPU
+ {1C5D0B77-8509-4DA4-ADEC-359CC1A9E952}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {1C5D0B77-8509-4DA4-ADEC-359CC1A9E952}.Debug|x86.Build.0 = Debug|Any CPU
+ {1C5D0B77-8509-4DA4-ADEC-359CC1A9E952}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {1C5D0B77-8509-4DA4-ADEC-359CC1A9E952}.Release|Any CPU.Build.0 = Release|Any CPU
+ {1C5D0B77-8509-4DA4-ADEC-359CC1A9E952}.Release|ARM64.ActiveCfg = Release|Any CPU
+ {1C5D0B77-8509-4DA4-ADEC-359CC1A9E952}.Release|ARM64.Build.0 = Release|Any CPU
+ {1C5D0B77-8509-4DA4-ADEC-359CC1A9E952}.Release|x64.ActiveCfg = Release|Any CPU
+ {1C5D0B77-8509-4DA4-ADEC-359CC1A9E952}.Release|x64.Build.0 = Release|Any CPU
+ {1C5D0B77-8509-4DA4-ADEC-359CC1A9E952}.Release|x86.ActiveCfg = Release|Any CPU
+ {1C5D0B77-8509-4DA4-ADEC-359CC1A9E952}.Release|x86.Build.0 = Release|Any CPU
+ {565D2497-6078-4558-911C-EA7D3A25AB16}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {565D2497-6078-4558-911C-EA7D3A25AB16}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {565D2497-6078-4558-911C-EA7D3A25AB16}.Debug|ARM64.ActiveCfg = Debug|Any CPU
+ {565D2497-6078-4558-911C-EA7D3A25AB16}.Debug|ARM64.Build.0 = Debug|Any CPU
+ {565D2497-6078-4558-911C-EA7D3A25AB16}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {565D2497-6078-4558-911C-EA7D3A25AB16}.Debug|x64.Build.0 = Debug|Any CPU
+ {565D2497-6078-4558-911C-EA7D3A25AB16}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {565D2497-6078-4558-911C-EA7D3A25AB16}.Debug|x86.Build.0 = Debug|Any CPU
+ {565D2497-6078-4558-911C-EA7D3A25AB16}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {565D2497-6078-4558-911C-EA7D3A25AB16}.Release|Any CPU.Build.0 = Release|Any CPU
+ {565D2497-6078-4558-911C-EA7D3A25AB16}.Release|ARM64.ActiveCfg = Release|Any CPU
+ {565D2497-6078-4558-911C-EA7D3A25AB16}.Release|ARM64.Build.0 = Release|Any CPU
+ {565D2497-6078-4558-911C-EA7D3A25AB16}.Release|x64.ActiveCfg = Release|Any CPU
+ {565D2497-6078-4558-911C-EA7D3A25AB16}.Release|x64.Build.0 = Release|Any CPU
+ {565D2497-6078-4558-911C-EA7D3A25AB16}.Release|x86.ActiveCfg = Release|Any CPU
+ {565D2497-6078-4558-911C-EA7D3A25AB16}.Release|x86.Build.0 = Release|Any CPU
+ {48531D2E-83C6-49F2-9ADD-C9490386718B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {48531D2E-83C6-49F2-9ADD-C9490386718B}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {48531D2E-83C6-49F2-9ADD-C9490386718B}.Debug|ARM64.ActiveCfg = Debug|Any CPU
+ {48531D2E-83C6-49F2-9ADD-C9490386718B}.Debug|ARM64.Build.0 = Debug|Any CPU
+ {48531D2E-83C6-49F2-9ADD-C9490386718B}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {48531D2E-83C6-49F2-9ADD-C9490386718B}.Debug|x64.Build.0 = Debug|Any CPU
+ {48531D2E-83C6-49F2-9ADD-C9490386718B}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {48531D2E-83C6-49F2-9ADD-C9490386718B}.Debug|x86.Build.0 = Debug|Any CPU
+ {48531D2E-83C6-49F2-9ADD-C9490386718B}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {48531D2E-83C6-49F2-9ADD-C9490386718B}.Release|Any CPU.Build.0 = Release|Any CPU
+ {48531D2E-83C6-49F2-9ADD-C9490386718B}.Release|ARM64.ActiveCfg = Release|Any CPU
+ {48531D2E-83C6-49F2-9ADD-C9490386718B}.Release|ARM64.Build.0 = Release|Any CPU
+ {48531D2E-83C6-49F2-9ADD-C9490386718B}.Release|x64.ActiveCfg = Release|Any CPU
+ {48531D2E-83C6-49F2-9ADD-C9490386718B}.Release|x64.Build.0 = Release|Any CPU
+ {48531D2E-83C6-49F2-9ADD-C9490386718B}.Release|x86.ActiveCfg = Release|Any CPU
+ {48531D2E-83C6-49F2-9ADD-C9490386718B}.Release|x86.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(NestedProjects) = preSolution
+ {B20E4027-0777-4A75-A848-609594E9A6B0} = {C85D2D7C-3D69-482A-8AB6-BCA934220EC0}
+ {4C40BF47-315A-4B60-9ED6-8D65B5E79C2C} = {C85D2D7C-3D69-482A-8AB6-BCA934220EC0}
+ {3D2285D5-0E44-4B1A-9B74-2BBE3108D5B7} = {B20E4027-0777-4A75-A848-609594E9A6B0}
+ {9771D1F8-D331-4B26-8E96-6024893009F4} = {B20E4027-0777-4A75-A848-609594E9A6B0}
+ {22EE9386-CEFA-47D8-97B2-09A63EDF7F2E} = {3D2285D5-0E44-4B1A-9B74-2BBE3108D5B7}
+ {8C72D38A-658D-4C9D-B0AD-2DA975BE7826} = {22EE9386-CEFA-47D8-97B2-09A63EDF7F2E}
+ {745FD4CA-84CC-45D8-A3E2-814A0B9C16C4} = {0AC87D9B-BBEC-4DCE-A9D4-82A159E5E7C1}
+ {89A4D88F-5AC0-436A-8EC5-8E98728CA89E} = {B20E4027-0777-4A75-A848-609594E9A6B0}
+ {CCAB7530-4341-4C24-B4E8-28679BB6C4FB} = {4C40BF47-315A-4B60-9ED6-8D65B5E79C2C}
+ {B6D48157-5257-4B60-B065-3B231B610A54} = {B20E4027-0777-4A75-A848-609594E9A6B0}
+ {A730FA8A-3713-4F7A-915D-79098CA12DF0} = {B20E4027-0777-4A75-A848-609594E9A6B0}
+ {12A1461D-3357-4007-BE15-9622E9513D09} = {B20E4027-0777-4A75-A848-609594E9A6B0}
+ {DB6B033B-584E-43CF-AC96-4F6548C96ECA} = {FA3821C4-74BB-4927-ABCC-0D0A12E097A2}
+ {1C5D0B77-8509-4DA4-ADEC-359CC1A9E952} = {B20E4027-0777-4A75-A848-609594E9A6B0}
+ {565D2497-6078-4558-911C-EA7D3A25AB16} = {B20E4027-0777-4A75-A848-609594E9A6B0}
+ {48531D2E-83C6-49F2-9ADD-C9490386718B} = {22EE9386-CEFA-47D8-97B2-09A63EDF7F2E}
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {C2C953F5-F97F-4198-B15C-4947A886050F}
+ EndGlobalSection
+EndGlobal
diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props
index 5d425ccec..e57cb20f9 100644
--- a/src/Directory.Packages.props
+++ b/src/Directory.Packages.props
@@ -3,6 +3,7 @@
<CommunityToolkitVersion>8.2.1</CommunityToolkitVersion>
<DotNetVersion>7.0.0</DotNetVersion>
<XUnit>2.5.0</XUnit>
+ <GirCore>0.5.0-preview.1</GirCore>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="CommunityToolkit.Common" Version="$(CommunityToolkitVersion)" />
@@ -12,7 +13,11 @@
<PackageVersion Include="coverlet.collector" Version="6.0.0" />
<PackageVersion Include="FluentAssertions" Version="6.11.0" />
<PackageVersion Include="FuzzySharp" Version="2.0.2" />
+ <PackageVersion Include="GirCore.Adw-1" Version="$(GirCore)" />
+ <PackageVersion Include="GirCore.Gtk-4.0" Version="$(GirCore)" />
+ <PackageVersion Include="GirCore.WebKit-6.0" Version="$(GirCore)" />
<PackageVersion Include="Microsoft.AspNetCore.Components.Web" Version="$(DotNetVersion)" />
+ <PackageVersion Include="Microsoft.AspNetCore.Components.WebView" Version="$(DotNetVersion)" />
<PackageVersion Include="Microsoft.AspNetCore.Components.WebView.Wpf" Version="7.0.86" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.4.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4" />
diff --git a/src/app/dev/DevToys.Blazor/Core/Extensions/IJSRuntimeExtensions.cs b/src/app/dev/DevToys.Blazor/Core/Extensions/IJSRuntimeExtensions.cs
index 39116a989..dd482aac1 100644
--- a/src/app/dev/DevToys.Blazor/Core/Extensions/IJSRuntimeExtensions.cs
+++ b/src/app/dev/DevToys.Blazor/Core/Extensions/IJSRuntimeExtensions.cs
@@ -41,6 +41,10 @@ internal static class IJSRuntimeExtensions
{
return false;
}
+ catch (Exception ex)
+ {
+ return false;
+ }
}
/// <summary>
diff --git a/src/app/dev/DevToys.Blazor/Pages/MainLayout.razor.cs b/src/app/dev/DevToys.Blazor/Pages/MainLayout.razor.cs
index f860227ae..7c7fd0b56 100644
--- a/src/app/dev/DevToys.Blazor/Pages/MainLayout.razor.cs
+++ b/src/app/dev/DevToys.Blazor/Pages/MainLayout.razor.cs
@@ -96,7 +96,10 @@ public partial class MainLayout : LayoutComponentBase
ThemeName = themeName;
IsCompactMode = _themeListener.IsCompactMode;
UserIsCompactModePreference = _themeListener.UserIsCompactModePreference;
- StateHasChanged();
+ InvokeAsync(() =>
+ {
+ StateHasChanged();
+ });
Task.Delay(1000).ContinueWith(t =>
{
diff --git a/src/app/dev/DevToys.Business/Properties/AssemblyInfo.cs b/src/app/dev/DevToys.Business/Properties/AssemblyInfo.cs
index b18f41250..34b919351 100644
--- a/src/app/dev/DevToys.Business/Properties/AssemblyInfo.cs
+++ b/src/app/dev/DevToys.Business/Properties/AssemblyInfo.cs
@@ -3,3 +3,4 @@
[assembly: InternalsVisibleTo("DevToys.Blazor")]
[assembly: InternalsVisibleTo("DevToys.Windows")]
[assembly: InternalsVisibleTo("DevToys.MacOS")]
+[assembly: InternalsVisibleTo("DevToys.Linux")]
diff --git a/src/app/dev/DevToys.Core/Settings/PredefinedSettings.cs b/src/app/dev/DevToys.Core/Settings/PredefinedSettings.cs
index 2eb9e05ed..b3de402bf 100644
--- a/src/app/dev/DevToys.Core/Settings/PredefinedSettings.cs
+++ b/src/app/dev/DevToys.Core/Settings/PredefinedSettings.cs
@@ -24,6 +24,9 @@ public static class PredefinedSettings
"SF Mono",
"SF Pro",
+ // Fonts included on some Linux distro.
+ "Noto Mono",
+
// Fonts included on Windows and MacOS.
"Consolas",
"Courier New",
diff --git a/src/app/dev/platforms/desktop/DevToys.CLI/Core/Settings/SettingsStorage.cs b/src/app/dev/platforms/desktop/DevToys.CLI/Core/Settings/SettingsStorage.cs
index c03d711a6..831cb9ea9 100644
--- a/src/app/dev/platforms/desktop/DevToys.CLI/Core/Settings/SettingsStorage.cs
+++ b/src/app/dev/platforms/desktop/DevToys.CLI/Core/Settings/SettingsStorage.cs
@@ -1,5 +1,5 @@
-using DevToys.Api;
-using System.Collections.Concurrent;
+using System.Collections.Concurrent;
+using DevToys.Api;
using DevToys.Core.Settings;
namespace DevToys.CLI.Core.Settings;
diff --git a/src/app/dev/platforms/desktop/DevToys.Linux/Components/BlazorWebView/BlazorWebView.cs b/src/app/dev/platforms/desktop/DevToys.Linux/Components/BlazorWebView/BlazorWebView.cs
new file mode 100644
index 000000000..95b870765
--- /dev/null
+++ b/src/app/dev/platforms/desktop/DevToys.Linux/Components/BlazorWebView/BlazorWebView.cs
@@ -0,0 +1,18 @@
+using Microsoft.Extensions.DependencyInjection;
+using WebKit;
+
+namespace DevToys.Linux.Components;
+
+internal sealed class BlazorWebView : WebView
+{
+ private readonly BlazorWebViewBridge _bridge;
+
+ internal BlazorWebView(IServiceProvider serviceProvider)
+ {
+ _bridge
+ = new BlazorWebViewBridge(
+ this,
+ serviceProvider,
+ serviceProvider.GetRequiredService<BlazorWebViewOptions>());
+ }
+}
diff --git a/src/app/dev/platforms/desktop/DevToys.Linux/Components/BlazorWebView/BlazorWebViewBridge.cs b/src/app/dev/platforms/desktop/DevToys.Linux/Components/BlazorWebView/BlazorWebViewBridge.cs
new file mode 100644
index 000000000..384f2f540
--- /dev/null
+++ b/src/app/dev/platforms/desktop/DevToys.Linux/Components/BlazorWebView/BlazorWebViewBridge.cs
@@ -0,0 +1,149 @@
+using System.Web;
+using DevToys.Api;
+using Gio.Internal;
+using Microsoft.AspNetCore.Components;
+using Microsoft.AspNetCore.Components.Web;
+using Microsoft.AspNetCore.Components.WebView;
+using Microsoft.Extensions.FileProviders;
+using WebKit;
+
+namespace DevToys.Linux.Components;
+
+internal sealed class BlazorWebViewBridge : WebViewManager
+{
+ private const string Scheme = "app";
+ private static readonly Uri baseUri = new($"{Scheme}://localhost/");
+
+ private readonly BlazorWebView _webView;
+ private readonly string _relativeHostPath;
+
+ public BlazorWebViewBridge(
+ BlazorWebView webView,
+ IServiceProvider serviceProvider,
+ BlazorWebViewOptions options)
+ : base(
+ serviceProvider,
+ Dispatcher.CreateDefault(),
+ baseUri,
+ new PhysicalFileProvider(options.ContentRoot),
+ new JSComponentConfigurationStore(),
+ options.RelativeHostPath)
+ {
+ Guard.IsNotNull(webView);
+ _webView = webView;
+
+ _relativeHostPath = options.RelativeHostPath;
+ Type rootComponent = options.RootComponent;
+
+ // This is necessary to automatically serve the files in the `_framework` virtual folder.
+ // Using `file://` will cause the webview to look for the `_framework` files on the file system,
+ // and it won't find them.
+ if (_webView.WebContext is null)
+ {
+ throw new Exception("WebView.WebContext is null");
+ }
+
+ _webView.WebContext.RegisterUriScheme(Scheme, HandleUriScheme);
+
+ Dispatcher.InvokeAsync(async () =>
+ {
+ await AddRootComponentAsync(rootComponent, "#app", ParameterView.Empty);
+ });
+
+ UserContentManager ucm = webView.GetUserContentManager();
+ ucm.AddScript(UserScript.New(
+ source:
+ """
+ window.__receiveMessageCallbacks = [];
+
+ window.__dispatchMessageCallback = function(message) {
+ window.__receiveMessageCallbacks.forEach(function(callback) { callback(message); });
+ };
+
+ window.external = {
+ sendMessage: function(message) {
+ window.webkit.messageHandlers.webview.postMessage(message);
+ },
+ receiveMessage: function(callback) {
+ window.__receiveMessageCallbacks.push(callback);
+ }
+ };
+ """,
+ injectedFrames: UserContentInjectedFrames.AllFrames,
+ injectionTime: UserScriptInjectionTime.Start)
+ );
+
+ UserContentManager.ScriptMessageReceivedSignal.Connect(
+ ucm,
+ HandleScriptMessageReceivedSignal,
+ true,
+ "webview");
+
+ if (!ucm.RegisterScriptMessageHandler("webview", null))
+ {
+ throw new Exception("Could not register script message handler");
+ }
+
+ Navigate("/");
+ }
+
+ protected override void NavigateCore(Uri absoluteUri)
+ {
+ _webView.LoadUri(absoluteUri.ToString());
+ }
+
+ protected override void SendMessage(string message)
+ {
+ string script = $"__dispatchMessageCallback(\"{HttpUtility.JavaScriptStringEncode(message)}\")";
+ _webView.EvaluateJavascriptAsync(script).Forget();
+ }
+
+ private void HandleScriptMessageReceivedSignal(UserContentManager ucm, UserContentManager.ScriptMessageReceivedSignalArgs signalArgs)
+ {
+ JavaScriptCore.Value result = signalArgs.Value;
+ MessageReceived(baseUri, result.ToString());
+ }
+
+ private void HandleUriScheme(URISchemeRequest request)
+ {
+ if (request.GetScheme() != Scheme)
+ {
+ throw new Exception($"Invalid scheme '{request.GetScheme()}'");
+ }
+
+ string uri = request.GetUri();
+ if (request.GetPath() == "/")
+ {
+ uri += _relativeHostPath;
+ }
+
+ if (TryGetResponseContent(
+ uri,
+ false,
+ out int statusCode,
+ out string? statusMessage,
+ out Stream? content,
+ out IDictionary<string, string>? headers))
+ {
+ using var ms = new MemoryStream();
+ content.CopyTo(ms);
+ content.Dispose();
+ nint streamPtr = MemoryInputStream.NewFromData(ref ms.GetBuffer()[0], (uint)ms.Length, _ => { });
+ using var inputStream = new InputStream(streamPtr, false);
+ request.Finish(inputStream, ms.Length, headers["Content-Type"]);
+ }
+ else
+ {
+ throw new Exception($"Failed to serve \"{uri}\". {statusCode} - {statusMessage}");
+ }
+ }
+
+ // Workaround for protection level access
+ private class InputStream : Gio.InputStream
+ {
+ protected internal InputStream(IntPtr ptr, bool ownedRef)
+ : base(ptr, ownedRef)
+ {
+ }
+ }
+}
diff --git a/src/app/dev/platforms/desktop/DevToys.Linux/Components/BlazorWebView/BlazorWebViewOptions.cs b/src/app/dev/platforms/desktop/DevToys.Linux/Components/BlazorWebView/BlazorWebViewOptions.cs
new file mode 100644
index 000000000..4cabf579c
--- /dev/null
+++ b/src/app/dev/platforms/desktop/DevToys.Linux/Components/BlazorWebView/BlazorWebViewOptions.cs
@@ -0,0 +1,12 @@
+namespace DevToys.Linux.Components;
+
+internal record BlazorWebViewOptions
+{
+ internal required Type RootComponent { get; init; }
+
+ internal string HostPath { get; init; } = Path.Combine("wwwroot", "index.html");
+
+ internal string ContentRoot => Path.GetDirectoryName(Path.GetFullPath(HostPath))!;
+
+ internal string RelativeHostPath => Path.GetRelativePath(ContentRoot, HostPath);
+}
diff --git a/src/app/dev/platforms/desktop/DevToys.Linux/Core/Clipboard.cs b/src/app/dev/platforms/desktop/DevToys.Linux/Core/Clipboard.cs
new file mode 100644
index 000000000..d2a7170c4
--- /dev/null
+++ b/src/app/dev/platforms/desktop/DevToys.Linux/Core/Clipboard.cs
@@ -0,0 +1,178 @@
+using System.Text;
+using DevToys.Api;
+using Gdk;
+using Microsoft.Extensions.Logging;
+
+namespace DevToys.Linux.Core;
+
+[Export(typeof(IClipboard))]
+internal sealed partial class Clipboard : IClipboard
+{
+ private readonly ILogger _logger;
+
+ [ImportingConstructor]
+ public Clipboard()
+ {
+ _logger = this.Log();
+ }
+
+ public Task<string?> GetClipboardBitmapAsync()
+ {
+ // TODO
+ throw new NotImplementedException();
+ }
+
+ public async Task<object?> GetClipboardDataAsync()
+ {
+ try
+ {
+ FileInfo[]? files = await GetClipboardFilesAsync();
+ if (files is not null)
+ {
+ return files;
+ }
+
+ string? text = await GetClipboardTextAsync();
+ if (!string.IsNullOrEmpty(text))
+ {
+ return text;
+ }
+
+ // TODO: Get bitmap from clipboard.
+ }
+ catch (Exception ex)
+ {
+ LogGetClipboardFailed(ex);
+ }
+
+ return null;
+ }
+
+ public async Task<FileInfo[]?> GetClipboardFilesAsync()
+ {
+ try
+ {
+ string? clipboardContentText = await GetClipboardTextAsync();
+ if (clipboardContentText is not null)
+ {
+ string[] filePaths = clipboardContentText.Split('\n');
+ var files = new List<FileInfo>();
+ foreach (string filePath in filePaths)
+ {
+ if (File.Exists(filePath))
+ {
+ files.Add(new FileInfo(filePath));
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ return files.ToArray();
+ }
+ }
+ catch (Exception ex)
+ {
+ LogGetClipboardFailed(ex);
+ }
+
+ return null;
+ }
+
+ public async Task<string?> GetClipboardTextAsync()
+ {
+ try
+ {
+ Gdk.Clipboard clipboard = Gdk.Display.GetDefault()!.GetClipboard();
+ var tcs = new TaskCompletionSource<string?>();
+
+ Gdk.Internal.Clipboard.ReadTextAsync(
+ clipboard.Handle,
+ IntPtr.Zero,
+ new Gio.Internal.AsyncReadyCallbackAsyncHandler(
+ (_, args, _) =>
+ {
+ string? result
+ = Gdk.Internal.Clipboard.ReadTextFinish(
+ clipboard.Handle,
+ args.Handle,
+ out GLib.Internal.ErrorOwnedHandle error)
+ .ConvertToString();
+
+ tcs.SetResult(result);
+ }).NativeCallback, IntPtr.Zero);
+
+ string? clipboardContent = await tcs.Task;
+ return clipboardContent;
+ }
+ catch (Exception ex)
+ {
+ LogGetClipboardFailed(ex);
+ }
+
+ return null;
+ }
+
+ public Task SetClipboardBitmapAsync(string? data)
+ {
+ // TODO
+ throw new NotImplementedException();
+ }
+
+ public Task SetClipboardFilesAsync(FileInfo[]? filePaths)
+ {
+ try
+ {
+ Gdk.Clipboard clipboard = Gdk.Display.GetDefault()!.GetClipboard();
+
+ if (filePaths is not null)
+ {
+ var stringBuilder = new StringBuilder();
+ stringBuilder.Append("copy"); // Important.
+
+ for (int i = 0; i < filePaths.Length; i++)
+ {
+ stringBuilder.Append($"\nfile://{filePaths[i].FullName}");
+ }
+
+ string newClipboardContentString = stringBuilder.ToString();
+ byte[] data = Encoding.UTF8.GetBytes(newClipboardContentString);
+ using var dataBytes = GLib.Bytes.New(data);
+ using var content = ContentProvider.NewForBytes("x-special/gnome-copied-files", dataBytes);
+ clipboard.SetContent(content);
+ }
+ else
+ {
+ clipboard.SetText(string.Empty);
+ }
+ }
+ catch (Exception ex)
+ {
+ LogSetClipboardTextFailed(ex);
+ }
+
+ return Task.CompletedTask;
+ }
+
+ public Task SetClipboardTextAsync(string? data)
+ {
+ try
+ {
+ Gdk.Clipboard clipboard = Gdk.Display.GetDefault()!.GetClipboard();
+ clipboard.SetText(data ?? string.Empty);
+ }
+ catch (Exception ex)
+ {
+ LogSetClipboardTextFailed(ex);
+ }
+
+ return Task.CompletedTask;
+ }
+
+ [LoggerMessage(0, LogLevel.Warning, "Failed to retrieve the clipboard data.")]
+ partial void LogGetClipboardFailed(Exception ex);
+
+ [LoggerMessage(1, LogLevel.Error, "Failed to set the clipboard text.")]
+ partial void LogSetClipboardTextFailed(Exception ex);
+}
diff --git a/src/app/dev/platforms/desktop/DevToys.Linux/Core/Constants.cs b/src/app/dev/platforms/desktop/DevToys.Linux/Core/Constants.cs
new file mode 100644
index 000000000..f6e3db4fd
--- /dev/null
+++ b/src/app/dev/platforms/desktop/DevToys.Linux/Core/Constants.cs
@@ -0,0 +1,27 @@
+namespace DevToys.Linux.Core;
+
+internal static class Constants
+{
+ internal static readonly string AppCacheDirectory = GetAppCacheDirectory();
+
+ internal static string PluginInstallationFolder => Path.Combine(AppCacheDirectory, "Plugins");
+
+ private static string GetAppCacheDirectory()
+ {
+ string? applicationDataRootFolder = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
+
+ if (string.IsNullOrEmpty(applicationDataRootFolder))
+ {
+ applicationDataRootFolder = Environment.GetEnvironmentVariable("XDG_DATA_HOME");
+ }
+
+ if (string.IsNullOrEmpty(applicationDataRootFolder))
+ {
+ string userHomeFolderPath = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
+
+ applicationDataRootFolder = Path.Combine(userHomeFolderPath, ".local", "share");
+ }
+
+ return Path.Combine(applicationDataRootFolder, "devtoys");
+ }
+}
diff --git a/src/app/dev/platforms/desktop/DevToys.Linux/Core/FileStorage.cs b/src/app/dev/platforms/desktop/DevToys.Linux/Core/FileStorage.cs
new file mode 100644
index 000000000..05a48e575
--- /dev/null
+++ b/src/app/dev/platforms/desktop/DevToys.Linux/Core/FileStorage.cs
@@ -0,0 +1,324 @@
+using DevToys.Api;
+using DevToys.Linux.Strings.Other;
+using Gtk;
+
+namespace DevToys.Linux.Core;
+
+[Export(typeof(IFileStorage))]
+internal sealed class FileStorage : GObject.Object, IFileStorage
+{
+ [ImportingConstructor]
+ public FileStorage()
+ : base(
+ Gtk.Internal.FileDialog.New(),
+ ownedRef: true)
+ {
+ }
+
+ public string AppCacheDirectory => Constants.AppCacheDirectory;
+
+ internal Gtk.Window? MainWindow { private get; set; }
+
+ public bool FileExists(string relativeOrAbsoluteFilePath)
+ {
+ if (!Path.IsPathRooted(relativeOrAbsoluteFilePath))
+ {
+ relativeOrAbsoluteFilePath = Path.Combine(AppCacheDirectory, relativeOrAbsoluteFilePath);
+ }
+
+ return File.Exists(relativeOrAbsoluteFilePath);
+ }
+
+ public Stream OpenReadFile(string relativeOrAbsoluteFilePath)
+ {
+ if (!Path.IsPathRooted(relativeOrAbsoluteFilePath))
+ {
+ relativeOrAbsoluteFilePath = Path.Combine(AppCacheDirectory, relativeOrAbsoluteFilePath);
+ }
+
+ if (!File.Exists(relativeOrAbsoluteFilePath))
+ {
+ throw new FileNotFoundException("Unable to find the indicated file.", relativeOrAbsoluteFilePath);
+ }
+
+ return File.OpenRead(relativeOrAbsoluteFilePath);
+ }
+
+ public Stream OpenWriteFile(string relativeOrAbsoluteFilePath, bool replaceIfExist)
+ {
+ if (!Path.IsPathRooted(relativeOrAbsoluteFilePath))
+ {
+ relativeOrAbsoluteFilePath = Path.Combine(AppCacheDirectory, relativeOrAbsoluteFilePath);
+ }
+
+ if (File.Exists(relativeOrAbsoluteFilePath) && replaceIfExist)
+ {
+ File.Delete(relativeOrAbsoluteFilePath);
+ }
+
+ string parentDirectory = Path.GetDirectoryName(relativeOrAbsoluteFilePath)!;
+ if (!Directory.Exists(parentDirectory))
+ {
+ Directory.CreateDirectory(parentDirectory);
+ }
+
+ return File.OpenWrite(relativeOrAbsoluteFilePath);
+ }
+
+ public async ValueTask<string?> PickFolderAsync()
+ {
+ Guard.IsNotNull(MainWindow);
+ var tcs = new TaskCompletionSource<Gio.File?>();
+
+ var callbackHandler = new Gio.Internal.AsyncReadyCallbackAsyncHandler((sourceObject, res, data) =>
+ {
+ if (sourceObject is null)
+ {
+ tcs.SetException(new Exception("Missing source object"));
+ return;
+ }
+
+ nint fileValue
+ = Gtk.Internal.FileDialog.SelectFolderFinish(
+ sourceObject.Handle,
+ res.Handle,
+ out GLib.Internal.ErrorOwnedHandle? error);
+
+ if (!error.IsInvalid)
+ {
+ tcs.SetException(new GLib.GException(error));
+ }
+ else if (fileValue == IntPtr.Zero)
+ {
+ tcs.SetResult(null);
+ }
+ else
+ {
+ tcs.SetResult(new Gio.FileHelper(fileValue, true));
+ }
+ });
+
+ Gtk.Internal.FileDialog.SelectFolder(
+ self: base.Handle,
+ parent: MainWindow.Handle,
+ cancellable: IntPtr.Zero,
+ callback: callbackHandler.NativeCallback,
+ userData: IntPtr.Zero
+ );
+
+ try
+ {
+ Gio.File? folder = await tcs.Task;
+ if (folder is not null)
+ {
+ string? folderPath = folder.GetPath();
+ return folderPath;
+ }
+ }
+ catch
+ {
+ }
+
+ return null;
+ }
+
+ public async ValueTask<PickedFile?> PickOpenFileAsync(params string[] fileTypes)
+ {
+ PickedFile[]? selectedFiles = await PickOpenFileInternalAsync(fileTypes, allowMultiple: false).ConfigureAwait(false);
+
+ return selectedFiles is null || selectedFiles.Length == 0 ? null : selectedFiles[0];
+ }
+
+ public ValueTask<PickedFile[]> PickOpenFilesAsync(params string[] fileTypes)
+ {
+ return PickOpenFileInternalAsync(fileTypes, allowMultiple: true);
+ }
+
+ public async ValueTask<Stream?> PickSaveFileAsync(params string[] fileTypes)
+ {
+ Guard.IsNotNull(MainWindow);
+
+ // Create a new GtkFileChooserNative object and set its properties
+ using var fileChooser
+ = Gtk.FileChooserNative.New(
+ Other.SaveFile,
+ MainWindow,
+ Gtk.FileChooserAction.Save,
+ Other.Save,
+ Other.Cancel);
+ fileChooser.Modal = true;
+ fileChooser.SelectMultiple = false;
+
+ // Create filters
+ IReadOnlyList<FileFilter> filters = GenerateFilter(fileTypes);
+ for (int i = 0; i < filters.Count; i++)
+ {
+ fileChooser.AddFilter(filters[i]);
+ }
+
+ var taskCompletionSource = new TaskCompletionSource<Stream?>();
+ fileChooser.OnResponse += (_, e) =>
+ {
+ // Handle the result of the window.
+ if (e.ResponseId != (int)Gtk.ResponseType.Accept)
+ {
+ taskCompletionSource.SetResult(null);
+ return;
+ }
+
+ Gio.ListModel? fileListModel = fileChooser.GetFiles();
+
+ var fileResult = new List<PickedFile>();
+ if (fileListModel is not null)
+ {
+ uint fileCount = fileListModel.GetNItems();
+ if (fileCount == 1)
+ {
+ nint fileValue = fileListModel.GetItem(0);
+ var file = new Gio.FileHelper(fileValue, true);
+ string? filePath = file.GetPath();
+
+ if (!string.IsNullOrEmpty(filePath))
+ {
+ taskCompletionSource.SetResult(
+ new FileStream(
+ filePath,
+ FileMode.OpenOrCreate,
+ FileAccess.Write));
+ return;
+ }
+ }
+ }
+
+ taskCompletionSource.SetResult(null);
+ };
+
+ // Show the dialog.
+ fileChooser.Show();
+
+ return await taskCompletionSource.Task;
+ }
+
+ private async ValueTask<PickedFile[]> PickOpenFileInternalAsync(string[] fileTypes, bool allowMultiple)
+ {
+ Guard.IsNotNull(MainWindow);
+
+ // Create a new GtkFileChooserNative object and set its properties
+ using var fileChooser
+ = Gtk.FileChooserNative.New(
+ allowMultiple ? Other.OpenFiles : Other.OpenFile,
+ MainWindow,
+ Gtk.FileChooserAction.Open,
+ Other.Open,
+ Other.Cancel);
+ fileChooser.Modal = true;
+ fileChooser.SelectMultiple = allowMultiple;
+
+ // Create filters
+ IReadOnlyList<FileFilter> filters = GenerateFilter(fileTypes);
+ for (int i = 0; i < filters.Count; i++)
+ {
+ fileChooser.AddFilter(filters[i]);
+ }
+
+ var taskCompletionSource = new TaskCompletionSource<PickedFile[]>();
+ fileChooser.OnResponse += (_, e) =>
+ {
+ // Handle the result of the window.
+ if (e.ResponseId != (int)Gtk.ResponseType.Accept)
+ {
+ taskCompletionSource.SetResult(Array.Empty<PickedFile>());
+ return;
+ }
+
+ Gio.ListModel? fileListModel = fileChooser.GetFiles();
+
+ var fileResult = new List<PickedFile>();
+ if (fileListModel is not null)
+ {
+ uint fileCount = fileListModel.GetNItems();
+
+ for (uint i = 0; i < fileCount; i++)
+ {
+ nint fileValue = fileListModel.GetItem(i);
+ var file = new Gio.FileHelper(fileValue, true);
+ string? filePath = file.GetPath();
+
+ if (!string.IsNullOrEmpty(filePath) && File.Exists(filePath))
+ {
+ fileResult.Add(
+ new PickedFile(
+ Path.GetFileName(filePath),
+ new FileStream(
+ filePath,
+ FileMode.Open,
+ FileAccess.Read)));
+ }
+ }
+ }
+ taskCompletionSource.SetResult(fileResult.ToArray());
+ };
+
+ // Show the dialog.
+ fileChooser.Show();
+
+ PickedFile[]? files = await taskCompletionSource.Task;
+ if (files is not null && files.Length > 0)
+ {
+ if (allowMultiple)
+ {
+ return files;
+ }
+
+ return new[] { files[0] };
+ }
+
+ return Array.Empty<PickedFile>();
+ }
+
+ private static IReadOnlyList<FileFilter> GenerateFilter(string[] fileTypes)
+ {
+ var filters = new List<FileFilter>();
+ var allFileTypesDescription = new List<string>();
+ var allFileTypes = new List<string>();
+
+ foreach (string fileType in fileTypes.Order())
+ {
+ var filter = Gtk.FileFilter.New();
+ if (string.Equals(fileType, "*.*", StringComparison.CurrentCultureIgnoreCase))
+ {
+ allFileTypesDescription.Add("*.*");
+ allFileTypes.Add("*.*");
+
+ filter.AddPattern("*");
+ filter.Name = Other.AllFiles2;
+ }
+ else
+ {
+ string lowercaseFileType = "*." + fileType.Trim('*').Trim('.').ToLower();
+ string fileTypeDescription = fileType.Trim('*').Trim('.').ToUpper();
+
+ allFileTypesDescription.Add(fileTypeDescription);
+ allFileTypes.Add(lowercaseFileType);
+
+ filter.AddPattern(lowercaseFileType);
+ filter.Name = fileTypeDescription;
+ }
+
+ filters.Add(filter);
+ }
+
+ if (filters.Count > 0)
+ {
+ var filter = Gtk.FileFilter.New();
+ filter.Name = string.Format(Other.AllFiles, string.Join(", ", allFileTypesDescription));
+ for (int i = 0; i < allFileTypes.Count; i++)
+ {
+ filter.AddPattern(allFileTypes[i]);
+ }
+ filters.Insert(0, filter);
+ }
+
+ return filters;
+ }
+}
diff --git a/src/app/dev/platforms/desktop/DevToys.Linux/Core/FontProvider.cs b/src/app/dev/platforms/desktop/DevToys.Linux/Core/FontProvider.cs
new file mode 100644
index 000000000..718d9758b
--- /dev/null
+++ b/src/app/dev/platforms/desktop/DevToys.Linux/Core/FontProvider.cs
@@ -0,0 +1,29 @@
+using DevToys.Api;
+
+namespace DevToys.Linux.Core;
+
+[Export(typeof(IFontProvider))]
+internal sealed partial class FontProvider : IFontProvider
+{
+ internal Gtk.Window? MainWindow { private get; set; }
+
+ public string[] GetFontFamilies()
+ {
+ Guard.IsNotNull(MainWindow);
+ using Pango.FontMap? families = MainWindow.GetPangoContext().GetFontMap();
+ if (families is not null)
+ {
+ uint fontCount = families.GetNItems();
+ var fonts = new List<string>();
+ for (uint i = 0; i < fontCount; i++)
+ {
+ var fontFamily = (Pango.FontFamily)families.GetObject(i)!;
+ fonts.Add(fontFamily.GetName()!);
+ }
+
+ return fonts.Order().ToArray();
+ }
+
+ return Array.Empty<string>(); // TODO: Implement.
+ }
+}
diff --git a/src/app/dev/platforms/desktop/DevToys.Linux/Core/SettingsStorage.cs b/src/app/dev/platforms/desktop/DevToys.Linux/Core/SettingsStorage.cs
new file mode 100644
index 000000000..393c47c17
--- /dev/null
+++ b/src/app/dev/platforms/desktop/DevToys.Linux/Core/SettingsStorage.cs
@@ -0,0 +1,93 @@
+using System.Collections.Concurrent;
+using DevToys.Api;
+using DevToys.Core.Settings;
+
+namespace DevToys.Linux.Core;
+
+[Export(typeof(ISettingsStorage))]
+internal sealed class SettingsStorage : ISettingsStorage
+{
+ private const string SettingsFileName = "settings.ini";
+
+ private readonly IFileStorage _fileStorage;
+ private readonly Lazy<ConcurrentDictionary<string, string>> _settings;
+
+ [ImportingConstructor]
+ public SettingsStorage(IFileStorage fileStorage)
+ {
+ _fileStorage = fileStorage;
+
+ _settings
+ = new Lazy<ConcurrentDictionary<string, string>>(
+ LoadAllSettings());
+ }
+
+ public void ResetSetting(string settingName)
+ {
+ _settings.Value.Remove(settingName, out string? _);
+ }
+
+ public bool TryReadSetting(string settingName, out object? value)
+ {
+ if (_settings.Value.TryGetValue(settingName, out string? valueString))
+ {
+ value = valueString;
+ return true;
+ }
+
+ value = null;
+ return false;
+ }
+
+ public void WriteSetting(string settingName, object? value)
+ {
+ _settings.Value[settingName] = value?.ToString() ?? string.Empty;
+ SaveAllSettingsAsync().Forget();
+ }
+
+ private ConcurrentDictionary<string, string> LoadAllSettings()
+ {
+ var result = new ConcurrentDictionary<string, string>();
+
+ if (_fileStorage.FileExists(SettingsFileName))
+ {
+ using Stream stream = _fileStorage.OpenReadFile(SettingsFileName);
+ using TextReader textReader = new StreamReader(stream);
+
+ string? line = null;
+ do
+ {
+ line = textReader.ReadLine();
+ if (!string.IsNullOrWhiteSpace(line))
+ {
+ int equalSign = line.IndexOf('=');
+ if (equalSign > 0)
+ {
+ string settingName = line.Substring(0, equalSign);
+ string settingValue = line.Substring(equalSign + 1);
+ result[settingName] = settingValue;
+ }
+ }
+ } while (line != null);
+ }
+
+ return result;
+ }
+
+ private Task SaveAllSettingsAsync()
+ {
+ return Task.Run(() =>
+ {
+ lock (_fileStorage)
+ {
+ using Stream stream = _fileStorage.OpenWriteFile(SettingsFileName, replaceIfExist: true);
+ using TextWriter textWriter = new StreamWriter(stream);
+
+ foreach (KeyValuePair<string, string> item in _settings.Value)
+ {
+ textWriter.WriteLine($"{item.Key}={item.Value}");
+ }
+ }
+ });
+ }
+}
diff --git a/src/app/dev/platforms/desktop/DevToys.Linux/Core/ThemeListener.cs b/src/app/dev/platforms/desktop/DevToys.Linux/Core/ThemeListener.cs
new file mode 100644
index 000000000..37a3f5052
--- /dev/null
+++ b/src/app/dev/platforms/desktop/DevToys.Linux/Core/ThemeListener.cs
@@ -0,0 +1,145 @@
+using DevToys.Api;
+using DevToys.Core.Settings;
+using DevToys.Blazor.Components;
+using DevToys.Blazor.Core.Services;
+using Object = GObject.Object;
+using static GObject.Object;
+
+namespace DevToys.Linux.Core;
+
+[Export(typeof(IThemeListener))]
+internal sealed class ThemeListener : IThemeListener
+{
+ private readonly ISettingsProvider _settingsProvider;
+
+ private Gtk.Window? _mainWindow;
+
+ [ImportingConstructor]
+ public ThemeListener(ISettingsProvider settingsProvider)
+ {
+ // Listen for app settings
+ _settingsProvider = settingsProvider;
+ _settingsProvider.SettingChanged += SettingsProvider_SettingChanged;
+
+ // Listen for operating system settings.
+ var gtkSettings = Gtk.Settings.GetDefault();
+ if (gtkSettings is not null)
+ {
+ gtkSettings.OnNotify += System_RequestedThemeChanged;
+ }
+
+ UpdateSystemSettingsAndApplyTheme();
+
+ IsCompactMode = GetBestValueForCompactMode();
+ }
+
+ public AvailableApplicationTheme CurrentSystemTheme { get; private set; }
+
+ public AvailableApplicationTheme CurrentAppTheme => _settingsProvider.GetSetting(PredefinedSettings.Theme);
+
+ public ApplicationTheme ActualAppTheme { get; private set; }
+
+ public bool IsHighContrast { get; private set; }
+
+ public bool IsCompactMode { get; private set; }
+
+ public bool UserIsCompactModePreference => _settingsProvider.GetSetting(PredefinedSettings.CompactMode);
+
+ public event EventHandler? ThemeChanged;
+
+ public void ApplyDesiredColorTheme()
+ {
+ AvailableApplicationTheme theme = CurrentAppTheme;
+
+ if (theme == AvailableApplicationTheme.Default)
+ {
+ theme = CurrentSystemTheme;
+ }
+
+ // Set theme for window root.
+ if (theme == AvailableApplicationTheme.Dark)
+ {
+ ActualAppTheme = ApplicationTheme.Dark;
+ }
+ else
+ {
+ ActualAppTheme = ApplicationTheme.Light;
+ }
+
+ ThemeChanged?.Invoke(this, EventArgs.Empty);
+ }
+
+ internal void SetMainWindow(Gtk.Window window, IWindowService windowService)
+ {
+ _mainWindow = window;
+ windowService.WindowSizeChanged += WindowService_WindowSizeChanged;
+ }
+
+ private void WindowService_WindowSizeChanged(object? sender, EventArgs e)
+ {
+ UpdateCompactModeBasedOnWindowSize();
+ }
+
+ private void SettingsProvider_SettingChanged(object? sender, SettingChangedEventArgs e)
+ {
+ if (string.Equals(PredefinedSettings.Theme.Name, e.SettingName, StringComparison.Ordinal))
+ {
+ ApplyDesiredColorTheme();
+ ThemeChanged?.Invoke(this, EventArgs.Empty);
+ }
+ else if (string.Equals(PredefinedSettings.CompactMode.Name, e.SettingName, StringComparison.Ordinal))
+ {
+ IsCompactMode = GetBestValueForCompactMode();
+ ThemeChanged?.Invoke(this, EventArgs.Empty);
+ }
+ }
+
+ private void System_RequestedThemeChanged(Object? sender, NotifySignalArgs e)
+ {
+ UpdateSystemSettingsAndApplyTheme();
+ }
+
+ private void UpdateCompactModeBasedOnWindowSize()
+ {
+ bool newIsCompactMode = GetBestValueForCompactMode();
+ if (newIsCompactMode != IsCompactMode)
+ {
+ IsCompactMode = newIsCompactMode;
+ ThemeChanged?.Invoke(this, EventArgs.Empty);
+ }
+ }
+
+ private bool GetBestValueForCompactMode()
+ {
+ if (UserIsCompactModePreference)
+ {
+ return true;
+ }
+
+ if (_mainWindow is not null)
+ {
+ return _mainWindow.GetWidth() <= NavBarThresholds.NavBarWidthSidebarCollapseThreshold;
+ }
+
+ return false;
+ }
+
+ private void UpdateSystemSettingsAndApplyTheme()
+ {
+ IsHighContrast = false; // TODO: Detect high contrast
+ CurrentSystemTheme = GetCurrentSystemTheme();
+
+ ApplyDesiredColorTheme();
+ }
+
+ private static AvailableApplicationTheme GetCurrentSystemTheme()
+ {
+ var gtkSettings = Gtk.Settings.GetDefault();
+ if (gtkSettings is not null)
+ {
+ return gtkSettings.GtkApplicationPreferDarkTheme ? AvailableApplicationTheme.Dark : AvailableApplicationTheme.Light;
+ }
+
+ return AvailableApplicationTheme.Light;
+ }
+}
diff --git a/src/app/dev/platforms/desktop/DevToys.Linux/Core/WindowService.cs b/src/app/dev/platforms/desktop/DevToys.Linux/Core/WindowService.cs
new file mode 100644
index 000000000..a55728e09
--- /dev/null
+++ b/src/app/dev/platforms/desktop/DevToys.Linux/Core/WindowService.cs
@@ -0,0 +1,79 @@
+using DevToys.Blazor.Core.Services;
+using Object = GObject.Object;
+using static GObject.Object;
+
+namespace DevToys.Linux.Core;
+
+internal sealed class WindowService : IWindowService
+{
+ private Gtk.Window? _window;
+
+ // Not supported because GTK4 doesn't have APIs to move a window.
+ public bool IsCompactOverlayMode
+ {
+ get => false;
+ set => throw new NotSupportedException();
+ }
+
+ public bool IsCompactOverlayModeSupportedByPlatform => false;
+
+ public event EventHandler<EventArgs>? WindowActivated;
+
+ public event EventHandler<EventArgs>? WindowDeactivated;
+
+ public event EventHandler<EventArgs>? WindowLocationChanged;
+
+ public event EventHandler<EventArgs>? WindowSizeChanged;
+
+ public event EventHandler<EventArgs>? WindowClosing;
+
+ public event EventHandler<EventArgs>? IsCompactOverlayModeChanged;
+
+ internal void SetMainWindow(Gtk.Window window)
+ {
+ Guard.IsNull(_window);
+ Guard.IsNotNull(window);
+ _window = window;
+ _window.OnNotify += Window_OnNotify;
+ _window.OnCloseRequest += Window_OnCloseRequest;
+ }
+
+ private void Window_OnNotify(Object? sender, NotifySignalArgs e)
+ {
+ Guard.IsNotNull(_window);
+
+ if (e.Pspec is not null)
+ {
+ string name = e.Pspec.GetName();
+ if (name == "is-active")
+ {
+ if (_window.IsActive)
+ {
+ WindowActivated?.Invoke(this, EventArgs.Empty);
+ }
+ else
+ {
+ WindowDeactivated?.Invoke(this, EventArgs.Empty);
+ }
+ }
+ else if (name == "position") // Does not work.
+ {
+ // In GTK4, it is not possible to get the current location of a window.
+ // This is because not all window managers/compositors provide this information, for privacy and/or technical reasons.
+ // For example, Wayland does not provide window coordinates, because not every Wayland compositor is even a 2D rectangle1.
+ // Because of this, the functionality was removed from GTK4.
+ WindowLocationChanged?.Invoke(this, EventArgs.Empty);
+ }
+ else if (name == "size" || name == "default-height" || name == "default-width")
+ {
+ WindowSizeChanged?.Invoke(this, EventArgs.Empty);
+ }
+ }
+ }
+
+ private bool Window_OnCloseRequest(Gtk.Window sender, EventArgs e)
+ {
+ WindowClosing?.Invoke(this, EventArgs.Empty);
+ return false; // do not stop closing.
+ }
+}
diff --git a/src/app/dev/platforms/desktop/DevToys.Linux/DevToys.Linux.csproj b/src/app/dev/platforms/desktop/DevToys.Linux/DevToys.Linux.csproj
new file mode 100644
index 000000000..5e7a85ae9
--- /dev/null
+++ b/src/app/dev/platforms/desktop/DevToys.Linux/DevToys.Linux.csproj
@@ -0,0 +1,46 @@
+<Project Sdk="Microsoft.NET.Sdk.Razor">
+ <PropertyGroup>
+ <TargetFramework>$(NetCore)</TargetFramework>
+ <OutputType>Exe</OutputType>
+ <DefineConstants>$(DefineConstants);__LINUX__</DefineConstants>
+ <PluginsInstallationFolder>$(OutputPath)\$(TargetFramework)\Plugins</PluginsInstallationFolder>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <PackageReference Include="GirCore.Adw-1" />
+ <PackageReference Include="GirCore.Gtk-4.0" />
+ <PackageReference Include="GirCore.WebKit-6.0" />
+ <PackageReference Include="Microsoft.AspNetCore.Components.WebView" />
+ <PackageReference Include="Microsoft.Extensions.Logging.Debug" />
+ <PackageReference Include="Microsoft.TypeScript.MSBuild">
+ <PrivateAssets>all</PrivateAssets>
+ <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
+ </PackageReference>
+ </ItemGroup>
+
+ <ItemGroup>
+ <ProjectReference Include="..\..\..\DevToys.Blazor\DevToys.Blazor.csproj" />
+ <ProjectReference Include="..\..\..\DevToys.Localization\DevToys.Localization.csproj" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <Content Include="$(RepoRoot)\src\app\dev\platforms\desktop\DevToys.Windows\wwwroot\index.html" Link="wwwroot\index.html">
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </Content>
+ </ItemGroup>
+
+ <ItemGroup>
+ <Compile Update="Strings\Other\Other.Designer.cs">
+ <DesignTime>True</DesignTime>
+ <AutoGen>True</AutoGen>
+ <DependentUpon>Other.resx</DependentUpon>
+ </Compile>
+ </ItemGroup>
+
+ <ItemGroup>
+ <EmbeddedResource Update="Strings\Other\Other.resx">
+ <Generator>ResXFileCodeGenerator</Generator>
+ <LastGenOutput>Other.Designer.cs</LastGenOutput>
+ </EmbeddedResource>
+ </ItemGroup>
+</Project>
diff --git a/src/app/dev/platforms/desktop/DevToys.Linux/LinuxProgram.cs b/src/app/dev/platforms/desktop/DevToys.Linux/LinuxProgram.cs
new file mode 100644
index 000000000..f24e881cc
--- /dev/null
+++ b/src/app/dev/platforms/desktop/DevToys.Linux/LinuxProgram.cs
@@ -0,0 +1,142 @@
+using DevToys.Api;
+using DevToys.Blazor.BuiltInTools;
+using DevToys.Blazor.BuiltInTools.ExtensionsManager;
+using DevToys.Blazor.Core.Languages;
+using DevToys.Blazor.Core.Services;
+using DevToys.Business.ViewModels;
+using DevToys.Core.Mef;
+using DevToys.Core.Settings;
+using DevToys.Linux.Components;
+using DevToys.Linux.Core;
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Logging;
+using DevToys.Core.Logging;
+
+namespace DevToys.Linux;
+
+internal partial class LinuxProgram
+{
+ internal static ILogger? Logger;
+ private static MefComposer? MefComposer;
+
+ private readonly WindowService _windowService = new();
+ private readonly ServiceCollection _serviceCollection = new();
+ private readonly DateTime _startTime = DateTime.Now;
+
+ private MainWindow? _mainWindow;
+
+ internal LinuxProgram()
+ {
+ WebKit.Module.Initialize();
+
+ Application = Adw.Application.New("devtoys", Gio.ApplicationFlags.FlagsNone);
+
+ Application.OnActivate += OnApplicationActivate;
+ }
+
+ internal Adw.Application Application { get; }
+
+ private void OnApplicationActivate(object sender, object e)
+ {
+ // Initialize services and logging.
+ ServiceProvider serviceProvider = InitializeServices();
+
+ // Listen for unhandled exceptions.
+ AppDomain.CurrentDomain.UnhandledException += (_, ex) =>
+ {
+ LogUnhandledException((Exception)ex.ExceptionObject);
+ };
+
+ // Initialize extension installation folder, and uninstall extensions that are planned for being removed.
+ string[] pluginFolders
+ = new[]
+ {
+ Path.Combine(AppContext.BaseDirectory!, "Plugins"),
+ Constants.PluginInstallationFolder
+ };
+ ExtensionInstallationManager.PreferredExtensionInstallationFolder = Constants.PluginInstallationFolder;
+ ExtensionInstallationManager.ExtensionInstallationFolders = pluginFolders;
+ ExtensionInstallationManager.UninstallExtensionsScheduledForRemoval();
+
+ // Initialize MEF.
+ MefComposer
+ = new MefComposer(
+ assemblies: new[] {
+ typeof(MainWindowViewModel).Assembly,
+ typeof(DevToysBlazorResourceManagerAssemblyIdentifier).Assembly
+ },
+ pluginFolders);
+
+ LogInitialization((DateTime.Now - _startTime).TotalMilliseconds);
+ LogAppStarting();
+
+ // Set the user-defined language.
+ string? languageIdentifier = MefComposer.Provider.Import<ISettingsProvider>().GetSetting(PredefinedSettings.Language);
+ LanguageDefinition languageDefinition
+ = LanguageManager.Instance.AvailableLanguages.FirstOrDefault(l => string.Equals(l.InternalName, languageIdentifier))
+ ?? LanguageManager.Instance.AvailableLanguages[0];
+ LanguageManager.Instance.SetCurrentCulture(languageDefinition);
+
+ // Create and open main window.
+ _mainWindow = new MainWindow(serviceProvider, (Adw.Application)sender);
+ }
+
+ private ServiceProvider InitializeServices()
+ {
+ _serviceCollection.AddBlazorWebView();
+
+ _serviceCollection.AddSingleton(
+ new BlazorWebViewOptions()
+ {
+ RootComponent = typeof(DevToys.Blazor.Main)
+ }
+ );
+
+ _serviceCollection.AddLogging((ILoggingBuilder builder) =>
+ {
+#if DEBUG
+ builder.AddDebug();
+ builder.SetMinimumLevel(LogLevel.Debug);
+#else
+ builder.SetMinimumLevel(LogLevel.Information);
+#endif
+
+ // To save logs on local hard drive.
+ builder.AddFile(new FileStorage());
+
+ builder.AddFilter("Microsoft", LogLevel.Warning);
+ builder.AddFilter("System", LogLevel.Warning);
+ });
+
+ _serviceCollection.AddSingleton(provider => MefComposer!.Provider);
+ _serviceCollection.AddSingleton<IWindowService>(provider => _windowService);
+ _serviceCollection.AddScoped<DocumentEventService, DocumentEventService>();
+ _serviceCollection.AddScoped<PopoverService, PopoverService>();
+ _serviceCollection.AddScoped<ContextMenuService, ContextMenuService>();
+ _serviceCollection.AddScoped<DialogService, DialogService>();
+ _serviceCollection.AddScoped<FontService, FontService>();
+
+ ServiceProvider serviceProvider = _serviceCollection.BuildServiceProvider();
+
+ ILoggerFactory loggerFactory = serviceProvider.GetRequiredService<ILoggerFactory>();
+ LoggingExtensions.LoggerFactory = loggerFactory;
+ Logger = this.Log();
+
+ return serviceProvider;
+ }
+
+ private static void LogUnhandledException(Exception exception)
+ {
+ Logger?.LogCritical(0, exception, "Unhandled exception !!! (╯°□°)╯︵ ┻━┻");
+ }
+
+ private static void LogAppStarting()
+ {
+ Logger?.LogInformation(1, "App is starting...");
+ }
+
+ private static void LogInitialization(double duration)
+ {
+ Logger?.LogInformation(2, "MEF, services and logging initialized in {duration} ms", duration);
+ }
+}
diff --git a/src/app/dev/platforms/desktop/DevToys.Linux/MainWindow.cs b/src/app/dev/platforms/desktop/DevToys.Linux/MainWindow.cs
new file mode 100644
index 000000000..561110c15
--- /dev/null
+++ b/src/app/dev/platforms/desktop/DevToys.Linux/MainWindow.cs
@@ -0,0 +1,69 @@
+using DevToys.Api;
+using DevToys.Blazor.Core.Services;
+using DevToys.Core;
+using DevToys.Linux.Components;
+using DevToys.Linux.Core;
+using Microsoft.Extensions.DependencyInjection;
+
+namespace DevToys.Linux;
+
+internal class MainWindow
+{
+#pragma warning disable IDE0044 // Add readonly modifier
+ [Import]
+ private IThemeListener _themeListener = default!;
+
+ [Import]
+ private IFileStorage _fileStorage = default!;
+
+ [Import]
+ private IFontProvider _fontProvider = default!;
+
+ [Import]
+ private TitleBarInfoProvider _titleBarInfoProvider = default!;
+#pragma warning restore IDE0044 // Add readonly modifier
+
+ private readonly BlazorWebView _blazorWebView;
+ private readonly Gtk.Window _window;
+
+ internal MainWindow(IServiceProvider serviceProvider, Adw.Application application)
+ {
+ serviceProvider.GetService<IMefProvider>()!.SatisfyImports(this);
+ Guard.IsNotNull(_themeListener);
+ Guard.IsNotNull(_titleBarInfoProvider);
+ _titleBarInfoProvider.PropertyChanged += TitleBarInfoProvider_PropertyChanged;
+
+ _blazorWebView = new BlazorWebView(serviceProvider);
+
+ // Allow opening developer tools
+ WebKit.Settings webViewSettings = _blazorWebView.GetSettings();
+#if DEBUG
+ webViewSettings.EnableDeveloperExtras = true;
+#endif
+ webViewSettings.JavascriptCanAccessClipboard = true;
+ webViewSettings.EnableBackForwardNavigationGestures = false;
+ _blazorWebView.SetSettings(webViewSettings);
+
+ // Create and open main window.
+ _window = Gtk.ApplicationWindow.New(application);
+ _window.Title = _titleBarInfoProvider.Title ?? string.Empty;
+ _window.SetDefaultSize(1280, 800);
+ _window.SetChild(_blazorWebView);
+
+ var windowService = (WindowService)serviceProvider.GetService<IWindowService>()!;
+ ((ThemeListener)_themeListener).SetMainWindow(_window, windowService);
+ windowService.SetMainWindow(_window);
+ ((FileStorage)_fileStorage).MainWindow = _window;
+ ((FontProvider)_fontProvider).MainWindow = _window;
+
+ _window.Show();
+ }
+
+ private void TitleBarInfoProvider_PropertyChanged(object? sender, PropertyChangedEventArgs e)
+ {
+ if (e.PropertyName == nameof(TitleBarInfoProvider.Title))
+ {
+ _window.Title = _titleBarInfoProvider.Title ?? string.Empty;
+ }
+ }
+}
diff --git a/src/app/dev/platforms/desktop/DevToys.Linux/Program.cs b/src/app/dev/platforms/desktop/DevToys.Linux/Program.cs
new file mode 100644
index 000000000..43aea2764
--- /dev/null
+++ b/src/app/dev/platforms/desktop/DevToys.Linux/Program.cs
@@ -0,0 +1,14 @@
+namespace DevToys.Linux;
+
+internal partial class Program
+{
+ private static LinuxProgram? linuxProgram;
+
+ private static int Main(string[] args)
+ {
+ linuxProgram = new LinuxProgram();
+ linuxProgram.Application.Run();
+
+ return 0;
+ }
+}
diff --git a/src/app/dev/platforms/desktop/DevToys.Linux/Strings/Other/Other.Designer.cs b/src/app/dev/platforms/desktop/DevToys.Linux/Strings/Other/Other.Designer.cs
new file mode 100644
index 000000000..78b83ac89
--- /dev/null
+++ b/src/app/dev/platforms/desktop/DevToys.Linux/Strings/Other/Other.Designer.cs
@@ -0,0 +1,135 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace DevToys.Linux.Strings.Other {
+ using System;
+
+
+ /// <summary>
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ /// </summary>
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Other {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Other() {
+ }
+
+ /// <summary>
+ /// Returns the cached ResourceManager instance used by this class.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DevToys.Linux.Strings.Other.Other", typeof(Other).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ /// <summary>
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to All {0}.
+ /// </summary>
+ internal static string AllFiles {
+ get {
+ return ResourceManager.GetString("AllFiles", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to All files.
+ /// </summary>
+ internal static string AllFiles2 {
+ get {
+ return ResourceManager.GetString("AllFiles2", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Cancel.
+ /// </summary>
+ internal static string Cancel {
+ get {
+ return ResourceManager.GetString("Cancel", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Open.
+ /// </summary>
+ internal static string Open {
+ get {
+ return ResourceManager.GetString("Open", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Open file.
+ /// </summary>
+ internal static string OpenFile {
+ get {
+ return ResourceManager.GetString("OpenFile", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Open files.
+ /// </summary>
+ internal static string OpenFiles {
+ get {
+ return ResourceManager.GetString("OpenFiles", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Save.
+ /// </summary>
+ internal static string Save {
+ get {
+ return ResourceManager.GetString("Save", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Save file.
+ /// </summary>
+ internal static string SaveFile {
+ get {
+ return ResourceManager.GetString("SaveFile", resourceCulture);
+ }
+ }
+ }
+}
diff --git a/src/app/dev/platforms/desktop/DevToys.Linux/Strings/Other/Other.resx b/src/app/dev/platforms/desktop/DevToys.Linux/Strings/Other/Other.resx
new file mode 100644
index 000000000..e8ded02c2
--- /dev/null
+++ b/src/app/dev/platforms/desktop/DevToys.Linux/Strings/Other/Other.resx
@@ -0,0 +1,152 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace"/>
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0"/>
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string"/>
+ <xsd:attribute name="type" type="xsd:string"/>
+ <xsd:attribute name="mimetype" type="xsd:string"/>
+ <xsd:attribute ref="xml:space"/>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string"/>
+ <xsd:attribute name="name" type="xsd:string"/>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1"/>
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2"/>
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1"/>
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3"/>
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4"/>
+ <xsd:attribute ref="xml:space"/>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1"/>
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required"/>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <data name="AllFiles" xml:space="preserve">
+ <value>All {0}</value>
+ <comment/>
+ </data>
+ <data name="OpenFile" xml:space="preserve">
+ <value>Open file</value>
+ <comment/>
+ </data>
+ <data name="Open" xml:space="preserve">
+ <value>Open</value>
+ <comment/>
+ </data>
+ <data name="Cancel" xml:space="preserve">
+ <value>Cancel</value>
+ <comment/>
+ </data>
+ <data name="OpenFiles" xml:space="preserve">
+ <value>Open files</value>
+ <comment/>
+ </data>
+ <data name="AllFiles2" xml:space="preserve">
+ <value>All files</value>
+ <comment/>
+ </data>
+ <data name="SaveFile" xml:space="preserve">
+ <value>Save file</value>
+ <comment/>
+ </data>
+ <data name="Save" xml:space="preserve">
+ <value>Save</value>
+ <comment/>
+ </data>
+</root>
\ No newline at end of file
diff --git a/src/app/dev/shared/GlobalUsings.cs b/src/app/dev/shared/GlobalUsings.cs
index 657476eba..fbae2853c 100644
--- a/src/app/dev/shared/GlobalUsings.cs
+++ b/src/app/dev/shared/GlobalUsings.cs
@@ -11,6 +11,8 @@ global using ExportAttribute = System.ComponentModel.Composition.ExportAttribute
#if __MACCATALYST__
[assembly: System.Runtime.Versioning.SupportedOSPlatform("ios14.0")] // MacCatalyst is a superset of iOS, therefore it's also supported.
+#elif __LINUX__
+[assembly: System.Runtime.Versioning.SupportedOSPlatform("linux")]
#elif __WINDOWS__
[assembly: System.Runtime.Versioning.SupportedOSPlatform("windows10.0.19041.0")]
#endif