mirror of
https://github.com/djibux/BoilR.git
synced 2026-09-01 05:53:41 +02:00
Add features to add flatpak apps on linux (#161)
* Add features to add flatpak apps on linux * Fix build on windows
This commit is contained in:
@@ -42,6 +42,8 @@ There is also an [AUR package](https://aur.archlinux.org/packages/steam-boilr-gu
|
||||
|
||||
- [x] Show games from other platforms in your steam library
|
||||
- [x] Automatically download art from [SteamGridDB](https://www.steamgriddb.com/)
|
||||
- [x] Customize your Steam games art
|
||||
- [x] Backup your shortcuts
|
||||
- [x] Cross Platform (Windows, Linux, Mac, Steam Deck)
|
||||
- [x] Standalone / No install needed
|
||||
- [x] Small (~3mb on disk)
|
||||
@@ -60,6 +62,7 @@ There is also an [AUR package](https://aur.archlinux.org/packages/steam-boilr-gu
|
||||
- [x] [Rare](https://github.com/Dummerle/Rare/releases)
|
||||
- [x] [Heroic Launcher](https://github.com/Heroic-Games-Launcher/HeroicGamesLauncher) (Linux Only)
|
||||
- [x] [Amazon Games](https://gaming.amazon.com) (Windows Only)
|
||||
- [x] [Flatpak](https://flathub.org/) (Linux Only)
|
||||
- [ ] XBox/Microsoft Store integration
|
||||
|
||||
|
||||
|
||||
@@ -43,6 +43,10 @@ default_launch_through_heroic = true
|
||||
[amazon]
|
||||
enabled = true
|
||||
|
||||
|
||||
[flatpak]
|
||||
enabled = true
|
||||
|
||||
[steam]
|
||||
create_collections = false
|
||||
optimize_for_big_picture = false
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
mod platform;
|
||||
mod settings;
|
||||
|
||||
pub use platform::*;
|
||||
pub use settings::*;
|
||||
@@ -0,0 +1,78 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::platform::{Platform, SettingsValidity};
|
||||
use std::error::Error;
|
||||
|
||||
use super::FlatpakSettings;
|
||||
use steam_shortcuts_util::{shortcut::ShortcutOwned, Shortcut};
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize, Clone)]
|
||||
pub struct FlatpakPlatform {
|
||||
pub settings: FlatpakSettings,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct FlatpakApp {
|
||||
pub name: String,
|
||||
pub id: String,
|
||||
}
|
||||
|
||||
impl From<FlatpakApp> for ShortcutOwned {
|
||||
fn from(app: FlatpakApp) -> Self {
|
||||
let launch_parameter = format!("run {}", app.id);
|
||||
Shortcut::new("0", &app.name, "flatpak", "", "", "", &launch_parameter).to_owned()
|
||||
}
|
||||
}
|
||||
|
||||
impl Platform<FlatpakApp, Box<dyn Error>> for FlatpakPlatform {
|
||||
fn enabled(&self) -> bool {
|
||||
self.settings.enabled
|
||||
}
|
||||
|
||||
fn name(&self) -> &str {
|
||||
"Flatpak"
|
||||
}
|
||||
|
||||
fn get_shortcuts(&self) -> Result<Vec<FlatpakApp>, Box<dyn Error>> {
|
||||
use std::process::Command;
|
||||
let mut command = Command::new("flatpak");
|
||||
let output = command
|
||||
.arg("list")
|
||||
.arg("--app")
|
||||
.arg("--columns=name,application")
|
||||
.output()?;
|
||||
let output_string = String::from_utf8_lossy(&output.stdout).to_string();
|
||||
let mut result = vec![];
|
||||
for line in output_string.lines() {
|
||||
let mut split = line.split("\t");
|
||||
if let Some(name) = split.next() {
|
||||
if let Some(id) = split.next() {
|
||||
result.push(FlatpakApp {
|
||||
name: name.to_string(),
|
||||
id: id.to_string(),
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(result)
|
||||
}
|
||||
|
||||
fn settings_valid(&self) -> crate::platform::SettingsValidity {
|
||||
let shortcuts_res = self.get_shortcuts();
|
||||
match shortcuts_res {
|
||||
Ok(_) => SettingsValidity::Valid,
|
||||
Err(err) => SettingsValidity::Invalid {
|
||||
reason: format!("{}", err),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_family = "unix")]
|
||||
fn create_symlinks(&self) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
fn needs_proton(&self, _input: &FlatpakApp) -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize, Clone)]
|
||||
pub struct FlatpakSettings {
|
||||
pub enabled: bool,
|
||||
}
|
||||
@@ -15,6 +15,7 @@ mod steamgriddb;
|
||||
mod sync;
|
||||
mod ui;
|
||||
mod uplay;
|
||||
mod flatpak;
|
||||
use std::error::Error;
|
||||
|
||||
fn main() -> Result<(), Box<dyn Error>> {
|
||||
|
||||
+4
-3
@@ -1,8 +1,8 @@
|
||||
use crate::{
|
||||
amazon::AmazonSettings, config::get_config_file, egs::EpicGamesLauncherSettings,
|
||||
gog::GogSettings, heroic::HeroicSettings, itch::ItchSettings, legendary::LegendarySettings,
|
||||
lutris::settings::LutrisSettings, origin::OriginSettings, steam::SteamSettings,
|
||||
steamgriddb::SteamGridDbSettings, uplay::UplaySettings,
|
||||
flatpak::FlatpakSettings, gog::GogSettings, heroic::HeroicSettings, itch::ItchSettings,
|
||||
legendary::LegendarySettings, lutris::settings::LutrisSettings, origin::OriginSettings,
|
||||
steam::SteamSettings, steamgriddb::SteamGridDbSettings, uplay::UplaySettings,
|
||||
};
|
||||
|
||||
use config::{Config, ConfigError, Environment, File};
|
||||
@@ -25,6 +25,7 @@ pub struct Settings {
|
||||
pub lutris: LutrisSettings,
|
||||
pub heroic: HeroicSettings,
|
||||
pub amazon: AmazonSettings,
|
||||
pub flatpak: FlatpakSettings,
|
||||
}
|
||||
|
||||
impl Settings {
|
||||
|
||||
@@ -3,6 +3,7 @@ use tokio::sync::watch::Sender;
|
||||
|
||||
use crate::{
|
||||
egs::EpicPlatform,
|
||||
flatpak::FlatpakPlatform,
|
||||
legendary::LegendaryPlatform,
|
||||
lutris::lutris_platform::LutrisPlatform,
|
||||
platform::Platform,
|
||||
@@ -217,6 +218,10 @@ pub fn get_platform_shortcuts(settings: &Settings) -> Vec<(String, Vec<ShortcutO
|
||||
platform_results.push(update_platform_shortcuts(&HeroicPlatform {
|
||||
settings: settings.heroic.clone(),
|
||||
}));
|
||||
|
||||
platform_results.push(update_platform_shortcuts(&FlatpakPlatform {
|
||||
settings: settings.flatpak.clone(),
|
||||
}));
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
Heroic Games Launcher com.heroicgameslauncher.hgl
|
||||
BoilR io.github.philipk.boilr
|
||||
Lutris net.lutris.Lutris
|
||||
@@ -49,12 +49,27 @@ impl MyEguiApp {
|
||||
{
|
||||
self.render_amazon_settings(ui);
|
||||
}
|
||||
|
||||
|
||||
#[cfg(target_family = "unix")]
|
||||
{
|
||||
self.render_flatpak_settings(ui);
|
||||
}
|
||||
|
||||
|
||||
ui.add_space(SECTION_SPACING);
|
||||
ui.label(format!("Version: {}", VERSION));
|
||||
});
|
||||
}
|
||||
|
||||
fn render_flatpak_settings(&mut self, ui: &mut egui::Ui) {
|
||||
ui.heading("Flatpak");
|
||||
ui.checkbox(&mut self.settings.flatpak.enabled, "Import from Flatpak");
|
||||
|
||||
ui.add_space(SECTION_SPACING);
|
||||
}
|
||||
|
||||
|
||||
fn render_heroic_settings(&mut self, ui: &mut egui::Ui) {
|
||||
ui.heading("Heroic");
|
||||
ui.checkbox(&mut self.settings.heroic.enabled, "Import from Heroic");
|
||||
|
||||
Reference in New Issue
Block a user