diff --git a/Cargo.lock b/Cargo.lock index 3127c00cf..d649b21ae 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4609,7 +4609,7 @@ dependencies = [ [[package]] name = "theseus" -version = "0.2.2" +version = "0.3.0" dependencies = [ "async-recursion", "async-tungstenite", @@ -4654,7 +4654,7 @@ dependencies = [ [[package]] name = "theseus_cli" -version = "0.2.2" +version = "0.3.0" dependencies = [ "argh", "color-eyre", @@ -4681,7 +4681,7 @@ dependencies = [ [[package]] name = "theseus_gui" -version = "0.2.2" +version = "0.3.0" dependencies = [ "chrono", "cocoa", diff --git a/theseus/Cargo.toml b/theseus/Cargo.toml index 45cfa41f6..cd1a8019d 100644 --- a/theseus/Cargo.toml +++ b/theseus/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "theseus" -version = "0.2.2" +version = "0.3.0" authors = ["Jai A "] edition = "2018" diff --git a/theseus/src/api/mod.rs b/theseus/src/api/mod.rs index 2c6efeb9b..4bc94b5e1 100644 --- a/theseus/src/api/mod.rs +++ b/theseus/src/api/mod.rs @@ -27,7 +27,7 @@ pub mod prelude { jre, metadata, pack, process, profile::{self, create, Profile}, settings, - state::{JavaGlobals, SetFullscreen}, + state::JavaGlobals, state::{ProfilePathId, ProjectPathId}, util::{ io::{canonicalize, IOError}, diff --git a/theseus/src/api/profile/mod.rs b/theseus/src/api/profile/mod.rs index a585d80d7..7bc5ca383 100644 --- a/theseus/src/api/profile/mod.rs +++ b/theseus/src/api/profile/mod.rs @@ -7,9 +7,7 @@ use crate::event::LoadingBarType; use crate::pack::install_from::{ EnvType, PackDependency, PackFile, PackFileHash, PackFormat, }; -use crate::prelude::{ - JavaVersion, ProfilePathId, ProjectPathId, SetFullscreen, -}; +use crate::prelude::{JavaVersion, ProfilePathId, ProjectPathId}; use crate::state::ProjectMetadata; use crate::util::io::{self, IOError}; @@ -841,17 +839,13 @@ pub async fn run_credentials( }; // Any options.txt settings that we want set, add here - let mut mc_set_options: Vec<(String, String)> = Vec::new(); - match profile.force_fullscreen { - SetFullscreen::LeaveUnset => {} - SetFullscreen::SetWindowed => { - mc_set_options - .push(("fullscreen".to_string(), "false".to_string())); - } - SetFullscreen::SetFullscreen => { - mc_set_options.push(("fullscreen".to_string(), "true".to_string())); - } - } + let mc_set_options: Vec<(String, String)> = vec![( + "fullscreen".to_string(), + profile + .fullscreen + .unwrap_or(settings.force_fullscreen) + .to_string(), + )]; let mc_process = crate::launcher::launch_minecraft( java_args, diff --git a/theseus/src/launcher/mod.rs b/theseus/src/launcher/mod.rs index 07b9043e2..158f24a7b 100644 --- a/theseus/src/launcher/mod.rs +++ b/theseus/src/launcher/mod.rs @@ -6,7 +6,6 @@ use crate::launcher::io::IOError; use crate::prelude::JavaVersion; use crate::state::ProfileInstallStage; use crate::util::io; -use crate::EventState; use crate::{ process, state::{self as st, MinecraftChild}, @@ -532,6 +531,8 @@ pub async fn launch_minecraft( // If in tauri, and the 'minimize on launch' setting is enabled, minimize the window #[cfg(feature = "tauri")] { + use crate::EventState; + let window = EventState::get_main_window().await?; if let Some(window) = window { let settings = state.settings.read().await; diff --git a/theseus/src/state/children.rs b/theseus/src/state/children.rs index 830f894b1..d00b86bb2 100644 --- a/theseus/src/state/children.rs +++ b/theseus/src/state/children.rs @@ -13,7 +13,7 @@ use tracing::error; use crate::event::emit::emit_process; use crate::event::ProcessPayloadType; use crate::util::io::IOError; -use crate::EventState; + use tokio::task::JoinHandle; use uuid::Uuid; @@ -155,7 +155,7 @@ impl Children { // If in tauri, window should show itself again after process exists if it was hidden #[cfg(feature = "tauri")] { - let window = EventState::get_main_window().await?; + let window = crate::EventState::get_main_window().await?; if let Some(window) = window { window.unminimize()?; } diff --git a/theseus/src/state/profiles.rs b/theseus/src/state/profiles.rs index edfc1c2c9..1eea33bac 100644 --- a/theseus/src/state/profiles.rs +++ b/theseus/src/state/profiles.rs @@ -149,8 +149,7 @@ pub struct Profile { pub memory: Option, #[serde(skip_serializing_if = "Option::is_none")] pub resolution: Option, - #[serde(default)] - pub force_fullscreen: SetFullscreen, + pub fullscreen: Option, #[serde(skip_serializing_if = "Option::is_none")] pub hooks: Option, pub projects: HashMap, @@ -225,21 +224,6 @@ impl ModLoader { } } -#[derive(Serialize, Deserialize, Clone, Debug, Copy)] -pub enum SetFullscreen { - #[serde(rename = "Leave unset")] - LeaveUnset, - #[serde(rename = "Set windowed")] - SetWindowed, - #[serde(rename = "Set fullscreen")] - SetFullscreen, -} -impl Default for SetFullscreen { - fn default() -> Self { - Self::LeaveUnset - } -} - #[derive(Serialize, Deserialize, Clone, Debug)] pub struct JavaSettings { #[serde(skip_serializing_if = "Option::is_none")] @@ -285,7 +269,7 @@ impl Profile { java: None, memory: None, resolution: None, - force_fullscreen: SetFullscreen::LeaveUnset, + fullscreen: None, hooks: None, modrinth_update_version: None, }) diff --git a/theseus/src/state/settings.rs b/theseus/src/state/settings.rs index 4d17e5b1c..2886901b0 100644 --- a/theseus/src/state/settings.rs +++ b/theseus/src/state/settings.rs @@ -18,6 +18,8 @@ const CURRENT_FORMAT_VERSION: u32 = 1; pub struct Settings { pub theme: Theme, pub memory: MemorySettings, + #[serde(default)] + pub force_fullscreen: bool, pub game_resolution: WindowSize, pub custom_java_args: Vec, pub custom_env_args: Vec<(String, String)>, @@ -64,6 +66,7 @@ impl Settings { Ok(Self { theme: Theme::Dark, memory: MemorySettings::default(), + force_fullscreen: false, game_resolution: WindowSize::default(), custom_java_args: Vec::new(), custom_env_args: Vec::new(), diff --git a/theseus_cli/Cargo.toml b/theseus_cli/Cargo.toml index 90f39cd81..94f6ef654 100644 --- a/theseus_cli/Cargo.toml +++ b/theseus_cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "theseus_cli" -version = "0.2.2" +version = "0.3.0" authors = ["Jai A "] edition = "2018" diff --git a/theseus_gui/src-tauri/Cargo.toml b/theseus_gui/src-tauri/Cargo.toml index 9dbc7d789..6b5acb09f 100644 --- a/theseus_gui/src-tauri/Cargo.toml +++ b/theseus_gui/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "theseus_gui" -version = "0.2.2" +version = "0.3.0" description = "A Tauri App" authors = ["you"] license = "" diff --git a/theseus_gui/src-tauri/src/api/profile.rs b/theseus_gui/src-tauri/src/api/profile.rs index 99f1a6e2d..b4c10e7dd 100644 --- a/theseus_gui/src-tauri/src/api/profile.rs +++ b/theseus_gui/src-tauri/src/api/profile.rs @@ -276,7 +276,7 @@ pub struct EditProfile { pub memory: Option, pub resolution: Option, pub hooks: Option, - pub force_fullscreen: Option, + pub fullscreen: Option, } #[derive(Serialize, Deserialize, Clone, Debug)] @@ -316,9 +316,7 @@ pub async fn profile_edit( prof.java = edit_profile.java.clone(); prof.memory = edit_profile.memory; prof.resolution = edit_profile.resolution; - if let Some(force_fullscreen) = edit_profile.force_fullscreen { - prof.force_fullscreen = force_fullscreen; - } + prof.fullscreen = edit_profile.fullscreen; prof.hooks = edit_profile.hooks.clone(); prof.metadata.date_modified = chrono::Utc::now(); diff --git a/theseus_gui/src-tauri/tauri.conf.json b/theseus_gui/src-tauri/tauri.conf.json index 644ace2b8..59a2921b9 100644 --- a/theseus_gui/src-tauri/tauri.conf.json +++ b/theseus_gui/src-tauri/tauri.conf.json @@ -8,7 +8,7 @@ }, "package": { "productName": "Modrinth App", - "version": "0.2.2" + "version": "0.3.0" }, "tauri": { "allowlist": { diff --git a/theseus_gui/src/pages/Settings.vue b/theseus_gui/src/pages/Settings.vue index 410a04ae6..2505ad005 100644 --- a/theseus_gui/src/pages/Settings.vue +++ b/theseus_gui/src/pages/Settings.vue @@ -144,7 +144,7 @@ watch( " /> -
+
+
+ + +
- +
- + +
@@ -346,7 +350,9 @@ import { XIcon, SaveIcon, HammerIcon, + DownloadIcon, ModalConfirm, + Toggle, } from 'omorphia' import { Multiselect } from 'vue-multiselect' import { useRouter } from 'vue-router' @@ -445,8 +451,7 @@ const resolution = ref(props.instance.resolution ?? globalSettings.game_resoluti const overrideHooks = ref(!!props.instance.hooks) const hooks = ref(props.instance.hooks ?? globalSettings.hooks) -const fullscreenOptions = ref(['Leave unchanged', 'Set windowed', 'Set fullscreen']) -const forceFullscreen = ref(props.instance.force_fullscreen) +const fullscreen = ref(props.instance.fullscreen) watch( [ @@ -463,7 +468,7 @@ watch( memory, overrideWindowSettings, resolution, - forceFullscreen, + fullscreen, overrideHooks, hooks, ], @@ -508,11 +513,11 @@ watch( } if (overrideWindowSettings.value) { - editProfile.resolution = resolution.value - } + editProfile.fullscreen = fullscreen.value - if (forceFullscreen.value) { - editProfile.force_fullscreen = forceFullscreen.value + if (!fullscreen.value) { + editProfile.resolution = resolution.value + } } if (overrideHooks.value) {