add an app icon

This commit is contained in:
Chris
2024-06-09 22:09:00 -06:00
parent 90242279e2
commit 34d0a96298
10 changed files with 106 additions and 8 deletions

2
.gitignore vendored
View File

@ -4,7 +4,7 @@ lib/*
!lib/libsteam_api.so
release-notes.md
benchmarks/MinEdLauncher.Benchmarks/BenchmarkDotNet.Artifacts/
*.ico
## rust
target/

View File

@ -16,6 +16,8 @@
- Enable restart feature for Epic users. It's still not as seamless as non-Epic accounts. Requires the usage of [Legendary]
or [Heroic]. Once you've logged in with either, you can go back to using the normal Epic launcher if you wish. It will
require re-logging in every few days though, so it may be preferable to just stick with the alternate launchers.
- Added an [icon](resources/min-ed-launcher.svg) for the app. Linux users can check the [readme](README.md#icon-on-linux)
for setup instructions.
## [0.10.1] - 2024-05-03

View File

@ -13,7 +13,7 @@ path = "src/bootstrapper-rs/main.rs"
windows = { version = "0.42", features = [ "Win32_UI_Shell", "Win32_Foundation", "Win32_UI_WindowsAndMessaging" ] }
[build-dependencies]
winres = "0.1"
winresource = "0.1.17"
[package.metadata.winres]
ProductName = "MinEdLauncher.Bootstrap"

View File

@ -23,6 +23,7 @@ accounts on both Windows and Linux.
* [Multi-Account]
* [Frontier account via Steam or Epic]
* [Epic account via Steam]
* [Icon on Linux]
* [Troubleshooting]
* [Cache]
* [Build]
@ -92,7 +93,7 @@ Frontier's website. Linking is only required if you purchased the game via Steam
`gnome-terminal -- ./MinEdLauncher %command% /autorun /autoquit /edo`
`konsole -e ./MinEdLauncher %command% /autorun /autoquit /edo`
`konsole --name min-ed-launcher -e ./MinEdLauncher %command% /autorun /autoquit /edo`
5. Launch your game as you normally would in Steam
#### Epic
1. Download the [latest release] for your operating system
@ -310,6 +311,20 @@ Example _Target_ field for a shortcut that launches Odyssey:
`"C:\Program Files (x86)\Steam\Steam.exe" -gameidlaunch 359320 /edo`
### Icon on Linux
1. Copy the included `min-ed-launcher.svg` file to your environment's default icon location
Common icon locations are `~/.local/share/icons/hicolor/scalable/apps` and `/usr/share/icons/scalable/apps`.
2. Copy the included `min-ed-launcher.desktop` file to your environment's default application launcher location
Common locations are `~/.local/share/applications` and `/usr/share/applications`
You may need to update your cache by running `update-desktop-database` pointed at whereever you copied the
desktop file. e.g. `update-desktop-database ~/.local/share/applications/`
3. Set the WM_CLASS/Application Id property in your launch options. How you do this will depend on your terminal
emulator. Examples are below:
* Alacritty - `alacritty --class min-ed-launcher -e ./MinEdLauncher %command% /autorun /autoquit /edo`
* kitty - `kitty --class min-ed-launcher ./MinEdLauncher %command% /autorun /autoquit /edo`
### Troubleshooting
Debug logging is placed in the standard log location for your operating system:
@ -386,6 +401,7 @@ Note that the bootstrap project specifically targets Windows and won't publish o
[Multi-Account]: #multi-account
[Frontier account via Steam or Epic]: #frontier-account-via-steam-or-epic
[Epic account via Steam]: #epic-account-via-steam
[Icon on Linux]: #icon-on-linux
[Troubleshooting]: #troubleshooting
[Cache]: #cache
[Build]: #build

View File

@ -1,8 +1,13 @@
extern crate winres;
use std::path::Path;
use winresource::WindowsResource;
fn main() {
if cfg!(target_os = "windows") {
let res = winres::WindowsResource::new();
res.compile().unwrap();
let icon_path = "resources/min-ed-launcher.ico";
if Path::new(icon_path).is_file() {
let mut res = WindowsResource::new();
res.set_icon(icon_path);
res.compile().expect("failed to build executable icon");
}
}

View File

@ -1,4 +1,39 @@
$ErrorActionPreference = "Stop"
Set-PSDebug -Strict
function Create-Icon {
echo "Converting SVG icon to ICO"
# https://imagemagick.org/script/download.php
$imageMagick = "magick.exe"
if ((Get-Command $imageMagick -ErrorAction SilentlyContinue) -eq $null)
{
echo "Couldn't find ImageMagick '${imageMagick}'. Skipping icon creation"
return
}
$iconName = "min-ed-launcher"
$svg = "resources/${iconName}.svg"
$ico = "resources/${iconName}.ico"
$resolutions = 16,20,24,32,40,48,64,256
$pngImages = @()
Foreach($r in $resolutions) {
$png = "resources/${r}.png"
$dim = "${r}x${r}"
& $imageMagick -background none $svg -density $dim -resize $dim -gravity center -extent $dim $png
$pngImages += $png
}
# Combine all PNG image files into an ico file
& $imageMagick $pngImages $ico
# Remove PNG files
Foreach($image in $pngImages) {
#Remove-Item $image
}
}
$target="win-x64"
[xml]$proj = Get-Content src\Directory.Build.props
@ -6,6 +41,8 @@ $version=$proj.Project.PropertyGroup.VersionPrefix
$release_name="min-ed-launcher_v${version}_$target"
$target_dir="artifacts\$release_name"
Create-Icon
dotnet publish -r "$target" --self-contained -o "$target_dir" -c ReleaseWindows -p:PublishSingleFile=true src\MinEdLauncher\MinEdLauncher.fsproj
$full_version=(Get-Item "$target_dir\MinEdLauncher.exe").VersionInfo.ProductVersion
(Get-Content Cargo.toml).replace('0.0.0', "$full_version") | Set-Content Cargo.toml # Workaround for https://github.com/rust-lang/cargo/issues/6583

View File

@ -6,7 +6,7 @@ release_name="min-ed-launcher_v${version}_$target"
dotnet restore -r $target
dotnet publish src/MinEdLauncher/MinEdLauncher.fsproj -r "$target" --self-contained true --no-restore -o "artifacts/$release_name" -c Release -p:PublishSingleFile=true
cp README.md CHANGELOG.md "artifacts/$release_name"
cp README.md CHANGELOG.md resources/min-ed-launcher.svg resources/min-ed-launcher.desktop "artifacts/$release_name"
rm artifacts/"$release_name"/*.pdb
tar czvf "artifacts/$release_name.tar.gz" -C "artifacts" "$release_name"

View File

@ -0,0 +1,9 @@
[Desktop Entry]
Name=Minimal ED Launcher
Comment=Launches the game Elite: Dangerous
Exec=MinEdLauncher %F
Terminal=true
Type=Application
Keywords=elite;ed;launcher;
Icon=min-ed-launcher
Categories=Game;

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
version="1.1"
width="1033.1444"
height="872.3761"
viewBox="0 0 1033.1444 872.3761"
id="svg1"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<g
id="logo"
style="fill:none;stroke:#f07b05;stroke-width:25;stroke-opacity:1"
transform="translate(10,22.768973)">
<path
d="M 518,840.48308 879.92783,488.69982 880.5,392.5 943,334.24956 V 233.27369 L 1021.25,162.00338 1022,14 636,366.24807 V 470.52572 L 518,579 400.00021,470.5 400,366.24807 14,14 v 74 l 0.75,74.00338 78.25,71.27031 v 100.97587 l 62.5,58.25044 0.57214,96.19098 z"
id="wings"
transform="translate(-11.5,-8.3077568)"/>
<path
d="M 597,458.67358 V 395.3958 L 595.94873,331.46831 518,397.75 440.05127,331.46831 439,395.3958 v 63.27778 l 78.59617,72.18268 z"
id="head"
transform="translate(-11.5,-8.3077568)" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 956 B

View File

@ -38,6 +38,11 @@
<PropertyGroup>
<IsLinux>!$(DefineConstants.Contains('WINDOWS'))</IsLinux>
<IsWindows>$(DefineConstants.Contains('WINDOWS'))</IsWindows>
</PropertyGroup>
<PropertyGroup Condition="$(IsWindows) And Exists('..\..\resources\min-ed-launcher.ico')">
<ApplicationIcon>..\..\resources\min-ed-launcher.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>