feat: add dont_switch_primary
This commit is contained in:
@ -75,6 +75,12 @@ pub struct Display {
|
|||||||
pub rotation: i32,
|
pub rotation: i32,
|
||||||
pub frequency: i32,
|
pub frequency: i32,
|
||||||
pub borderless_fullscreen: bool,
|
pub borderless_fullscreen: bool,
|
||||||
|
|
||||||
|
#[serde(default)]
|
||||||
|
pub dont_switch_primary: bool,
|
||||||
|
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub monitor_index_override: Option<i32>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Display {
|
impl Display {
|
||||||
@ -92,6 +98,8 @@ impl Display {
|
|||||||
Game::Ongeki => 60,
|
Game::Ongeki => 60,
|
||||||
},
|
},
|
||||||
borderless_fullscreen: true,
|
borderless_fullscreen: true,
|
||||||
|
dont_switch_primary: false,
|
||||||
|
monitor_index_override: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
use crate::model::profile::{Display, DisplayMode};
|
use crate::model::profile::{Display, DisplayMode};
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use displayz::{query_displays, DisplaySet};
|
use displayz::{query_displays, DisplaySet};
|
||||||
@ -7,14 +6,14 @@ use tauri::{AppHandle, Listener};
|
|||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct DisplayInfo {
|
pub struct DisplayInfo {
|
||||||
pub primary: String,
|
pub primary: String,
|
||||||
pub set: Option<DisplaySet>
|
pub set: Option<DisplaySet>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for DisplayInfo {
|
impl Default for DisplayInfo {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
DisplayInfo {
|
DisplayInfo {
|
||||||
primary: "default".to_owned(),
|
primary: "default".to_owned(),
|
||||||
set: query_displays().ok()
|
set: query_displays().ok(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -52,14 +51,16 @@ impl Display {
|
|||||||
.find(|display| display.name() == self.target)
|
.find(|display| display.name() == self.target)
|
||||||
.ok_or_else(|| anyhow!("Display {} not found", self.target))?;
|
.ok_or_else(|| anyhow!("Display {} not found", self.target))?;
|
||||||
|
|
||||||
|
if !self.dont_switch_primary {
|
||||||
target.set_primary()?;
|
target.set_primary()?;
|
||||||
|
}
|
||||||
let settings = target.settings()
|
let settings = target.settings()
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.ok_or_else(|| anyhow!("Unable to query display settings"))?;
|
.ok_or_else(|| anyhow!("Unable to query display settings"))?;
|
||||||
|
|
||||||
let res = DisplayInfo {
|
let res = DisplayInfo {
|
||||||
primary: primary.name().to_owned(),
|
primary: primary.name().to_owned(),
|
||||||
set: Some(display_set.clone())
|
set: Some(display_set.clone()),
|
||||||
};
|
};
|
||||||
|
|
||||||
if self.rotation == 90 || self.rotation == 270 {
|
if self.rotation == 90 || self.rotation == 270 {
|
||||||
|
@ -266,8 +266,12 @@ impl Profile {
|
|||||||
.arg(self.meta.game.exe());
|
.arg(self.meta.game.exe());
|
||||||
|
|
||||||
if let Some(display) = &self.data.display {
|
if let Some(display) = &self.data.display {
|
||||||
|
if display.dont_switch_primary && display.target != "default" {
|
||||||
|
game_builder.args(["-monitor", &display.monitor_index_override.unwrap_or_else(|| 1).to_string()]);
|
||||||
|
} else {
|
||||||
|
game_builder.args(["-monitor", "1"]);
|
||||||
|
}
|
||||||
game_builder.args([
|
game_builder.args([
|
||||||
"-monitor 1",
|
|
||||||
"-screen-width", &display.rez.0.to_string(),
|
"-screen-width", &display.rez.0.to_string(),
|
||||||
"-screen-height", &display.rez.1.to_string(),
|
"-screen-height", &display.rez.1.to_string(),
|
||||||
"-screen-fullscreen", if display.mode == DisplayMode::Fullscreen { "1" } else { "0" }
|
"-screen-fullscreen", if display.mode == DisplayMode::Fullscreen { "1" } else { "0" }
|
||||||
|
@ -8,6 +8,7 @@ const category = getCurrentInstance()?.parent?.parent?.parent?.parent; // yes in
|
|||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
title: String,
|
title: String,
|
||||||
tooltip: String,
|
tooltip: String,
|
||||||
|
dangerousTooltip: String,
|
||||||
});
|
});
|
||||||
|
|
||||||
const searched = computed(() => {
|
const searched = computed(() => {
|
||||||
@ -32,6 +33,11 @@ const searched = computed(() => {
|
|||||||
class="pi pi-question-circle ml-2"
|
class="pi pi-question-circle ml-2"
|
||||||
v-tooltip="tooltip"
|
v-tooltip="tooltip"
|
||||||
></span>
|
></span>
|
||||||
|
<span
|
||||||
|
v-if="dangerousTooltip"
|
||||||
|
class="pi pi-exclamation-circle ml-2 text-red-500"
|
||||||
|
v-tooltip="dangerousTooltip"
|
||||||
|
></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<slot />
|
<slot />
|
||||||
|
@ -157,5 +157,40 @@ loadDisplays();
|
|||||||
v-model="prf.current!.data.display.borderless_fullscreen"
|
v-model="prf.current!.data.display.borderless_fullscreen"
|
||||||
/>
|
/>
|
||||||
</OptionRow>
|
</OptionRow>
|
||||||
|
<OptionRow
|
||||||
|
title="Skip switching primary display"
|
||||||
|
v-if="
|
||||||
|
capabilities.includes('display') &&
|
||||||
|
prf.current?.data.display.target !== 'default' &&
|
||||||
|
(prf.current!.data.display.dont_switch_primary ||
|
||||||
|
displayList.length > 2)
|
||||||
|
"
|
||||||
|
dangerous-tooltip="Only enable this option if switching the primary display causes issues. The monitors must have a matching refresh rate."
|
||||||
|
>
|
||||||
|
<ToggleSwitch
|
||||||
|
:disabled="extraDisplayOptionsDisabled"
|
||||||
|
v-model="prf.current!.data.display.dont_switch_primary"
|
||||||
|
/>
|
||||||
|
</OptionRow>
|
||||||
|
<OptionRow
|
||||||
|
title="Unity display index"
|
||||||
|
class="number-input"
|
||||||
|
v-if="
|
||||||
|
capabilities.includes('display') &&
|
||||||
|
prf.current?.data.display.target !== 'default' &&
|
||||||
|
prf.current!.data.display.dont_switch_primary
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<InputNumber
|
||||||
|
class="shrink"
|
||||||
|
size="small"
|
||||||
|
:min="1"
|
||||||
|
:max="32"
|
||||||
|
:use-grouping="false"
|
||||||
|
v-model="prf.current!.data.display.monitor_index_override"
|
||||||
|
:disabled="extraDisplayOptionsDisabled"
|
||||||
|
:allow-empty="true"
|
||||||
|
/>
|
||||||
|
</OptionRow>
|
||||||
</OptionCategory>
|
</OptionCategory>
|
||||||
</template>
|
</template>
|
||||||
|
@ -78,6 +78,8 @@ export interface DisplayConfig {
|
|||||||
rotation: number;
|
rotation: number;
|
||||||
frequency: number;
|
frequency: number;
|
||||||
borderless_fullscreen: boolean;
|
borderless_fullscreen: boolean;
|
||||||
|
dont_switch_primary: boolean;
|
||||||
|
monitor_index_override: number | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface NetworkConfig {
|
export interface NetworkConfig {
|
||||||
|
Reference in New Issue
Block a user