translations, minor refactoring, wgui: gradient intensity in globals, dash-frontend: remove unused window_list, process_list and window_options
This commit is contained in:
@@ -32,6 +32,8 @@ pub struct AppManifest {
|
||||
pub last_played: Option<u64>, // unix timestamp
|
||||
}
|
||||
|
||||
// TODO @oo8dev: game sort methods
|
||||
#[allow(dead_code)]
|
||||
pub enum GameSortMethod {
|
||||
NameAsc,
|
||||
NameDesc,
|
||||
@@ -119,6 +121,15 @@ struct AppEntry {
|
||||
pub app_id: AppID,
|
||||
}
|
||||
|
||||
pub fn launch(app_id: &AppID) -> anyhow::Result<()> {
|
||||
log::info!("Launching Steam game with AppID {}", app_id);
|
||||
call_steam(&format!("steam://rungameid/{}", app_id))?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// TODO @oo8dev: running games list (#398)
|
||||
/*
|
||||
|
||||
pub fn stop(app_id: AppID, force_kill: bool) -> anyhow::Result<()> {
|
||||
log::info!("Stopping Steam game with AppID {}", app_id);
|
||||
|
||||
@@ -137,12 +148,6 @@ pub fn stop(app_id: AppID, force_kill: bool) -> anyhow::Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn launch(app_id: &AppID) -> anyhow::Result<()> {
|
||||
log::info!("Launching Steam game with AppID {}", app_id);
|
||||
call_steam(&format!("steam://rungameid/{}", app_id))?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
pub struct RunningGame {
|
||||
pub app_id: AppID,
|
||||
@@ -215,7 +220,7 @@ pub fn list_running_games() -> anyhow::Result<Vec<RunningGame>> {
|
||||
}
|
||||
|
||||
Ok(res)
|
||||
}
|
||||
} */
|
||||
|
||||
fn call_steam(arg: &str) -> anyhow::Result<()> {
|
||||
match std::process::Command::new("xdg-open").arg(arg).spawn() {
|
||||
|
||||
@@ -1,77 +1,3 @@
|
||||
use std::{path::PathBuf, rc::Rc, str::FromStr};
|
||||
use wgui::{
|
||||
assets::{AssetPath, AssetPathOwned},
|
||||
globals::WguiGlobals,
|
||||
i18n::Translation,
|
||||
layout::{Layout, WidgetID},
|
||||
renderer_vk::text::custom_glyph::CustomGlyphData,
|
||||
taffy::{self, prelude::length},
|
||||
widget::{
|
||||
label::{WidgetLabel, WidgetLabelParams},
|
||||
sprite::{WidgetSprite, WidgetSpriteParams},
|
||||
},
|
||||
};
|
||||
use wlx_common::desktop_finder;
|
||||
use std::rc::Rc;
|
||||
|
||||
pub type AsyncExecutor = Rc<smol::LocalExecutor<'static>>;
|
||||
|
||||
// the compiler wants to scream
|
||||
#[allow(irrefutable_let_patterns)]
|
||||
pub fn get_desktop_file_icon_path(desktop_file: &desktop_finder::DesktopEntry) -> AssetPathOwned {
|
||||
/*
|
||||
FIXME: why is the compiler complaining about trailing irrefutable patterns there?!?!
|
||||
looking at the PathBuf::from_str implementation, it always returns Ok() and it's inline, maybe that's why.
|
||||
*/
|
||||
if let Some(icon) = &desktop_file.icon_path
|
||||
&& let Ok(path) = PathBuf::from_str(icon)
|
||||
{
|
||||
return AssetPathOwned::File(path);
|
||||
}
|
||||
|
||||
AssetPathOwned::BuiltIn(PathBuf::from_str("dashboard/terminal.svg").unwrap())
|
||||
}
|
||||
|
||||
pub fn mount_simple_label(
|
||||
globals: &WguiGlobals,
|
||||
layout: &mut Layout,
|
||||
parent_id: WidgetID,
|
||||
translation: Translation,
|
||||
) -> anyhow::Result<()> {
|
||||
layout.add_child(
|
||||
parent_id,
|
||||
WidgetLabel::create(
|
||||
&mut globals.get(),
|
||||
WidgetLabelParams {
|
||||
content: translation,
|
||||
..Default::default()
|
||||
},
|
||||
),
|
||||
taffy::Style::default(),
|
||||
)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn mount_simple_sprite_square(
|
||||
globals: &WguiGlobals,
|
||||
layout: &mut Layout,
|
||||
parent_id: WidgetID,
|
||||
size_px: f32,
|
||||
path: AssetPath,
|
||||
) -> anyhow::Result<()> {
|
||||
layout.add_child(
|
||||
parent_id,
|
||||
WidgetSprite::create(WidgetSpriteParams {
|
||||
glyph_data: Some(CustomGlyphData::from_assets(globals, path)?),
|
||||
..Default::default()
|
||||
}),
|
||||
taffy::Style {
|
||||
size: taffy::Size {
|
||||
width: length(size_px),
|
||||
height: length(size_px),
|
||||
},
|
||||
..Default::default()
|
||||
},
|
||||
)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user