Skip to content

Commit

Permalink
add an app icon
Browse files Browse the repository at this point in the history
  • Loading branch information
rfvgyhn committed Jun 10, 2024
1 parent 9024227 commit 34d0a96
Show file tree
Hide file tree
Showing 10 changed files with 106 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ lib/*
!lib/libsteam_api.so
release-notes.md
benchmarks/MinEdLauncher.Benchmarks/BenchmarkDotNet.Artifacts/

*.ico
## rust
target/

Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
13 changes: 9 additions & 4 deletions build.rs
Original file line number Diff line number Diff line change
@@ -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");
}
}
37 changes: 37 additions & 0 deletions publish.ps1
Original file line number Diff line number Diff line change
@@ -1,11 +1,48 @@
$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
$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
Expand Down
2 changes: 1 addition & 1 deletion publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
9 changes: 9 additions & 0 deletions resources/min-ed-launcher.desktop
Original file line number Diff line number Diff line change
@@ -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;
24 changes: 24 additions & 0 deletions resources/min-ed-launcher.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions src/MinEdLauncher/MinEdLauncher.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit 34d0a96

Please sign in to comment.